Skip to content

Commit

Permalink
removes old legacy razor macro examples, these need rewriting, update…
Browse files Browse the repository at this point in the history
…s the master pages docs
  • Loading branch information
Shazwazza committed Jul 10, 2015
1 parent 4732237 commit e6b6d48
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 254 deletions.
10 changes: 8 additions & 2 deletions Implementation/Routing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Explains how Umbraco builds its URLs and how the URLs are mapped back to nodes

TODO: Add more copy, link to reference docs

##Routing
##Render controller

This section will describe how Umbraco routing for MVC and WebApi controllers work
Match an MVC controller to handle the request

TODO: Add more copy, link to reference docs

##Auto-routed Controllers

How routing and URLs work for Umbraco WebApi and Surface Controllers

TODO: Add more copy, link to reference docs
25 changes: 0 additions & 25 deletions Reference/Templating/Macros/Razor/hello-world.md

This file was deleted.

27 changes: 0 additions & 27 deletions Reference/Templating/Macros/Razor/index.md

This file was deleted.

12 changes: 0 additions & 12 deletions Reference/Templating/Macros/Razor/using-dictionary-items.md

This file was deleted.

24 changes: 0 additions & 24 deletions Reference/Templating/Macros/Razor/using-macro-parameters.md

This file was deleted.

46 changes: 0 additions & 46 deletions Reference/Templating/Macros/Razor/using-pluralised-queries.md

This file was deleted.

34 changes: 0 additions & 34 deletions Reference/Templating/Macros/Razor/using-razor-axes.md

This file was deleted.

45 changes: 0 additions & 45 deletions Reference/Templating/Macros/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,49 +31,4 @@ Using Macro parameters to pass changeable values to a Razor script to increase f

### Webforms

TODO: Link to another page for this!

####Basic Syntax:
This will insert a macro with the alias '`YourMacroAlias`' into the template

<umbraco:Macro Alias="YourMacroAlias" runat="server"></umbraco:Macro>

####Inline macros
Macros can also render inline code, directly in the template

<umbraco:Macro runat="server" language="cshtml">
<h1>@Model.Name</h1>
@foreach(var child in Model.Children){
<a href="@Model.Url">@Model.Name</a>
}
</umbraco:Macro>


####Defining Property Values
This will insert a macro with the alias 'YourMacroAlias' into the template and set the macro property named 'YourPropertyName' to the value 'hello'

<umbraco:Macro Alias="YourMacroAlias" runat="server" YourPropertyName="hello"></umbraco:Macro>

####Passing a value from the current page, into a macro
This will insert a macro with the alias 'YourMacroAlias' into the template and set the macro property named 'YourPropertyName' to the current node ID of the content node currently being executed.

<umbraco:Macro Alias="YourMacroAlias" runat="server" YourPropertyName="[#pageID]"></umbraco:Macro>

