Search

Now that the Section Schemas extension outputs all tags from a section and their frequency, we can build a weighted tag cloud.

This template assumes the following:

  • you have a section named Articles with a taglist named Tags
  • you can installed Section Schemas and created the DS for the Articles section and attached to your page

Download

http://gist.github.com/96305

Usage

Call the tag-cloud template passing the XPath reference to the options of the taglist. The range parameter is used to create class names so that you can style the tags differently (in size, weight, colour etc.). In the example above, a range of 5 is provided, so the class attribute values will be one of: size-1, size-2, size-3, size-4 and size-5 depending on how frequently the tag has been used (the least used will be size-1, the most used size-5, and everything else evened out inbetween). To create more variety, increase the range.

Note that the template requires the math:max() function provided by EXSLT, hence I've included the namespace at the top.

hi nick,

I'm really new to the section schema thingy but your extension seems promising. although I tried to make it work but nothing happens so far. I've installed your section-schema extension first and created a section scheme ds for my articles section, that's where my taglist is to be found.

in my template I used <xsl:import href="../utilities/tag-cloud.xsl"/> to include your utility. all works fine. I guess. because nothing happens at all. section-schema ds shows up in my debug. utility is loaded but nothing comes out :(

I changed the param tags according to my article-sections name: <xsl:with-param name="tags" select="section-schema[@handle='artikel']/*[name()='tags']//options"/>

The actual tags are located in the DS slider-content: <slider-content> <section id="6" handle="artikel">Artikel</section> <entry id="120" comments="0" images="0"> <categories> <item handle="agentur" id="116">category</item> </categories> <title handle="title">title</title> <body word-count="7"><p>text</p></body> <date time="17:12" weekday="4">2009-04-16</date> <tags> <item handle="tag1">tag1</item> <item handle="tag2">tag2</item> <item handle="tag3">tag3</item> </tags> </entry> </slider-content>

Any hint for me to get things working?

thx maik

Hi maik, could you post your full page XML and XSLT please? Pop them onto pastie.org so I can get a better picture of your problem.

Hi nick,

sorry, I got hung up on some other projects the last days. Right now I’m back on my Project. You’re saying that the section schema should output all used tags and their frequency?! Seems like mine is missing that information:

<script src='http://pastie.org/471994.js'></script>

Is this pasty-paste part of a symphony pasty import utility template, or rather a service by pastie? I think I have seen it before somewhere else recently.

@mwaidmann seems like you’re using an older version of the Section Schemas extension. v1.2 fixed a problem with selects and tags, and also added sortorder and location attributes for each field.

http://github.com/nickdunn/section_schemas/tree/master

Yeah :) Thanks for your help nick.

This is a great template.

I have one minor suggestion. Since tag list fields can be sourced in other sections, and the section schema lists both used and unused tags, it helps to append [@count > 0] at the end of the tags parameter select to cull links with empty results.

Decreased fruitless clicking increases world peace. :)

Hi, i have following error:

Parse error: syntax error, unexpected '<', expecting ')' in /htdocs/workspace/data-sources/data.section_schema_articles.php on line 18

After saving Section Schema^^ Symphony: 2.2.1 Sections schemas: 1.7

What i'am doing wrong? Thanks.

Can you attach the file?

My hunch is that when the PHP file was created by the extension it left some additional characters in the body.

I clone version 1.7.1 from github, and it's work well.

Running into this error when using Section Schema with a Tag List:

Fatal error: Call to a member function fetchCol() on a non-object in /Users/lbradford/Sites/Internal/symphony-2/extensions/section_schemas/data-sources/datasource.section_schema.php on line 252

Thanks!

Ahhah! Someone has come before me:

https://github.com/nickdunn/section_schemas/issues/7

Mark that as resolved.

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