Site Path
Hi
I am getting different URL paths and was wondering why it works in one case, but not another.
For instance, when I use
<xsl:attribute name="href"><xsl:value-of select="section-image/path"/></xsl:attribute>
When viewing the HTML source, it returns ../../../assets/images/mypic.jpg and clicking on the a href tag shows the image.
When I put it into a variable
<xsl:variable name="imagepath" select="section-image/path"/>
and have this markup:
<xsl:attribute name="style">background-image: url('<xsl:value-of select="$imagepath"/>')</xsl:attribute>
The result is /assets/images/mypic.jpg
The image doesn't show.
Any help would be appreciated or please let me know what I am doing wrong.
Thanks
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Bradley Wagner on 02 Jun, 2015 07:11 PM
Hi Ray,
href
is what we consider a "recognized" link-containing attribute so it is automatically re-written on render. In fact, both of those values resolve to/assets/images/mypic.jpg
; it's just that the page renderer is smart enough to recognize the one inside of anhref
as a link to another asset.For the second one, you'll need to wrap your URL in Cascade's
[system-asset]
pseudo-tags.This would look like:
Give that a try and let us know if that does the trick.
Also be sure to read through the linking documentation for a comprehensive list of how to link to assets in various contexts.
Please let me know if you have any questions.
Thanks!
2 Posted by Ray on 03 Jun, 2015 03:23 PM
Thanks alot for the quick response. It worked.
Cheers
3 Posted by Bradley Wagner on 03 Jun, 2015 03:29 PM
Great, Ray! Glad to hear it. I'm going to go ahead and close this discussion for now.
Bradley Wagner closed this discussion on 03 Jun, 2015 03:29 PM.