NP_Ordered 1.0 Set order of items and categories

Post your new plugins here!
ftruscot
Nucleus Guru
Nucleus Guru
Posts: 7430
Joined: Wed Feb 22, 2006 6:19 pm
Location: Massachusetts
Contact:

NP_Ordered 1.0 Set order of items and categories

Postby ftruscot » Tue Nov 07, 2006 8:11 pm

This plugin allows a blog administrator to set the order in which each item appears. Each item can be assigned an order number. When the blog form of the skinvar is used, the posts will be displayed in the order designated. Posts that are not given an order, are not shown when using the default form of the skinvar. An alternate form of the skinvar will display just the unordered posts ordered by post time. The skinvar also accepts an optional blogname parameter to display ordered posts from a different blog.

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.

Download: NP_Ordered.zip

=====Installing=====
    * Download and extract the zip file. Copy the NP_Ordered.php file and the ordered directory to the nucleus/plugins directory.
    * Use the Nucleus Admin GUI to register the NP_Ordered plugin into Nucleus. Be sure to click the Update Subscription List button.
=====Plugin Options=====

There are two options that control the operation of the Ordered plugin. These options are set from the edit options link in the Plugin Admin area.
    * Show Admin Area in quick menu : Whether the Ordered admin area should be shown in the Quick Menu area. yes or no. (yes)
    * Delete NP_Ordered data tables on uninstall? : Whether the database table should be deleted on an uninstall. This should be set to yes only when permanently removing NP_Ordered. yes or no. (no)


=====SkinVars=====

These skinvars should be valid in all skin types except member, error, and imagepopup:

There are two forms of this skinvar — blog and categorylist.

The blog form of the skinvar is used to replace the blog and otherblog skinvars. It's general form is as follows:

<%Ordered(blog,show,templatename,amount,category,blogname)%>

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.
* templatename : string. Required. Name of template to use to display items
* 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. 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. It's general form is as follows:
<%Ordered(categorylist,show,templatename,blogname)%>

where:
* 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.
* 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.


=====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.

Some usage examples are given below:

* <%Ordered(blog,ordered,default/index,10)%>: Displays the first 10 ordered items.
* <%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,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,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.

There are lot's 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.

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.

=====History=====
* Version 1.0, released 10 November 2006
Last edited by ftruscot on Thu May 10, 2007 10:52 pm, edited 1 time in total.
ftruscot
Nucleus Guru
Nucleus Guru
Posts: 7430
Joined: Wed Feb 22, 2006 6:19 pm
Location: Massachusetts
Contact:

Postby ftruscot » Sat Nov 11, 2006 5:27 am

This used to be NP_OrderedBlog, but I have added more feature including some added category settings, including order, excluding a category's items from the main page, and displaying a category's items with an alternate template.

I wrote this to redo a fairly static site I did a while ago using a bunch of little tricks, but it is hard to manage. I haven't finished the makeover yet but wanted to publish this since a couple of its features have been requested recently.
User avatar
roel
Nucleus Guru
Nucleus Guru
Posts: 4469
Joined: Tue Apr 16, 2002 12:41 am
Location: Rotterdam, The Netherlands
Contact:

Postby roel » Sat Nov 11, 2006 11:02 am

Nice work, Frank!
I bet a lot of people will love this one.
Is your question not solved yet?
User avatar
matt_t_hat
Posts: 1123
Joined: Sun Aug 21, 2005 4:45 pm
Location: UK
Contact:

Postby matt_t_hat » Sun Nov 12, 2006 2:38 pm

roel wrote:Nice work, Frank!
I bet a lot of people will love this one.


Like me for example.

Now we can create items as static-items. Forums can also be made from NucleusCMS.
ftruscot
Nucleus Guru
Nucleus Guru
Posts: 7430
Joined: Wed Feb 22, 2006 6:19 pm
Location: Massachusetts
Contact:

Postby ftruscot » Mon Nov 13, 2006 2:38 am

