Search

So, I am making a page with text in the body. And there is a sub nav that i would like the user to be able to click throu and change the text depending on the link clicked.

Since all the content is under the same area other then the sub nav i thought i could control this with params. I have made a section and the data source.

So my main question is can i use the same Section with the same data source but use different params to filter the content?

So my main question is can i use the same Section with the same data source but use different params to filter the content?

http://getsymphony.com/learn/concepts/view/data-source-filters/

If a filter pattern contains only a parameter, and that parameter isn’t set when the data source is executed, the filter rule will be ignored and the data source will execute as if the filter didn’t exist.

Yes.

thanks nick that cleared up alot. I am still running into trouble somewhere. let me see if this can help. I have a page about memberships but on the left side i have a sub nav for the user to determine different kinds of memberships. So I made a section called memberships. and then the data source. I wanted to add a label to each entry and add that to the params so when the user clicked a certain type of membership the text would change to the entries with that label.

Any ideas?

if you have a page called memberships with an url structure memberships with a url param filterby (or whatever u want) root/memberships/filterby the data source will return all entries (or 404 if u want) if no filterby param is passed if you pass users so root/membership/users then the data source will return only enties with the param users.

you have to add a sort by filter to the datasource with {$filterby} in the field

So if i add {$filterby} in the datasource, will i then be able to filter by the params i set in the XSL code? like if i have a membership page. And on the left i have 4 links that will filter between the group of users. Can i have a param called “topHalf” or something and when you click that it will only bring up the ones i need? Or do i need to make a datasource for all the different types of users?

will i then be able to filter by the params i set in the XSL code?

Sounds like you’re confusing parameters set in yout XSLT using <xsl:param .../> compared to setting URL Parameters.

If when creating a page “Members” you add type into the “URL Parameters” field, you will then be able to access this page as:

/members/

But you will also be able to append a value to the end of the URL:

/members/nickdunn

This value “nickdunn” will populate a parameter named type. You can use this in Data Sources to filter fields. So that a Data Source knows to evaluate this string as a parameter (i.e. to get the value of the parameter named type, not just use the plain text type as the filter) you surround it with curly braces and append a dollar.

{$type}

However, parameters that you create in your XSLT with the following syntax are not available to filter on in Data Sources, since the Data Sources have already executed by the time your XSLT is used.

<xsl:param name="type" select="/data/my-data-source/entry/..."/>

If you want to filter your Members by “top half” then you should start by creating a Select Box in the Members section with the four possible values in the “Static Options” box. When creating a new Member you’d then see these four values in the drop down.

You can then create your Members page as I suggest above, allowing the passing of a type parameter in the URL. You then create a Data Source from the Members section, filtering this “top half” Select Box with {$type}.

The effect this will have on the Data Source is:

  • when viewing the URL /members/ the filter in the Data Source will be ignored (since the type URL Parameter has no value), so all Members will be returned
  • when viewing the URL /members/:type (where :type is one of your four Select Box values), the filter will take effect and the Members Data Source will return only Members with that type.

I recommend reading Say Hello to the World for the very basics, and then trying out Say Hello to Symphony for more advanced stuff.

Aaahhhh yes! i get it!!! it was just that one step adding a select box to filter with. I was using a text box which wasn’t working maybe or i just have not set it up right. But thank you all for the insight.

A text box should still work.

um then i must be using the params wrong. In the Section i have “History” and “Current” so far that each new entry has. And in the data source i dont know what to do with the {$clueless}

but with the XSLT i have this

<xsl:apply-templates select="who">
    <xsl:with-param name="entry-id" select="@id"/>
</xsl:apply-templates>

then i also have this

<xsl:template match="who_is_in">

<xsl:param name="history" />
<xsl:for-each select="entry">
    <p>Title: <xsl:value-of select="body" /></p>
</xsl:for-each>

     </xsl:template>

<xsl:template name="get-who">
<xsl:param name="entry-id"/>
<xsl:if test="/data/abouts/entry[filter/item/@id = $entry-id]">
            <xsl:for-each select="entry">
    <p>Title: <xsl:value-of select="body" /></p>
       </xsl:for-each>

</xsl:if>
    </xsl:template>

Ill have to take a look at the readings some more.

i used a “Tag List” not a text box. I thought the word Tag would work with me trying to Tag entries ha.

So, Sorry to keep talking about this. but i almost got it i think. I knew how to do the URL params so i went ahead and did that. So when i click and entry it brings up a new page with all the entrys with the same filter type. But i what i have is a menu on the side that i want to be used to filter our the entries. So when i click “History” it will go to a new page with all the entiers with the filter history. But when i click the link it goes to the page but says it has no data.

any ideas?

thanks again guys

@dignmg - did you ever figure this one out?

No. Want i ended up doing was making a different section for each sub nav. “history”,”Who we are”,”etc” So each entry was different. I then linked the nav to the sub pages of About Us. So when you clicked on History i just went to te history page and added the history entries. If that makes sense…

Did you figure something out?

could you post your xml and xsl at pastie.org?

also, would you mind posting a screenshot of your datasource, so we can see how you have it set up?

Sure thing. Im not really sure how to use pastie but ill give it a go.

As you can see i just added more pages and more sections. I couldnt figure out how to filter out certain entries.

<script src=’http://pastie.org/914255.js’></script>

thanks

Attachments:
Screen shot 2010-04-11 at 12.09.28 PM.png

yea… that didnt work ha..no idea how to use pastie….:(

Just post the link to your pastie entry as such http://pastie.org/914255.

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