|
|
Rank: Enthusiast
Joined: 10/9/2006 Posts: 14
|
Is it possible to use recursive parameters in a macro statment. I konow this can be done with Get_item Code: <?UMBRACO_GETITEM field="siteName" recursive="true"/>
But can this be done with a macro also? Code: <?UMBRACO_MACRO macroAlias="ShowSiteName" source="[#siteName]"></?UMBRACO_MACRO>
|
|
 Rank: Umbracoholic
Joined: 9/8/2006 Posts: 1,696 Location: KY, USA
|
Recursion is possible in the XSLT or .NET code called by a macro, though the macro itself is not recursive. cheers, doug.
MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
|
|
Rank: Enthusiast
Joined: 10/9/2006 Posts: 14
|
I want to add a parameter to the macro, I want to use a value defined in my root node ([#siteName]) I want to do this on all levels. Can this be done?
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 789 Location: Århus, Denmark
|
I think the way it is usually done is by cycling through the parent pages in the XSLT for your macro until a page contains a value for the specific property. It would be nice though if it were possible to do it right away in the macro tag.
|
|
 Rank: Umbracoholic
Joined: 7/20/2006 Posts: 1,074 Location: Charleston, West Virginia, United States
|
Michael, Since you are wanting to use a value from a specific level, you could easily use XPath to get that value. Code: <xsl:value-of select="$currentPage/ancestor-or-self::node[@level='1']/data[@alias='siteName']"/>
If you do not know the exact node, you would have to do a modification to let the xslt find the last (closest in level) entry with a value, and process it this way... Code:
for your data properties...
<xsl:value-of select="$currentPage/ancestor-or-self::node[data[@alias='siteName']!= ''][position()=last()]/data[@alias='siteName']"/>
or for attributes... (title, level, etc)
<xsl:value-of select="$currentPage/ancestor-or-self::node[@nodeName!= ''][position()=last()]/@nodeName"/>
I did not test these, but the logic should be about right. If you have a node that has HTML content, you may wish to use the library's strip HTML to test for content. That way, empty paragraph tags and such wont count as content. Hope this helps... Casey
• 2007/2008 MVP • 2008/2009 MVP • Certified • Licensing • Support • Development • Hosting •
|
|
 Rank: Umbracoholic
Joined: 7/20/2006 Posts: 1,074 Location: Charleston, West Virginia, United States
|
hoping to fix the tags by replying. When will this forum be fixed?
• 2007/2008 MVP • 2008/2009 MVP • Certified • Licensing • Support • Development • Hosting •
|
|
|
Guest |