Matt_t_hat, I've put this together for a fairly static site that really only acts blog-like for the News category (and maybe a Blog category in the future), but I want all those static pages managed, and editable through Nucleus (right now it is kluged together and this plugin will make it more manageable for me). So I fully see the use of this for static pages, but I hadn't thought about this facilitating forums. Could you explain to me how this plugin helps with that? I just can't quite wrap my head around it yet.
Bender
Posts: 22
Joined: Wed Nov 01, 2006 10:49 pm
Location: France
Contact:

Postby Bender » Sun Nov 19, 2006 3:13 am

Thank you ftruscot to this plug :)
Image
ftruscot
Nucleus Guru
Nucleus Guru
Posts: 7430
Joined: Wed Feb 22, 2006 6:19 pm
Location: Massachusetts
Contact:

Postby ftruscot » Sun Nov 19, 2006 5:16 am

Glad it is of use to you, Bender.

I'm finally in the middle of doing the site rework that I made the plugin for and have found some other fixes and additions to NP_Ordered. I will be releasing this new version sometime within the coming week, once I have it set and tested. So far the next version will include the following improvements:

* added <%catiscurrent%> as template var in Category List fields. (Useful for putting a class param in the links for categories that can be different if listing the current cat.)
* Added templatemode to override special category template if wanted.
* Added setnavigation form of skinvar to set next and prev item for item pages. Put in head section, above any call to nextlink or prevlink
* Fixed how handle offset in blog form of skinvar.
* Add API function getQueryResult() so other plugins can get the mysql result for their own purposes (I use it to make a plugin that makes my dropdown menu with the ordered categories across the top and the ordered items of each category dropping down beneath the category when hovered)

I'm open to additional suggestions, etc... that you find from your usage.
ftruscot
Nucleus Guru
Nucleus Guru
Posts: 7430
Joined: Wed Feb 22, 2006 6:19 pm
Location: Massachusetts
Contact:

Postby ftruscot » Wed Nov 22, 2006 5:39 am

OK. Version 1.1 is released. Download. It adds the features/fixes listed in the post above this one. I have also implemented it on the intended site. See it here.

All categories are ordered. The items are ordered in all categories except for the news category (which is treated like a normal blog).

Only the items in the Home category are permitted on the main page.

The boxes on the bottom of the home page showing the two most recent News items are done using the regular <%blog(...)%> skinvar.

The menu at the top is generated by a private plugin that uses the getQueryResult() function of NP_Ordered to get the ordered categories and ordered items and output them as required for the css dropdown menu.

On category pages, the list of items in the sidebar is done with NP_Ordered using a template that just gives links to titles.

Since I use the catid for setting the navigation, I want it set on all item pages (without having to carry it in the url), so in the head section of my skin, I have this code (if skintype='item'):

Code: Select all

<%Ordered(setnavigation,ordered,7,yes)%>
Which also sets the nextlink and prevlink according to the ordered set. The yes says to force the catid to be set according to the category of the item being displayed.
ftruscot
Nucleus Guru
Nucleus Guru
Posts: 7430
Joined: Wed Feb 22, 2006 6:19 pm
Location: Massachusetts
Contact:

Postby ftruscot » Sat Dec 02, 2006 8:09 am

Released v1.2. Download at http://www.iai.com/NP_Ordered.zip.

Adds a replacement for the <%item(templatename)%> skin variable. It will display the item using the template specified, unless a different one is specified for this category in the Ordered plugin admin page.

Requires an uninstall of previous versions before installing this new version. See wiki for details: http://wiki.nucleuscms.org/ordered
japser
Posts: 16
Joined: Tue Jun 14, 2005 3:44 pm

Postby japser » Sat Dec 30, 2006 2:36 pm

Any idea how to get this one working with NP_MultipleCategories (v 0.403j.)?
ftruscot
Nucleus Guru
Nucleus Guru
Posts: 7430
Joined: Wed Feb 22, 2006 6:19 pm
Location: Massachusetts
Contact:

Postby ftruscot » Sat Dec 30, 2006 4:54 pm

That would take some coding. I've never used the NP_MultipleCategories plugin, so it didn't really come up as a requirement when I wrote this. I've been meaning to educate myself on that plugin, so maybe I will look into over the next month, but no promises of inclusion into this.

I'd welcome any other coders who would like to look at making this MultipleCategory-ready.
japser
Posts: 16
Joined: Tue Jun 14, 2005 3:44 pm

