Developer forum

Forum » Templates » Razor global paragraph tag

Razor global paragraph tag

Denys Ubizskyy
Reply

Hi,

I have converted html page template to Razor and got problems with global paragraph tags.
Previously it looked like:

<!--@Global:Paragraph.Content(12345)-->

but Razor changed it to:

@GetValue("Global:Paragraph.Content(12345)")

and it doesn't work.
Any suggestions?

 


Replies

 
Sten Hougaard
Reply

Hi Denys,

According to Dynamicweb statement found here: Webinar about Razor global tags are not supported (yet) in Razor.

/Sten Hougaard

 
Mikkel Ricky
Reply
This post has been marked as an answer

You still have to use <!--@Global:Paragraph.Content(12345)-->, i.e. old Dynamicweb Html syntax, for this in Razor templates.

We'll look into fixing the Convert to Razor function to not make this wrong conversion.

Best regards,
Mikkel

 

 

 

Votes for this answer: 1
 
Denys Ubizskyy
Reply

Really works, thank you Mikkel.
 

 
Sten Hougaard
Reply

Any news regarding Razor support for Global tags? It is nice that you can use the old HTML tag, but what if I need to do some tests in Razor based on a value of Global tags?

 

 

 

Med venlig hilsen/Best regards,

 

Sten Hougaard

Webudvikler

 

A: København/Aarhus . W: www.1stweb.dk

 

 

 
Nicolai Høeg Pedersen
Reply

No news - due to the way Global tags work. It would need a minor refactoring and could give you performance problems if you use more global paragraph tags.

 
Sten Hougaard
Reply

I seem to remember that Global tags have been implemented in Razor, am I wrong?

Found this: 

@GetGlobalValue("Global:Area.ID")

Is that correct?

/Sten

 
Mikkel Ricky
Reply

Global tags are available in Razor, but you really don't need them. You should in stead use the properties of the PageView object and other global objects, e.g.

@Pageview.Area
@Pageview.Page
@Pageview.User
@Dynamicweb.eCommerce.Common.Context.Cart

Best regards,
Mikkel

 

 

 
Sten Hougaard
Reply

Look here: http://developer.dynamicweb.com/releases/dynamicweb-8-4-1.aspx

Razor version of Global:Page.Content and Global:Paragraph.Content

Area: Templates\Razor
Description: Razor functions to render stuff just like Global:Page.Content and Global:Paragraph.Content have been added: @RenderPageContent(int pageId) @RenderParagraphContent(int paragraphId) Examples: @RenderPageContent(87) @RenderParagraphContent(42)

 

You must be logged in to post in the forum