Disregard the above that does not work. Applying your code works though and applies a class to every link however it does not loop through all the tags but applies the same class as the page it is on to all links. How do I get it to apply different classes to the different tag links.
If you remove the ! from string(umbraco.library:RequestQuerystring('filter')) != 'Special1' and change it to string(umbraco.library:RequestQuerystring('filter')) = 'Special1' then class should be set to "Special1".
But it will only be set as long as the filter parameter holds the value "Special1" - don't you need to have the different classes set in advance?
What does your code for fetching the available tabs? How do you generate them?
You could write out a class name when iterating through them where you add a class like <a href="#" class="special-{position()}">Link</a> - by doing this each tab gets a unique class, but I'm a bit unsure if it's enough to meet your demands if you need something more specific perhaps - the mentioned method is very generic as you can see :)
Jan, Here is the code that reads what special types from the tags on products are in the system, This generates a list of links like a tag cloud however the list does not have any class styles which I need it to have depending on what special type it is
In order to ensure that I get exactly what it is you're after could you perhaps try to just hardcode what you want the output to look like? I would rather be sure that I understand you 100% than just write in the wild :)
Changing classes dependant on url
I have a product list which is filtered using tags by appending the filter tag to the url ie ?filter=Special
I want to adjust the class in a list of <a> tags depending on the special type selected and specified in the url
ie url?filter=special1 then class should be "special1" ir url?filter=special2 then class should be "special2"
this is the code I am using, the bit i am missing I think is the correct test statement to check the current url for the specified value of the tag.
<xsl:if test="SpecialCategory != 0">
<xsl:attribute name="class">
<xsl:text>Special</xsl:text>
</xsl:attribute>
</xsl:if>
I also tried the followin g but that did not seem to work either
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="@nodesTagged = Special">
<xsl:value-of select="string('special')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string('@nodesTagged')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
Hi Chris
Good to see you active on the forums......
You could do it this way
Hope this helps :-)
Cheers
Nigel
Are you saying in this test statement i can check for the filter ie
RequestQueryString('filter')) != 'Special1'"
Disregard the above that does not work. Applying your code works though and applies a class to every link however it does not loop through all the tags but applies the same class as the page it is on to all links. How do I get it to apply different classes to the different tag links.
ie <a class="Specials" href="/mailer.aspx?numberPerPage=12&filter=Specials">Specials</a>
<a class="Specials1" href="/mailer.aspx?numberPerPage=12&filter=Specials1">Specials1</a>
<a class="Specials2" href="/mailer.aspx?numberPerPage=12&filter=Specials2">Specials2</a>
<a class="Specials3" href="/mailer.aspx?numberPerPage=12&filter=Specials3">Specials3</a>
Hi Chris
If you remove the ! from string(umbraco.library:RequestQuerystring('filter')) != 'Special1' and change it to string(umbraco.library:RequestQuerystring('filter')) = 'Special1' then class should be set to "Special1".
But it will only be set as long as the filter parameter holds the value "Special1" - don't you need to have the different classes set in advance?
/Jan
yes correct i would like the classes all set at the beginning depending on the tabs available.
Hi Chris
What does your code for fetching the available tabs? How do you generate them?
You could write out a class name when iterating through them where you add a class like <a href="#" class="special-{position()}">Link</a> - by doing this each tab gets a unique class, but I'm a bit unsure if it's enough to meet your demands if you need something more specific perhaps - the mentioned method is very generic as you can see :)
/Jan
Jan, Here is the code that reads what special types from the tags on products are in the system, This generates a list of links like a tag cloud however the list does not have any class styles which I need it to have depending on what special type it is
<p>Special Types</p>
<xsl:variable name="commaListofcat">
<xsl:for-each select="$productsAll/category">
<xsl:value-of select="concat(.,',')"/>
</xsl:for-each>
</xsl:variable>
<!--<xsl:value-of select="$commaListofcat"/>-->
<article class="clear martop20">
<div class="curved10 brd4px tagCloudGeneric rel">
<a class="curved5 sortButton" href="/promotions-competitions/?numberPerPage={$numberPerPage}">Show All</a>
<p>
<xsl:for-each select="tagsLib:getAllTags()/tags/tag">
<xsl:if test="contains(Exslt.ExsltStrings:lowercase($commaListofcat),Exslt.ExsltStrings:lowercase(.))">
<xsl:variable name="SpecialsClass">
<xsl:choose>
<xsl:when test="string(umbraco.library:RequestQueryString('filter')) != ''">
<xsl:value-of select="umbraco.library:RequestQueryString('filter')"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>mydefaultclass</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a class="{$SpecialsClass}">
<xsl:attribute name="href">
<xsl:value-of select="concat(umbraco.library:NiceUrl($currentPage/@id),'?numberPerPage=',$numberPerPage,'&filter=',.)"/>
</xsl:attribute>
Hi Chris
Sorry for my late reply.
Have you been able to figure this one out yet?
In order to ensure that I get exactly what it is you're after could you perhaps try to just hardcode what you want the output to look like? I would rather be sure that I understand you 100% than just write in the wild :)
/Jan
is working on a reply...