The syntax for passing in values for the currently executing node is: [#YourNodePropertyName]

<umbraco:Macro Alias="YourMacroAlias" runat="server" YourPropertyName="[#PageTitle]"></umbraco:Macro>

**Example:** If the current executing node's Document Type defines a property with an alias 'PageTitle' and you would like to pass this value into a macro as a property, the syntax would be `[#PageTitle]`

The syntax for passing in values of node property that is defined on any adjacent node of currently executed node, so you want to get it recursively is: `[$YourNodePropertyName]`

<umbraco:Macro Alias="YourMacroAlias" runat="server" YourPropertyName="[$PageTitle]"></umbraco:Macro>

Passing a value from the request collection, into a macro
Using the same technique, it is possible to send a value from the page's request collection

<umbraco:Macro Alias="YourMacroAlias" runat="server" YourPropertyName="[@yourQueryString]"></umbraco:Macro>

Passing a cookie value, into a macro

<umbraco:Macro Alias="YourMacroAlias" runat="server" YourPropertyName="[%cookieName]"></umbraco:Macro>
29 changes: 4 additions & 25 deletions Reference/Templating/Masterpages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,13 @@ This will output an `<img/>` tag when the template renders:

[See the full umbraco:image reference](umbracoimage.md)

##[umbraco:macro](../Macros/index.md)
##[umbraco:macro](umbracomacro.md)

The umbraco:macro element renders the out of a macro with a given alias. Attributes on the element is passed to the macro as parameters for the rendering. In the sample below, the macro with the alias "topnavigation" is rendered, and the parameter "className" is set to "greenList" which is passed on to the script associated with the macro.

<umbraco:macro alias="topnavigation" className="greenList" runat="server" />

The umbraco:macro element can also be used inline, so a macro is not required, instead, code can be inserted directly in the template.

<umbraco:Macro runat="server" language="cshtml">
<h1>@Model.Name</h1>
@foreach(var child in Model.Children){
<a href="@Model.Url">@Model.Name</a>
}
</umbraco:Macro>

When attributes are passed into a macro, you can use the following syntax to send data from the current state to your macro.

CurrentPage property value: [#propertyAlias]
Recursive value: [$propertyAlias]
Cookie value: [%cookieValueKey]
Value from request collection: [@requestValueKey]


[See the full umbraco:macro reference](umbracomacro.md)

[See the full umbraco:macro reference](umbracomacro.md)

##Template inheritance
Templates can inherite other templates and uses 2 elements to merge them. `<asp:contentplaceholder>` and `<asp:content>` To connect one template with another, use the dropdownlist in Umbraco to specify the master template, this will change the template declation and make a database change.
Expand Down Expand Up @@ -128,8 +111,4 @@ it is possible to run C# code diretly in the template, but is not in any way rec
if(SomeCondition){
throw new Exception("Explosion!");
}
%>

##client dependency


%>
45 changes: 45 additions & 0 deletions Reference/Templating/Masterpages/umbracomacro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#Umbraco:macro

The umbraco:macro element renders the out of a macro with a given alias. Attributes on the element is passed to the macro as parameters for the rendering. In the sample below, the macro with the alias "topnavigation" is rendered, and the parameter "className" is set to "greenList" which is passed on to the script associated with the macro.

<umbraco:macro alias="topnavigation" className="greenList" runat="server" />

###Inline macros

The umbraco:macro element can also be used inline, so a macro is not required, instead, code can be inserted directly in the template.

<umbraco:Macro runat="server" language="cshtml">
<h1>@Model.Name</h1>
@foreach(var child in Model.Children){
<a href="@Model.Url">@Model.Name</a>
}
</umbraco:Macro>

###Defining Property Values
This will insert a macro with the alias 'YourMacroAlias' into the template and set the macro property named 'YourPropertyName' to the value 'hello'

<umbraco:Macro Alias="YourMacroAlias" runat="server" YourPropertyName="hello"></umbraco:Macro>

###Passing a value from the current page, into a macro
This will insert a macro with the alias 'YourMacroAlias' into the template and set the macro property named 'YourPropertyName' to the current node ID of the content node currently being executed.

<umbraco:Macro Alias="YourMacroAlias" runat="server" YourPropertyName="[#pageID]"></umbraco:Macro>

The syntax for passing in values for the currently executing node is: [#YourNodePropertyName]

<umbraco:Macro Alias="YourMacroAlias" runat="server" YourPropertyName="[#PageTitle]"></umbraco:Macro>

**Example:** If the current executing node's Document Type defines a property with an alias 'PageTitle' and you would like to pass this value into a macro as a property, the syntax would be `[#PageTitle]`

The syntax for passing in values of node property that is defined on any adjacent node of currently executed node, so you want to get it recursively is: `[$YourNodePropertyName]`

<umbraco:Macro Alias="YourMacroAlias" runat="server" YourPropertyName="[$PageTitle]"></umbraco:Macro>

Passing a value from the request collection, into a macro
Using the same technique, it is possible to send a value from the page's request collection

<umbraco:Macro Alias="YourMacroAlias" runat="server" YourPropertyName="[@yourQueryString]"></umbraco:Macro>

Passing a cookie value, into a macro

<umbraco:Macro Alias="YourMacroAlias" runat="server" YourPropertyName="[%cookieName]"></umbraco:Macro>
14 changes: 0 additions & 14 deletions Reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,6 @@ Information about all of Umbraco's configuration files and options.

Working with Umbraco templates: views, partial views, child actions, razor syntax, macros and working with JavaScript/Css.

TODO: Move all of this inside of templates

###[Using Razor axes](using-razor-axes.md)
Razor axes is a feature of DynamicNode, which allows you to query for specific parts of the content tree without using hardcoded Ids.

###[Using Pluralised queries](using-pluralised-queries.md)
Pluralised queries enables you to query and filter pages with a simple syntax.

###[Using Razor functions to make recursive queries](using-razor-functions-to-make-recursive-queries.md)
A razor function is a small, embedded method you can call inside of your razor scripts

###[Using Umbraco Dictionary Items](using-dictionary-items.md)
How to access dictionary items from Razor

##[Querying & models](Querying/index.md)

Information about the data models used to display content in Umbraco and the various ways of querying it.
Expand Down

0 comments on commit e6b6d48

Please sign in to comment.