Get Item Help Options
dcrug
Posted: Tuesday, October 07, 2008 5:36:55 PM
Rank: Newbie

Joined: 5/2/2008
Posts: 22
Location: NYC
Does anyone know how I might be able to grab the pageName of the parent.
For example I have several pages underneath one parent and i want to display the pageName of the Parent in a header. Maybe a way that i can use the ParentID to grab the pagename.

Dirk
Posted: Tuesday, October 07, 2008 5:55:34 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Hi dcrug,

If you're using v4, you should be able to use some inline xslt in the template.

For a version prior to v4, create a small xlst that grabs the pageName from the parent node of the current node being processed.

Code:
<xsl:value-of select="$currentPage/parent::node/@pageName" />

or
Code:
<xsl:value-of select="$currentPage/../@pageName" />


Get the xslt wrapped in a macro and put the macro on the page.

Hope that helps.

Regards,
/Dirk



level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
dcrug
Posted: Tuesday, October 07, 2008 6:15:55 PM
Rank: Newbie

Joined: 5/2/2008
Posts: 22
Location: NYC
Any idea why my <xsl:value-of select="$currentPage/../@pageName" /> doesn't show up on the page at all. I've been having some issues with that.
rorythecheese
Posted: Tuesday, October 07, 2008 6:36:19 PM

Rank: Enthusiast

Joined: 2/15/2008
Posts: 40
Location: London, England
probably use @nodeName or data[@alias='pageName']
Dirk
Posted: Tuesday, October 07, 2008 7:11:32 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Yep,

You're right, rorythecheese, should have been @nodeName. Thanks for correcting me on this.

Regards,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
manishahowale
Posted: Tuesday, November 18, 2008 11:54:48 AM
Rank: Newbie

Joined: 11/12/2008
Posts: 13
Location: Bombay
Hi,

I need the parent page name in umbraco template. How do I get it? @parentId gives me the current page parent id but I need the parent name. How do I get it?

Thanks in advance,
Manisha
Dirk
Posted: Tuesday, November 18, 2008 12:09:10 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Hmm,

Have you read the complete thread? I've been answering this question before.
Ok, let's summarize:

If using v4+, use inline xslt in your template to get the name of the parent page
A nice tutorial on using inline xslt can be found at:

http://umbraco.org/documentation/books/inline-xslt/how-to-use-it

If using a pre v4 version, create a small xslt and accompanying macro to get the desired info. Code can be found in this thread.

Regards,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
manishahowale
Posted: Tuesday, November 18, 2008 1:19:05 PM
Rank: Newbie

Joined: 11/12/2008
Posts: 13
Location: Bombay
Hi,

If possible can u paste complete xslt code here or else I'll have to figure out the xslt structure and where the line

<xsl:value-of select="$currentPage/../@nodeName" /> needs to be placed.
It will save lot of my time.

Thanks,
Manisha
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.