This shows you the differences between the selected revision and the current version of the page.
| ordered 2009/10/06 00:17 | ordered 2009/10/14 22:36 current | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| //Additionally, a blog administator can set orders to categories in a blog for use with the //categorylist// form of this skinvar. A template can be designated, as well, to be used when displaying items in a given category when using the //blog// form of this skinvar. A category's items can also be excluded from the main page when using the //blog// form of this skinvar.// | //Additionally, a blog administator can set orders to categories in a blog for use with the //categorylist// form of this skinvar. A template can be designated, as well, to be used when displaying items in a given category when using the //blog// form of this skinvar. A category's items can also be excluded from the main page when using the //blog// form of this skinvar.// | ||
| - | //Also, can show individual items anywhere, show random items, show custom list of blogs, and some other cool things.// | + | //Also, can show individual items anywhere, show random items, show custom list of blogs, list items under each category in a category list, and some other cool things.// |
| ^General Plugin info ^^ | ^General Plugin info ^^ | ||
| ^Author: | [[http://revcetera.com/ftruscot/|Frank Truscott]] | | ^Author: | [[http://revcetera.com/ftruscot/|Frank Truscott]] | | ||
| - | ^Current Version: | 1.34.01 | | + | ^Current Version: | 1.35 | |
| ^Download: | [[http://revcetera.com/ftruscot/downloads/nucleus_plugins.html#ordered|NP_Ordered.zip]] 4 files, 21KB| | ^Download: | [[http://revcetera.com/ftruscot/downloads/nucleus_plugins.html#ordered|NP_Ordered.zip]] 4 files, 21KB| | ||
| ^Forum Thread: |http://forum.nucleuscms.org/viewtopic.php?t=14070| | ^Forum Thread: |http://forum.nucleuscms.org/viewtopic.php?t=14070| | ||
| Line 32: | Line 32: | ||
| =====SkinVars===== | =====SkinVars===== | ||
| - | **Note that this is not exhaustive documentation and is a little out-dated. For complete and up-to-date documentation, see the help file included in the plugin distribution.** | + | **See the help file included in the plugin distribution.** |
| - | These skinvars should be valid in all skin types except member, error, and imagepopup: | + | =====How to use the plugin===== |
| - | There are four forms of this skinvar — //blog//, //categorylist//, //item//, and //setnavigation//. | + | **See the help file included in the plugin distribution.** |
| - | The //blog// form of the skinvar is used to replace the blog and otherblog skinvars. Its general form is as follows: | + | =====What it does===== |
| - | <%Ordered(blog,//show,templatename,amount,category,blogname//)%> | + | This plugin is a bit of a swiss-army knife. It's general function is to allow custom ordering of item lists, category lists, and blog lists. Its skinvars have a complex syntax that is described in the help file, here will be listed some of the things you can do with this plugin, organized by skinvar form. It should be noted that all its functions are tied to a single blog and it will not list items, categories, or blogs over multiple blogs. |
| - | where: | + | An additional feature is that each category can be assigned a special template for display in indexes (blog) or item pages (item), so that on the main page, some items may be displayed with the normal template, while a special category, e.g. photos, can be displayed using a different template. |
| - | * //show// : ordered,unordered or all. Optional. Sets which items to show, the ordered ones, the unordered ones, or all (ordered then unordered). Defaults to ordered. Advanced - Accepts parameters of form (field-order) where //field// is time, title, author, category, or authorname and where //order// is asc, desc, or random, for custom sorting. See examples for a sample. | + | |
| - | * //templatename// : string. Required. Name of template to use to display items. Can include optional templatemode of strict to force the use of the given template, regardless of any special templates set for categories, e.g. default/index(strict). | + | |
| - | * //amount// : string. Optional. The amount of items to show (default = 10). Can also contain an offset telling Nucleus to start only from the given item. e.g. 10(5) shows 10 items starting from item 5 | + | |
| - | * //category// : string. Optional. Name of the category to show. Special value of %ALL% will force items from all categories to be shown, even on pages where the category is set. Defaults to current category, if set. | + | |
| - | * //blogname// : string. Optional. Short name of the blog to show. Defaults to current blog. | + | |
| - | The //categorylist// form of the skinvar is used to replace the categorylist skinvar. Its general form is as follows: | + | **blog** |
| - | <%Ordered(categorylist,//show,templatename,blogname//)%> | + | This is a replacement for the <%blog%> and <%otherblog%> skinvars and is mostly used on Main Index skin parts, but can also be used in sidebars and other places where items need to be listed. It can list items in the following orders: |
| + | * Custom, i.e. manually determined by assigning an order to items. In each case, you can choose to list only the items that have been assigned orders, only the ones that haven't, or both (ordered ones first). Also, you can choose to display only the ordered ones with order numbers between two limits. | ||
| + | * time | ||
| + | * title | ||
| + | * author | ||
| + | * category | ||
| + | * authorname | ||
| + | * views (requires NP_Views) | ||
| + | Each sorting, except custom, can be done ascending, descending, or random. | ||
| - | where: | + | **categorylist** |
| - | * //show// : ordered,unordered or all. Optional. Sets which categories to show, the ordered ones, the unordered ones, or all (ordered then unordered). Defaults to ordered. Advanced - Accepts parameters of form (field-order) where //field// is either name or desc and where //order// is asc, desc, or random, for custom sorting by name or description. See examples for a sample. | + | This is a replacement of the <%categorylist%> and <%othercategorylist%> skinvars and is most often used in a sidebar to list the categories in a given blog. Besides allowing special ordering of the categories, you can also choose to list items from the categories inside the category list, e.g. the titles of the latest three items from each category. |
| - | * //templatename// : string. Required. Name of template to use to display categorylist | + | |
| - | * //blogname// : string. Optional. Short name of the blog to show. Defaults to current blog. | + | |
| - | The //item// form of the skinvar is used to replace the item skinvar. It has two general forms is as follows: | + | It can list categories in the following orders: |
| + | * Custom, i.e. manually determined by assigning an order to categories. In each case, you can choose to list only the categories that have been assigned orders, only the ones that haven't, or both (ordered ones first). Also, you can choose to display only the ordered ones with order numbers between two limits. | ||
| + | * name | ||
| + | * description | ||
| + | Each sorting, except custom, can be done ascending, descending, or random. | ||
| - | <%Ordered(item,//templatename//,//itemid//)%> | + | **bloglist** |
| - | + | This is a replacement for the <%bloglist%> skinvar and can be used anywhere in your skin. For a site with multiple blogs, it can list the blogs in various orders and even list the most recent items from those blogs. | |
| - | where: | + | |
| - | * //templatename// : string. Required. Name of template to use to display items. Can include optional templatemode of strict to force the use of the given template, regardless of any special templates set for categories, e.g. default/index(strict). | + | |
| - | * //itemid// : integer. Optional. Item id of the item you want to show. Useful for showing a specific item (using a special template) in the sidebar, or other part of your page. | + | |
| - | + | ||
| - | <%Ordered(item,//templatename//,random,//hints//)%> | + | |
| - | + | ||
| - | where: | + | |
| - | * //templatename// : string. Required. Name of template to use to display items. Can include optional templatemode of strict to force the use of the given template, regardless of any special templates set for categories, e.g. default/index(strict). | + | |
| - | * random : constant string. Required. Indicates that you want to display a random item. Useful for showing a random item (using a special template) in the sidebar, or other part of your page. | + | |
| - | * //hints// : formatted string. Optional. Gives some hints or restrictions to the items that will be randomly chosen. For example, it can be used to only get item from a certain blog, or to not get items from a certain category, or to get items from a certain time period. The general form is //blog//|//category//|//time// where the formats for each are described below: | + | |
| - | * //blog// : -1 for all blogs, 0 for current blog, and #:#:# for only those blogids, or !#:#:# for all but these blogids, where # (integer) is the blog id of a blog. Default is 0 (current blog). | + | |
| - | * //category// : -1 for all categories, 0 for current category, and #:#:# for only those catids or !#:#:# for all but these catids, where # (integer) is the category id of a category. Default is 0 (current category). | + | |
| - | * //time// : number of days back to grab items (+# will get items newer than # days and -# will get items older than # days) and 0 means no time limit. Default is 0 (no time limit). | + | |
| - | + | ||
| - | The //setnavigation// form of the skinvar is used on item pages (in the head) to set the nextlink and prevlink to use the NP_Ordered order. It also can force the $catid variable to be set according to the cateegory of the item, even if catid is not explicitly given in the URL. It's general form is as follows: | + | |
| - | + | ||
| - | <%Ordered(setnavigation,//show,amount,setcat//)%> | + | |
| - | + | ||
| - | where: | + | |
| - | * //show// : ordered,unordered or all. Optional. Sets which items to show, the ordered ones, the unordered ones, or all (ordered then unordered). Defaults to ordered. Advanced - Accepts parameters of form (field-order) where //field// is time, title, author, category, or authorname and where //order// is asc, desc, or random, for custom sorting. See examples for a sample. | + | |
| - | * //amount// : string. Optional. The amount of items to show (default = 10). | + | |
| - | * //setcat// : string. Optional. yes or no. Indicates whether the catid variable should be set according to category of item, even if not set in URL. Default is no. | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | =====How to use the plugin===== | + | |
| - | Use the item edit form or the plugin admin page to set the order of the items you wish to order. Then add the skinvar described above to your skins (usually the Main Index part) where you want the posts displayed. Will usually take the place of the <%blog(templatename,amount)%> skinvar. | + | It can list blogs in the following orders: |
| + | * Custom, i.e. manually determined by assigning an order to blogs. In each case, you can choose to list only the blogs that have been assigned orders, only the ones that haven't, or both (ordered ones first). Also, you can choose to display only the ordered ones with order numbers between two limits. | ||
| + | * newestblog | ||
| + | * oldestblog | ||
| + | * lastentry | ||
| + | * itemcount | ||
| + | * reverse by name | ||
| + | * shortname | ||
| + | * reverse by shortname | ||
| + | * random | ||
| + | I've used it on a multi-user open blog community to list the blogs on the front page so that the most active bloggers get their blogs listed first (itemcount) or so that the most recently active blogs get listed first (lastentry). | ||
| - | Some usage examples are given below: | + | **item**: |
| + | This is a replacement for the <%item%> skinvar and is used mostly on the Item Pages skin part, but it can be used anywhere in the skin where you want a specific item (or randomly chosen item) to be displayed. | ||
| - | * **<%Ordered(blog,ordered,default/index,10)%>**: Displays the first 10 ordered items using the default/index template, except for items whose category specifies a special template. | + | In the form where no item is specified, it must be used on the Item Pages skin part and its main purpose is to display the selected item using any custom template chosen for that category in the Ordered admin pages. |
| - | * **<%Ordered(blog,ordered,default/index(strict),10)%>**: Displays the first 10 ordered items, using the default/index template for all items (even if you have set a special template to be used for a given category). | + | |
| - | * **<%Ordered(blog,all,default/index,10)%>**: Displays ordered items sorted by order, then the unordered items sorted by post time, up to a total of 10 posts. | + | |
| - | * **<%Ordered(blog,all(title-asc),default/index,10)%>**: Displays ordered items sorted by order, then the unordered items sorted alphabetically by post <b>title</b>, up to a total of 10 posts. | + | |
| - | * **<%Ordered(blog,all(title-random),default/index,10)%>**: Displays items in random order, up to a total of 10 posts. | + | |
| - | * **<%Ordered(blog,ordered,default/index,3,Announcements)%>**: Displays the first 3 ordered items from the Announcements category. | + | |
| - | * **<%Ordered(blog,unordered,default/index,10)%>**: Displays the first 10 unordered items. | + | |
| - | * **<%Ordered(blog,ordered,default/index,10,,Static)%>**: Displays the first 10 ordered items from the blog with shortname of Static. | + | |
| - | * **<%Ordered(categorylist,ordered,default/index)%>**: Lists the ordered categories using the Category List format in the default/index template. | + | |
| - | * **<%Ordered(categorylist,unordered,default/index)%>**: Lists the unordered categories using the Category List format in the default/index template. | + | |
| - | * **<%Ordered(categorylist,all,default/index)%>**: Lists the ordered categories sorted by order followed by the unordered categories sorted by name. | + | |
| - | * **<%Ordered(categorylist,all(desc-asc),default/index)%>**: Lists the ordered categories sorted by order followed by the unordered categories sorted alphabetically by description.</li> | + | |
| - | * **<%Ordered(categorylist,ordered,default/index,Static)%>**: Lists the ordered categories from the blog with shortname of Static, using the Category List format in the default/index template. | + | |
| - | * **<%Ordered(setnavigation,all,10)%>**: Sets the next and previous items based on the NP_Ordered order. Navigation includes first the ordered items then the unordered items. | + | |
| - | * **<%Ordered(item,default/item)%>**: Displays the set item on its detail page using the default/item template, unless another template is specified for its category. | + | |
| - | * **<%Ordered(item,bare/headlines,6)%>**: Displays the item with itemid of 6 anywhere in your skin using a template called bare/headlines. | + | |
| - | * **<%Ordered(item,default/item)%>**: Displays the set item on its detail page using the default/item template, unless another template is specified for its category. | + | |
| - | * **<%Ordered(item,default/box,35)%>**: Displays item 35 anywhere using a custom template called default/box, unless another template is specified for its category. | + | |
| - | * **<%Ordered(item,default/box,random,0|3:8|45)%>**: Displays a random item from the current blog, and from either category 3 or 8, and which is newer than 45 days old. Displays it using a custom template called default/box. | + | |
| - | * **<%Ordered(item,default/box,random,0|!3:8|-45)%>**: Displays a random item from the current blog, but not from either category 3 or 8, and which is older than 45 days old. Displays it using a custom template called default/box. | + | |
| - | * **<%Ordered(item,default/box,random,-1|-1|0)%>**: Displays a random item from the any blog, and from any category, and from any time. Displays it using a custom template called default/box. | + | |
| - | * **<%Ordered(item,default/box,random,!3|!2:7:8:22|45)%>**: Displays a random item from any blog except blog 3, and from any category except from 2, 7, 8, or 22, and which is newer than 45 days old. Displays it using a custom template called default/box. | + | |
| - | * **<%Ordered(setnavigation,ordered,10,yes)%>**: Sets the next and previous items based on the NP_Ordered order. Only ordered items are included and since catid is set, only items in the same category are included. | + | |
| - | * **<%Ordered(setnavigation,all(title-asc),10)%>**: Sets the next and previous items based on the Ordered order (unordered items being sorted aplhabetically by title). | + | |
| + | In the form where an item number is specified, it will display that item anywhere in the skin using the specified template. Will act like a sticky, or can be used to display an "about me" item in a sidebar, footer, etc... | ||
| - | There are lots of ways to use this plugin to do things like sticky some important announcements or posts (like an About item), to order the items in a fairly static category, but leaving the other categories as dynamic, blog-like categories. The possibilities are endless, but most uses might require some clever uses of the <%if(category,catname,CategoryName)%> skinvar and tweaks in templates to get the desired affect. If anyone wants to submit examples use cases, I will be happy to include them in this document. Submit to this forum thread. | + | In its final form, it can be used to display a random item anywhere in your skin. You can also set hints to the plugin to draw that random item from specific blogs, categories, and times. |
| - | The NP_Ordered plugin admin page allows blog administrators to manage item order and category order. In addition to ordering categories, blog administrators can set a template to be used to display items from each category when using the //blog// form of this skinvar. If no template is given, the template set in the //blog// form of the skinvar is used. Categories can also be set to not show on the main page when using the //blog// form of the skinvar. | ||
| =====Tips and Tricks===== | =====Tips and Tricks===== | ||
| Line 131: | Line 98: | ||
| =====History===== | =====History===== | ||
| + | * 1.35 - 14 Oct 2009 | ||
| + | * allow items to be shown within categorylist | ||
| * 1.34.01 - 05 Oct2009 - | * 1.34.01 - 05 Oct2009 - | ||
| * fix obscure bug in some PHP4 configurations | * fix obscure bug in some PHP4 configurations | ||