北京pk10精准一码数学计算法

Razor Introduction

Before learning PageAdmin template making, please make sure you are a front-end person or have basic html, css and Javascript (or jquery) foundation.

Razor is not a programming language, it is just a markup syntax, which is very convenient for front-end personnel to retrieve background data in html pages.

PageAdmin's template is to use Razor tags to obtain data. Compared with other cms custom tags, Razor is more powerful and flexible, and supports calculations such as JavaScript, syntaxes such as loops, and assignments.

What is Razor?

Razor is a markup syntax that allows you to embed server-based code into a web page.

When a web page is written to a browser, server-based code can create dynamic content. When a web page loads, the server executes server-based code within the page before returning the page to the browser. Because it runs on a server, this code can perform complex tasks, such as accessing a database.

Razor is based on Mvc, which is designed for web application page creation.

And Javascript?

JavaScript is currently the most commonly used script by front-end staff. razor is almost similar to JavaScript syntax in terms of syntax, variables, logic, etc.

The differences are: JavaScript is parsed by the browser, razor is parsed by the server, javascript is mainly used for page effects, and razor is mainly used for server-side data and file reading.

javascript syntax is contained in <script> tag </ script>

  <script type = "text / javascript">
 var name = "javascript";
 </ script> 

And razor syntax is basically contained in @ {}

  @ {
 var name = "Razor";
 } 

Syntax for reading variables:

  <div> @ (name) </ div>