Search

So, I am really interested in Symphony it just seems to be the best CMS out there. Well made and thought out. Feels real easy to edit and do what ever i want with it. But i know nothing about xsl. Is there somewhere i can go to learn it? and be able to jump start my workflow in symphony?

Welcome… glad you found us :)

This section of the documentation is a good place to start. Allen, one of the devs, also has a bunch of good articles on his website.

Personally, I got started by reading XSLT Quickly.

Thanks, These sites seem like they will be very helpful.

I have another question that will help me and might help some other people.

I have been noticing the structure that symphony uses and i was wondering if someone had a easy way to under stand it?

for instance there are components. and in there there is Events, Data Sources, and of course Utilities.

i was wondering what each one does and how it works and what you need it for?

This may be alot of info to answer but i thought it might get the ball moving on this dev stuff.

Thanks again

Have you consulted the existing documentation? It’s in the process of being rewritten, but that link should cover these basic questions…

Hmmm, that is a big question. You’re probably going to learn the most by reading through the documentation and just messing around with a Symphony install yourself.

But here’s my short, incomplete, non-programmer’s attempt at describing the major building blocks of symphony. Understanding the first three will be the most important for you getting started:

Blueprints > Sections: Where you can create fields to store various kinds of information and group them together. Once you create a section you can add items to it usually in the “Content” section.

Blueprints > Components > Data Sources: Data Sources grab information from your sections and basically spit out the XML document that pages can use. You can have them output information in different structures, in various orders, or by scaling down what information you want.

Blueprints > Pages: Pages take the XML that data sources create, and then turn it into HTML. They are also what give you a URL structure to your site. If a page is named “About” then you can access it at http://www.yourdomain.com/about/

These are also important to understand, but a little bit more advanced:

Blueprints > Components > Events: Events are what make your pages more interactive/dynamic. They can do different things if you are logged in, they can help you submit forms, send emails, etc.

Blueprints > Components > Utilities: Think of Utilities as blocks of code that are going to be repeated throughout the site at various times. It’s a way of cutting down on the clutter within each page.

Hope that’s somewhat helpful.

So i have been doing some reading and i was wonering what the difference is between call-template and apple-template?

thanks

apply-templates will operate on matching nodesets

call-template runs a named template

<xsl:apply-templates select="my/nodes"/> works with something like <xsl:template match="my/nodes">Do stuff here</xsl:template>

<xsl:call-template name="my-template"/> works with <xsl:template name="my-template">Do stuff here</xsl:template>

Alright, let me ask this one real quick. In the master.xsl it call-template name=”page-title” but then apply-template name=”data/navigation”?

why does it do both?

They seems similar but that might be bc i dont understand it completely.

One says match and the other says name but couldnt I jsut make a match page-title? and it work the same way?

Those are performing two different tasks.

<xsl:call-template name="page-title"/> calls a named template that renders the text in the <title> element of your page’s html <head>.

<xsl:apply-templates select="data/navigation"/> matches the <navigation> element being returned by the Navigation data source and applies the matching template to create the site navigation.

ok its starting to make sense.

I am having some trouble now. I have been looking at Stephen Bau site. and i was trying to modify some things my own to try to learn my own.

But i have had some trouble.

I made a Utilite named get-journal.xsl

<xsl:template name="journal">


<xsl:for-each select="data/entries/entry">
  <h3><xsl:value-of select="title"/></h3>
  <p class="meta">Posted <xsl:value-of select="date"/>
    <xsl:if test="category">
        <xsl:text> in </xsl:text>
        <xsl:value-of select="category/item"/>
    </xsl:if>
    </p>
<xsl:copy-of select="description/*"/>
</xsl:for-each>

</xsl:template>

then in the home.xsl i have

<xsl:import href="../utilities/master.xsl"/>
<xsl:import href="../utilities/get-journal.xsl"/>


<xsl:template match="data">

<h1><xsl:value-of select="$website-name"/></h1>
<h2><xsl:value-of select="$page-title"/></h2>
 <xsl:value-of select="$today"/>

<xsl:apply-templates select="journal"/>

</xsl:template>

but nothing is working. I think i have some connection problem.

any ideas?

thanks so much

ok sorry for the double post…its not showing up for me.

Re: your forum posting issue: make sure you indent every line of code at least 4 spaces.

Re: your other problem:

I see two issues off the bat. One, you’re out of context. You’re trying to use your journal template from within a template that has matched the data element. That element is the context for your journal template. So when you try to do

<xsl:for-each select="data/entries/entry">

it’s not going to work because you’re already inside data. You’d need:

<xsl:for-each select="entries/entry">

Secondly, your journal template is a named template, but you’re not calling it. See my earlier comment. You’d need to use

<xsl:call-template name="journal">

instead of

<xsl:apply-templates select="journal"/>

ahhhh see now i get it. thanks! so much

I often find myself explaining call-template such that it’s similar to a function in such as PHP, C# or JavaScript. A function has a name, and can accept arguments. So let’s say a PHP function like this:

function returnLengthOfString($mystring) {
    return strlen($string);
}

And to call this function:

echo returnLengthOfString('how many letters?');

This accepts a $mystring argument and the function returns an integer, the string length. The same can be written in XSLT as a call-template — a template which has a set name to which you can pass arguments (should you wish to, these are optional):

<xsl:template name="returnLengthOfString">
    <xsl:param name="mystring"/>
    <xsl:value-of select="string-length($mystring)"/>
</xsl:template>

And to call this template:

<xsl:call-template name="returnLengthOfString">
    <xsl:with-param name="mystring" select="'how many letters?'"/>
</xsl:call-template>

As Craig says, the apply-templates are different in that you don’t call them with a set name and pass values, rather you tell the template to apply to matching XML nodes. When the template finds and matches these nodes, the template is applied using these nodes as the context.

@nickdunn I appreciate the gift of clarity that you have, exemplified in this explanation of call-template. Not everybody can do that - even when they know their stuff.

Thanks so much for the clarification that helps alot.. i think i can start seeing a difference.

im finally starting a website with symphony so ill keep ya posted

@nickdunn I appreciate the gift of clarity that you have

Nick, I think that’s a nomination for you to take over writing the documentation ;)

In your dreams, Zheng, in your dreams…

I would love to help out (not take over). :-)

I think Nick should do it. It was like this in my dreams!

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