The tsw_sec_list plugin is a simple plugin to display information about the sections defined in your Textpattern system.
tsw_section_list allows you to display each section name as a hyper link with a corresponding hyper linked image, or any combination of the two. If you just want a listing of each section, you can do that. If you just want to display an image for each section you can do that too. Or you can display both the section name and an image. If you select to include an image, the image file must be named the same as the section, except in all lowercase (e.g. Section name: Books, Image name: books.png).
tsw_sec_list also allows you to sort your sections by name or by title, and you can choose to include or omit the 'default' section. If you want to include the 'default' section you can also choose to rename it and/or pop it to the front of your list of sections. (For example, this comes in handy when you want to rename the default section to 'Home', but also want it to come first in your list of sections for easier navigation.)
Update: version 0.4.1 now includes the ability to specify a separate 'class' attribute for the current section. See the description for the new attribute 'curclass' below.
Update: version 0.5 now includes the ability to display either the name or the title of each section, instead of just the name. See the description for the new attribute 'disptext' below for more details. This version also includes the ability to specify a list of sections that will be excluded from the output. See the description for the new attribute 'exclude' below for more details. The addition of 'exclude' also removed the need for the 'incdef' attribute. If you were using 'incdef' you will need to remove it and switch to 'exclude' instead.
Attributes: (all attributes are optional)
- wraptag
-
HTML tag used to wrap around each grouping of section name and/or section image.
Default: ''
Example: wraptag='div'
- wrapclass
-
class attribute to be added to the wraptag.
Default: ''
Example: wrapclass='seclist'
- sectag
-
HTML tag used to wrap around each section text.
Default: ''
Example: sectag='h3'
- secclass
-
class attribute to be added to the sectag.
Default: ''
Example: secclass='secname'
- curclass
-
class attribute to be added to the wraptag of the current section. Defaults to the value of 'wrapclass' if not set.
Default: ''
Example: curclass='currentsec'
- disptext
-
Select what text to display for each section. This should either be 'name' or 'title', anything else will default to 'name'.
Default: 'name'
Example: disptext='title'
- exclude
-
A comma separated list of section names to exclude.
Default: ''
Example: exclude='default,code'
- incimg
-
Select whether or not to include a section image.
Default: 0
Example: incimg='1'
- incsec
-
Select whether or not to include the section name.
Default: 1
Example: incsec='0'
- imgloc
-
Specify the location of section images. This should be a path relative to the root of your site.
Default: images/site/
Example: imgloc='images/'
- imgtype
-
Specify the type of the section images (png, gif ,jpg, etc...).
Default: png
Example: imgtype='gif'
- renamedef
-
Select whether or not to rename the 'default' section using the values specified in 'defname' and 'deftitle'.
Default: 1
Example: renamedef='0'
- popdef
-
Select whether or not to move the 'default' section to the beginning of the list of sections.
Default: 1
Example: popdef='0'
- defname
-
Specify a new name for the 'default' section, if renamedef=1.
Default: Home
Example: defname='Home'
- deftitle
-
Specify a new title for the 'default' section, if renamedef=1.
Default: Return To Home
Example: deftitle='Back Home'
- orderby
-
Select how to order the sections. This can either be 'name' or 'title' or left empty for no ordering.
Default: ''
Example: orderby='name'
Usage examples
- Using the tag with all of the default values.
<txp:tsw_sec_list />
- Using the tag to omit the 'default' section.
<txp:tsw_sec_list exclude='default' />
- Using the tag to include section images, wrapping each inside a 'div' element with a class of 'navsec', wrapping each section name in an 'h3' tag, and ordering the sections by name.
<txp:tsw_sec_list wraptag='div' sectag='h3' wrapclass='navsec' incimg='1' orderby='name' />
File Download
- File:
tsw_sec_list_v0.5.txt [16.14KB]
- Downloads: 834