UMBRACO_GETITEM > Content Picker > Nice URL? Options
VirtualRichard
Posted: Tuesday, March 04, 2008 10:54:48 AM

Rank: Fanatic

Joined: 9/17/2007
Posts: 264
Location: London, UK.
Another day, another possibly stupid question.

Can I get the Nice Url for a node ID chosen in a content picker to display in a Macro within a template *without* resorting to XSL?

At the moment I have:

Code:
<a href="<?UMBRACO_GETITEM field="PanelLink"/>"><img src="<?UMBRACO_GETITEM field="Panel"/>"></a>


Giving:

<a href="1316"><img src="mypanel.jpg"></a>

No use of course! How do I NiceUrl-ify that? If I have to use XSL to do this, the words "sledgehammer" and "nut" spring to mind :hmm:

Richard

P.s. I really don't like the search defaulting to community. Now, whenever I try to search the forum, I get pages returned from all over the interweb and usually only links to big lists of umbraco forum posts - I can't find anything any more!


2 * 3 * 3 * 37 : The prime factorisation of The Beast.
mikew909
Posted: Tuesday, March 04, 2008 1:16:01 PM
Rank: Newbie

Joined: 9/26/2007
Posts: 10
Put down that hammer my good man :)

I feel your pain cause I spent ages trying to get my nice urls working - but once you have it sorted youre away...

The simplest way imho is actually XSLT so I'll put it anyway just for fun

In my template

<MediaImage>
http://mikescoolserver.com<?UMBRACO_MACRO macroAlias="niceURL" currentID="[#pageID]" mediaID="[#imgMedia]">
</?UMBRACO_MACRO>
</MediaImage>

in my XSLT which you've added a variable called imgMedia to

<xsl:variable name="mediaID" select="/macro/mediaID"/>
...
..

<xsl:if test="/macro/mediaID != ''">

<xsl:value-of select="umbraco.library:GetMedia($mediaID, false)/data[@alias='umbracoFile']/text()" />

</xsl:if>

and thats all there is to it. All within umbraco interface.

hope this helps, also seeing as Umbraco is basically XSLT driven you'll have a hard time avoiding it if you want to get real familiar with it

Hope this was some help

Mike :thumbup:

VirtualRichard
Posted: Tuesday, March 04, 2008 1:23:27 PM

Rank: Fanatic

Joined: 9/17/2007
Posts: 264
Location: London, UK.
Hi, thanks for that. I figured this must be the case, so I documented my solution in my blog:

UMBRACO_GETITEM > Content Picker > Nice URL?

Wish there was a way to just have it happen and not go through all that! If anyone ever figures out how, do let us know.

I don't mind the XSLT so much, it's the XPath that gives me the willies :cry:

Richard

2 * 3 * 3 * 37 : The prime factorisation of The Beast.
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.