I use a Content Picker document type to choose a link which is assigned to an image. The link works locally, the url is something like: domain.local/1234
the database on the development site is the same, but the links don't work. If I change the link, using the content picker, directly on dev, it works fine. Frustrating.
so first of all, what gives?
second of all, why is the url the id of the page? Every other link throughout the site is like: about-us.aspx
There can very easily be differences on the node id's from dev to live versions. On the inititial deploy they are the same, if you deploy using a dump of the database. But from there the numeration is hard to control dependent on your setup and where content is created etc.
You can't rely on id's being the same in different versions of your site.
When you're using the content picker it returns an id. So in order to get a nice url shown you should use some XSLT for instance and call the umbraco.library:NiceUrl and feed it with the id from the content picker...
Happy to see that you got this fixed...I'm just wondering if you by accident was using the preview mode...somehow got it triggered on the root node?
EDIT: Obviously I was not thinking clearly here...I guess you fetched the value by using the umbraco:item in the template? Then it makes perfect sense that you only get the id returned.
I'm having the same problem. It's generating the page ID instead of using just "default.aspx" or a real index page. How can I fix this? My code in the XSLT file is below:
What happens if you try to use the "navigation prototype" out of the box, which can be selected from the dropdown list when one creates an XSLT based macro in the developer section?
URL question
Hello. More noob questions from me :)
I use a Content Picker document type to choose a link which is assigned to an image. The link works locally, the url is something like: domain.local/1234
the database on the development site is the same, but the links don't work. If I change the link, using the content picker, directly on dev, it works fine. Frustrating.
so first of all, what gives?
second of all, why is the url the id of the page? Every other link throughout the site is like: about-us.aspx
Thanks
Hi Tom
There can very easily be differences on the node id's from dev to live versions. On the inititial deploy they are the same, if you deploy using a dump of the database. But from there the numeration is hard to control dependent on your setup and where content is created etc.
You can't rely on id's being the same in different versions of your site.
When you're using the content picker it returns an id. So in order to get a nice url shown you should use some XSLT for instance and call the umbraco.library:NiceUrl and feed it with the id from the content picker...
It could look something like this:
<a href="{umbraco.library:NiceUrl($currentPage/yourcontentpickeralias)}">Your page</a>
Please note that this example is based on the new schema.
If you're running an earlier version of Umbraco (before 4.5 was released) the syntax looks like this
<a href="{umbraco.library:NiceUrl($currentPage/data [@alias ='yourcontentpickeralias'])}">Your page</a>
I hope this makes sense to you?
/Jan
Hi.
I fixed this using an XLST macro, rather than in the masterpages themselves (we had to do some other things with XLST for that section anyway)
Hi Tom
Happy to see that you got this fixed...I'm just wondering if you by accident was using the preview mode...somehow got it triggered on the root node?
EDIT: Obviously I was not thinking clearly here...I guess you fetched the value by using the umbraco:item in the template? Then it makes perfect sense that you only get the id returned.
/Jan
I'm having the same problem. It's generating the page ID instead of using just "default.aspx" or a real index page. How can I fix this? My code in the XSLT file is below:
<xsl:if test="$currentPage/@id = $currentPage/ancestor-or-self::* [@level=$level]/@id">
<xsl:attribute name="class">home current</xsl:attribute>
</xsl:if>
Hi Jon
I'm not sure you have managed to post all your code? The above sample looks like you're trying to add a current class if a condition is met?
Please post the whole code that you're struggling with and it will be more easy to point you in the right direction :-)
/Jan
Sorry, Jan. Here's my umbTopNavigation.xslt code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<ul id="topNavigation">
<li class="home">
<xsl:if test="$currentPage/@id = $currentPage/ancestor-or-self::* [@level=$level]/@id">
<xsl:attribute name="class">home current</xsl:attribute>
</xsl:if>
<a href="/">Home</a>
</li>
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="@id = $currentPage/@id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<a class="navigation" href="{umbraco.library:NiceUrl(@id)}">
<span><xsl:value-of select="@nodeName"/></span>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Hi Jon
Is it a version 4.6.1 you experience this on?
What happens if you try to use the "navigation prototype" out of the box, which can be selected from the dropdown list when one creates an XSLT based macro in the developer section?
/Jan
is working on a reply...