spc_section_alias
I am no longer maintaining or developing the spc_section_alias plugin for Textpattern. I apologize for the inconvenience. However, if you are still interested in the plugin, you can download it below. I have verified that the plugin works with g1.19 and I am reasonably sure it works with the 4.x versions of Textpattern as well.
spc_section_alias, version 0.5
(Note: I have lost the original source. The plugin source is decoded from the plugin file using my Textpattern plugin decoder.)
Original Documentation:
- spc_section_alias – Defines the information associated with a section.
- section – The section to which you are associating new information. If you do not specify a section, this will modify the data associated with the current section.
- group – This value will allow you to group certain sections together for better handling with the iterate function (see below). If no group is specified, then the group value is set to “default”. This may be a comma delimited list. If no matching section is found in the comma delimited list of groups, then a new entry will be created in the first group listed.
- name – A human readable name for your section.
- title – A title value for links.
- id – An id value for links.
- accesskey – An accesskey value for links.
- description – A description of your section.
- description2 – A second description for your section.
- breakid – A value that will appear as id= in the break tag when calling spc_section_alias_iterate with break=’li’. At the moment, it does not support any other break type.
- inactive – Setting this value to “1” will will make the iterate function ignore this entry. This does not affect any other function.
- namethis, titlethis, idthis, accesskeythis, descriptionthis, description2this, breakidthis – Use these to redefine existing values. They take any occurrence of ”.this.” in the supplied input, and replace it with the already stored value. If there are no existing values to redefine, the ‘this’ functions will store new values.
- spc_section_alias_copy – Copies the section contents from one group to another.
- section – A section to copy. If none is specified, the current section is used.
- srcgroup – A comma delimited list of groups to search for section information. This function takes the information from the first group found.
- destgroup – A comma delimited list of groups. If the function finds a matching section in this group list, it will copy the section information to this group. If it does not find a matching section, it will create a new group using the first entry from the comma delimited list.
- spc_section_alias_section – Given a section, this returns the section. This is useful when combined with other plugins that demand a section variable.
- section – Return information from this particular section. If no section is specified, the current section is used.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- spc_section_alias_article_section – (Article form tag) Same as above, but this is meant to be used within an article form.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- spc_section_alias_name – Return the human readable name for a section.
- section – Return information from this particular section. If no section is specified, the current section is used.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- spc_section_alias_article_name – (Article form tag) Same as above, but this is meant to be used within an article form.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- spc_section_alias_title – Return the link title for a section.
- section – Return information from this particular section. If no section is specified, the current section is used.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- spc_section_alias_article_title – (Article form tag) Same as above, but this is meant to be used within an article form.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- spc_section_alias_id – Return the link id for a section.
- section – Return information from this particular section. If no section is specified, the current section is used.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- spc_section_alias_article_id – (Article form tag) Same as above, but this is meant to be used within an article form.
- group – The section group.This value will accept a comma delimited list. If no group is specified, the group value is set to “default”.
- spc_section_alias_description – Return the description for a section.
- section – Return information from this particular section. If no section is specified, the current section is used.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- spc_section_alias_article_description – (Article form tag) Same as above, but this is meant to be used within an article form.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- spc_section_alias_description2 – Return the second description for a section.
- section – Return information from this particular section. If no section is specified, the current section is used.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- spc_section_alias_article_description2 – (Article form tag) Same as above, but this is meant to be used within an article form.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- spc_section_alias_link – Return a working link for a particular section that includes title, id, and human readable name.
- section – Return information from this particular section. If no section is specified, the current section is used.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- spc_section_alias_article_link – (Article form tag) Same as above, but this is meant to be used within an article form.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- spc_section_alias_iterate – This tag takes a form and a group, and then iterates over all of the sections listed within that group using the form as input. The form tags are the same tags as listed above. This is useful as a means of outputting a list of sections, section links, etc.
- form – The form over which to iterate.
- group – The section group. If no group is specified, the group value is set to “default”. This value will accept a comma delimited list.
- wraptag – A wraptag to put around the output.
- break – A break tag to put around the elements.
Ok, let me take a moment to describe how to use this plugin. To start with, make a list of all your sections. On my site (http://www.stantonchampion.com), I have several sections that I use, including “articles” and “sitenews”. I want to have a human readable name for each of these along with a description and some other cool stuff. I start by creating a form (I call it section_prefix) that looks like this:
<code>
<txp:spc_section_alias section=“articles” title=“General Stuff” name=“Articles”
description=“Home of general stuff I write, reviews, news, rants, and raves. If
I wrote about something, it’s probably hiding in here.” />
<txp:spc_section_alias section=“sitenews” title=“Stuff about this site” name=“Site News”
description=“Articles about changes to the site go here. Read all there is to know about
how this place has changed over time.” />
</code>
At the top of each page where I reference anything related to sections (pretty much all of them), I add:
<code><txp:output_form form=“section_prefix” /></code>
Now I modify my articles form to say that a given post is in a section: <code><txp:spc_section_alias_article_link /></code>
I want my articles page to say “Articles” at the top and I want my sitenews page to say “Site News” at the top. I modify my page template and add: <code><txp:spc_section_alias_name /></code>
I also want a description for each of these sections. I can add a description with: <code><txp:spc_section_alias_description /></code>
Next, I want an unorganized list of all my sections. To do this, I create a form called section_list that says:
<code>
<txp:spc_section_alias_link />
</code>
To activate this, I call:
<code>
<txp:spc_section_alias_iterate form=“section_list” wraptag=“ul” break=“li” />
</code>
Lastly, I want a detailed section/description/category/date archive thing, like my page here. This page is a combination of my plugin along with akw_month_list and asy_category_list. I’ll need the iterate function above (without the wraptag and break values), but I’ll change my form to:
<code>
<p><strong><txp:spc_section_alias_link /></strong><br />
<txp:spc_section_alias_description />
<br />
By Date: <txp:akw_month_list break=”, “ section=”<txp:spc_section_alias_section />” /><br />
By Category: <txp:asy_category_list break=”, “ section=”<txp:spc_section_alias_section />” />
</p>
</code>
Finally, I added the optional “group” field that lets you group different types of sections. If your site is big enough that you have more than one type of section list, then use the group value to keep them straight. If you don’t specify a group, then it uses the group “default”.
Poke around on my site. Any place where I reference a section, including the navbar at the top, uses this plugin now.
Quick note #1 – You can link back to the Home section by adding a link to section=“default”.
Quick note #2 – Starting with version 0.4, you can redefine section alias entries on a per section basis. Use the copy, alias, and iterate functions together to do things like add bold tags around the section you’re presently viewing. For example, let’s say you’ve got a bunch of sections, you’re iterating them, and you want bold tags to appear around the section you are presently viewing (let’s say it’s named articles). Let’s also say that articles is in group ‘2’, but it could also be in ‘1’ or ‘3’. Do the following:
Copy the current values for articles somewhere else (note that this only copies the current section):
<code>
<txp:spc_section_alias_copy srcgroup=“1,2,3” destgroup=“temp” />
</code>
Change the existing value using the new ‘this’ values (see above):
<code>
<txp:spc_section_alias namethis=”<b>.this.</b>” group=“1,2,3” />
</code>
Do your iterate:
<code>
<txp:spc_section_alias_iterate wraptag=“ul” break=“li” group=“1,2,3” />
</code>
Then, change the value back to the way it was:
<code>
<txp:spc_section_alias_copy srcgroup=“temp” destgroup=“1,2,3” />
</code>