Search

Hi there,

Yes, like lots of other people here.. I’m new. I’m completely new to this XSLT concept. And yes, i like it because it is really clean. With direct PHP in your ‘template’ files (for instance at Wordpress and other blog/cms systems) or even with template parsers like smarty, you will allways get in trouble with the indention and line breaks. Now.. that said, i have a question regarding these so called ‘variables’ you seem to can call anywhere in the system.

For example:

<xsl:value-of select="$website-name"/>
    <xsl:text> - </xsl:text>
    <xsl:value-of select="$page-title"/>
</xsl:template>
  • Now where does $website-name come from? Where is it defined? How many of these ‘global’ vars are there, and what’s their name? Even better: how can i add more variables like that.

    I really like to use the url instead of my site name on some parts on my site. (not just “Site name”) but “site-name.com”.

  • My second question is regarding the localization of date-time. Is there somehow a way to let that date-time utility listen to the setlocale(LC_ALL, ‘nl_NL’); i set in the main index.php file?

Thank you

There are some variables (known as System Parameters) that are just available out of the box from Symphony.

To view these, when you ?debug a page, click on the Params link. Alternatively, you can view them in the documentation. I think $root is the one you are you looking for :)

You can also setup variables in XSLT with the following:

<xsl:variable name='url' select='"site-name.com"' />

Note the double quotes. That indicates the value is a string, otherwise it’d think it’s an XPath expression.

As for your second question, I’m not sure as I don’t use the default Symphony date-time utility. The timezone information is however available through the $timezone param.

setlocale(LC_ALL, ‘nl_NL’); i set in the main index.php file

I’d recommend changing the file manually, since your changes will be overwritten if/when you come to update Symphony in the future.

When you installed Symphony there would have been dropdowns to choose date formats and timezones. If you need to change these, the values are stored in the manifest/config.php

Thank you guys.

About the date-time thing, the format of it is fine, but it is about the language of the month’s. They are in English. I want them also be available in Dutch. The XLST templates can get their source from PHP files right? How about providing the right month names from there. This would mean you don’t have to write these months by hand.

In dutch, months are always lowercase. February, becomes februari. And PHP has already done that for us.

If you are using the date and time utility bundled with the default workspace, you have to edit the month names manually as they are hardcoded in the template itself:

<xsl:param name="month-word">
    <xsl:choose>
        <xsl:when test="$month = 01">January</xsl:when>
        <xsl:when test="$month = 02">February</xsl:when>
        <xsl:when test="$month = 03">March</xsl:when>
        <xsl:when test="$month = 04">April</xsl:when>
        <xsl:when test="$month = 05">May</xsl:when>
        <xsl:when test="$month = 06">June</xsl:when>
        <xsl:when test="$month = 07">July</xsl:when>
        <xsl:when test="$month = 08">August</xsl:when>
        <xsl:when test="$month = 09">September</xsl:when>
        <xsl:when test="$month = 10">October</xsl:when>
        <xsl:when test="$month = 11">November</xsl:when>
        <xsl:when test="$month = 12">December</xsl:when>
    </xsl:choose>
</xsl:param>

Now where does $website-name come from? Where is it defined? How many of these ‘global’ vars are there, and what’s their name? Even better: how can i add more variables like that.

There is the Global Parameter Loader extension you can use to add new parameters.

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