Please tell me how can I do this on asp/umbraco ( I come form php workd)
I need to have a config value on the master template. I need to declare it before all html. And I need to print/echo the value of the var on several parts of the template. I don't need that the var exists outside the template instance.
If I was you I'd check out the .NET macro vid here if you can: http://umbraco.org/documentation/videos/for-developers/foundation/using-net-user-controls next, if you have Visual Studio Express create a new project, add a user control, and put the code above in the Page_Load event (of the Code Behind of the user control) and every where within your page you need the value to be displayed put it there within an html element. FYI Umbraco MasterPages are in the Developers section under the Templates Node. Also go to MSDN.com to brush up on you ASP.NET Page Event LifeCycle and MasterPage knowledge.
declare var inside template
Please tell me how can I do this on asp/umbraco ( I come form php workd)
I need to have a config value on the master template. I need to declare it before all html. And I need to print/echo the value of the var on several parts of the template. I don't need that the var exists outside the template instance.
Please someone tell me what is the best approach.
regards
Hi,
Could quite easily do that in your master template using the <%%> syntax, but you should explicitely set the type of the variable you're using
and use the variable in your template using the following syntax:
Hope this helps.
Regards,
/Dirk
Hi dirk.
It's not working, I recieved a server error. I am sure it's because my lack of knowleget about asp and master pages. My template begins like this:
Where would you put the code to create the var?
regards
aa
If I was you I'd check out the .NET macro vid here if you can: http://umbraco.org/documentation/videos/for-developers/foundation/using-net-user-controls next, if you have Visual Studio Express create a new project, add a user control, and put the code above in the Page_Load event (of the Code Behind of the user control) and every where within your page you need the value to be displayed put it there within an html element. FYI Umbraco MasterPages are in the Developers section under the Templates Node. Also go to MSDN.com to brush up on you ASP.NET Page Event LifeCycle and MasterPage knowledge.
If you want to grab a value from config you can do something like this.
I hope this helps
danielcruger.com
is working on a reply...