Cascading templates Options
Carter
Posted: Friday, February 15, 2008 4:15:14 PM
Rank: Newbie

Joined: 1/24/2008
Posts: 20
I'm using cascading templates, but I'm can't figure out how to do something. I have a master template that provides my "shell", the HTML frame. Inside the body tag, I allow my child template(s) to display their data. However, I'd like the child template to set a property in the HEAD element of the Master tempate as well (i.e. the stylesheet). How can the child template file set a variable that the Master can read and display in the HEAD if the placeholder for the child template is in the BODY tag? Anyone know?
Thanks in advance.
mortenbock
Posted: Friday, February 15, 2008 6:46:20 PM

Rank: Addict

Joined: 7/19/2006
Posts: 790
Location: Århus, Denmark
If it is a GETITEM template tag you want to use, then you don't have to use it in the specific template that is tied to your documenttype.

For example, this would be fine (pseudo markup):
Code:

<mastertemplate>
<head><GETITEM field="myTitleProperty" /></head>
<body>
  <child template>
   <GETITEM field="myTextProperty" />
  </child template>
</body>
</mastertemplate>


Umbraco will assemble the templates to _one_ template, that will then be rendered with the current pages data.

Does this help? Or is this not what you meant?

Morten Bock - Level 2 certified - MVP 2008/2009 - My danish blog with a few english posts

dawoe
Posted: Monday, February 18, 2008 1:08:39 PM

Rank: Aficionado

Joined: 1/19/2008
Posts: 170
Location: Belgium
Carter wrote:

I'm using cascading templates, but I'm can't figure out how to do something. I have a master template that provides my "shell", the HTML frame. Inside the body tag, I allow my child template(s) to display their data. However, I'd like the child template to set a property in the HEAD element of the Master tempate as well (i.e. the stylesheet). How can the child template file set a variable that the Master can read and display in the HEAD if the placeholder for the child template is in the BODY tag? Anyone know?
Thanks in advance.


If I understand right, you want to add css-files based on your documenttype. If that's what you want to have a look at my blogpost about it.
http://dawoe.blogspot.com/2008/01/adding-css-or-javascript-to-your.html

Converting a DotNetNuke site to Umbraco : Follow it here
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.