Postby japser » Sat Dec 30, 2006 7:39 pm

Ive noticed the (as far as I know latest version) of multiple categories plugin is difficult to find, so Ive uploaded it to this adress:

https://ssl.direkte-aktie.net/nucleusplugindownload/NP_MultipleCategories_0403.zip.

Theres one bug Ive noticed in this plugin, described it earlier on
http://nucleuscms.org/forum/viewtopic.php?t=13196
ftruscot
Nucleus Guru
Nucleus Guru
Posts: 7430
Joined: Wed Feb 22, 2006 6:19 pm
Location: Massachusetts
Contact:

Postby ftruscot » Sat Dec 30, 2006 8:30 pm

Thanks, I've downloaded it and will take a look at it as time permits.
User avatar
Monkeybrain
Posts: 525
Joined: Thu Dec 15, 2005 1:30 pm
Location: Kristiansand, Norway
Contact:

Postby Monkeybrain » Sun Dec 31, 2006 2:12 am

You'r a true gem ftruscot :D

You just made my nucleus-life a lot easier! Thank You!
Is your question not solved yet?
Search our FAQ,
read the Documentation, or
browse the list of available plugins.
ftruscot
Nucleus Guru
Nucleus Guru
Posts: 7430
Joined: Wed Feb 22, 2006 6:19 pm
Location: Massachusetts
Contact:

Postby ftruscot » Sun Dec 31, 2006 2:30 am

Glad you find this useful, Monkeybrain. Just curious, what function/feature of this plugin are you interested in?
User avatar
Monkeybrain
Posts: 525
Joined: Thu Dec 15, 2005 1:30 pm
Location: Kristiansand, Norway
Contact:

Postby Monkeybrain » Sun Dec 31, 2006 3:30 pm

Well, ceveral of the features actualy.

First the possibility to assign a sorting order to the articles and categories,
and especialy the feature to simply maintain static pages!

I'm fidling with it right now, implementing it on one of my new designs.. :D
Is your question not solved yet?

Search our FAQ,

read the Documentation, or

browse the list of available plugins.
ftruscot
Nucleus Guru
Nucleus Guru
Posts: 7430
Joined: Wed Feb 22, 2006 6:19 pm
Location: Massachusetts
Contact:

Postby ftruscot » Mon Jan 01, 2007 3:53 am

Great, I'd love to see how that site ends up.
shunter
Posts: 2
Joined: Mon Jan 29, 2007 5:04 pm

Postby shunter » Mon Jan 29, 2007 5:22 pm

Hi ftruscot,
This plugin is exactly what I'm looking for and is really going to make my life simpler.

The only thing is I'm having trouble with managing the items and categories from my blog. After installing I went to the Ordered Admin. From the drop down menu labelled "Select a Blog" I chose my blog(there's only one on this site) and clicked "Go." However, all it does is take me to the site's Admin homepage.
I'm fairly new to Nucleus but I have installed many plugins successfully. I'm at a loss. It's probably some simple thing I've done wrong but I was wondering if you had any wisdom on what my problem might be?

Thanks
ftruscot
Nucleus Guru
Nucleus Guru
Posts: 7430
Joined: Wed Feb 22, 2006 6:19 pm
Location: Massachusetts
Contact:

Postby ftruscot » Mon Jan 29, 2007 5:28 pm

So, to be sure, You go to the Admin page for the NP_Ordered plugin, select your blog, Click Go, and you are taken to the main Nucleus Admin Home page instead of the NP_Ordered admin page with the correct blog's data? That is odd. Let me review the code and get back to you with some suggestions.
ftruscot
Nucleus Guru
Nucleus Guru
Posts: 7430
Joined: Wed Feb 22, 2006 6:19 pm
Location: Massachusetts
Contact:

Postby ftruscot » Mon Jan 29, 2007 5:42 pm

shunter, looking at the code, I can't think of why this would happen, could you send me a screenshot of what the page looks like after you click go, also the html source of the page (get from you browser) before and after you click Go. These will give me some clues. You can post these here, or email me at my forum username at gmail. com. Thanks.

Return to “Plugin Development”