Cannot widen from target type to primitive type Options
imayat12
Posted: Friday, September 28, 2007 5:53:24 PM

Rank: Addict

Joined: 7/19/2006
Posts: 649
Location: Preston, UK
Guys,

I have page when i publish it then make changes save and preview all works as expected. If however the page is not published then i try preview i get "Cannot widen from target type to primitive type" [XsltException: Function 'umbraco.library:NiceUrl()' has failed.]


This is umbraco 2.1.7.

Any ideas?

Regards

Ismail

Level 2 certified. If it aint broke dont fix.
bwakkie
Posted: Thursday, October 18, 2007 5:15:39 PM

Rank: Devotee

Joined: 7/6/2007
Posts: 69
Location: Brussels
Ismail Mayat wrote:

Guys,

I have page when i publish it then make changes save and preview all works as expected. If however the page is not published then i try preview i get "Cannot widen from target type to primitive type" [XsltException: Function 'umbraco.library:NiceUrl()' has failed.]


This is umbraco 2.1.7.

Any ideas?

Regards

Ismail

I have the same problem. Did you find out / resolve it Ismail?

^(B(astia{2}n)?)(\s)?(W(ak{2}ie)?)$ IRC --> irc://irc.freenode.org/umbraco
imayat12
Posted: Thursday, October 18, 2007 5:24:02 PM

Rank: Addict

Joined: 7/19/2006
Posts: 649
Location: Preston, UK
Bastian,

I had to do the following hack not nice but it worked:
Code:

<!-- are we in preview mode? -->
<xsl:if test="umbraco.library:RequestQueryString('umbVersion')=''">
<li>
<a target="_blank">
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="$currentPage/@id='1057'">
  <xsl:value-of select="umbraco.library:NiceUrl('1057')" />
  ?altTemplate=print home
  </xsl:when>
<xsl:otherwise>
  <xsl:value-of select="umbraco.library:NiceUrl($currentPage/@id)" />
  ?altTemplate=print
  </xsl:otherwise>
  </xsl:choose>
  </xsl:attribute>
  Print
  </a>       
  </li>
</xsl:if>



regards

Ismail

Level 2 certified. If it aint broke dont fix.
lucylle
Posted: Thursday, January 31, 2008 6:53:07 AM
Rank: Newbie

Joined: 10/26/2007
Posts: 2
I had a similar issue, and came upon this post. Even though it didn't provide me a solution, I did find one so I thought I'd share it.

For some reason, when the node isn't published, $currentPage for me contains the entire site tree so $currentPage/@id gave me an empty string. It's easy to test whether this is happening to you just by adding a few debug statements.

To get around this, I used umbraco.library:PageId() instead.
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.