Search

When I try to use symphony variables inside of <script> tags Symphony doesn't seem to parse the tags and when I view source I am still left with the $today or @title... This seems to be the case whether i use {} around the variables or not. Is there any way around this?

Thanks!

This is what i ended up doing to make it work.

<xsl:text>var restaurant = "</xsl:text>
<xsl:value-of select="data/clients/company-name/@value"/>
<xsl:text>";</xsl:text>

I have tried this using the following code:

<script type=”text/javascript”> $.backstretch(“/images/backgrounds/”); </script>

This outputs:

<script type=”text/javascript”>$.backstretch(“http://dev4.eyes-down.net/workspace/images/backgrounds/ marc-jacobs-sth-audley.jpg “);</script>

So I’m nearly there. The problem is that Symphony is adding line breaks before and after the inserted value $background-image.

Can anyone suggest how I can get it to render like this..?

<script type=”text/javascript”>$.backstretch(“http://dev4.eyes-down.net/workspace/images/backgrounds/marc-jacobs-sth-audley.jpg”);</script>

Thanks

When you dump a value-of of “background-image” you actually just want the filename node within. So modifying your XPath to the following should work:

... select="background-image/filename" ...

Aaaaah. I solved this as I was typing a response. My XML looks like this…

<page-backgrounds>
     <entry id="52">
        <background-image>
            <item id="62" handle="covent-garden-royal-operajpg" section-handle="background-images" section-name="Background images">covent-garden-royal-opera.jpg</item>
        </background-image>
        <page handle="home">Home</page>
    </entry>
</page-backgrounds>

And I needed to refer to:

select="background-image/item"

rather than:

value of select="background-image"

I will put it down to XPath inexperience. Thanks for your help again.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details