|
#1
|
|||
|
|||
|
Category List
I there any way to list the categories in custom order? Currently, <CATEGORY_LINKS_AS_LIST> tag allows you to list the categories alphabetically, but I need them listed in the order I want them to.
Any adon for this? |
|
#3
|
|||
|
|||
|
I hacked out an addon that does a few esoteric things toward making my blog more semantic, etc. One was ordering the categories by the order added (thus, their ID order in the database). Below is the pertinent code from the addon. It's the end of the second line that does it. If you copy and paste the whole snippet into an addon, it'll mark up your categories as an unordered list, which is appropriate enough and can be presented horizontally with css. If you need help with that, you may get kind responses in the Design & Code section.
Or, you could find the place in index.php where it happens and just change it there. But that would only be good until the next version, hence addons: it may not seem like it but you did ask in the right place ![]() Adding an arbitrary order, as in WordPress, would probably require adding a bit to the database structure, which might per slight chance cause trouble on updating to the next version. I just took care to leave a few empty categories to ensure that the first kind (e.g. cameras) come first and the last kind (e.g. film) come last. Code:
$image_category_all = "<ul>\n";
$querystr = "select t1.cat_id,t2.name from ".$pixelpost_db_prefix."catassoc as t1 inner join ".$pixelpost_db_prefix."categories t2 on t1.cat_id = t2.id where t1.image_id = '$image_id' order by t2.id ";
$query = mysql_query($querystr);
$image_category_number = 0;
while(list($cat_id,$name) = mysql_fetch_row($query)) {
$name = pullout($name);
$image_category_all .= "<li><a href='$PHP_SELF?x=browse&category=$cat_id'>$name</a></li>";
$image_category_number = $image_category_number +1;
}
$image_category_all .= "\n</ul>\n";
$tpl = str_replace("<MY_IMAGE_CATEGORY>",$image_category_all,$tpl);
__________________
http://asiftosay.com |
|
#4
|
||||
|
||||
|
For support in future version we suggest to write addons which are almost PP version independend.
Thanks to it you are not limited by core functions and you get what you want . |
|
#5
|
|||
|
|||
|
Quote:
I, too, would like to change the order in my category list. Can I get this and how would i do it (in the drop down menu)? ---------- Category #1 Subcategory #1 Subcategory #2 Subcategory #3 ---------- Category #2 Subcategory #1 Subcategory #2 Subcategory #3 etc. (In this list the "Category #1" is a non-clickable word and "---------" is also a non-clickable divider.) Thanks for your help /Pär |
|
#7
|
|||
|
|||
|
can anyone combine these 2 addons
Can anyone here take Derevaun's code above that puts the categories in ID# order with the Categories as List Add-on? I need Derevaun's code to put the categories in the order I specify (rather than alphabetic), but it only shows the categories for the image that is displayed, rather than all the categories, which is what I need. I tried to decipher the code myself, but I'm no programmer, and I couldn't figure out how to do it. It'll probably be something simple for those of you that do know how to write php. Thanks.
Tami |
| Post Reply |
| Thread Tools | |
|
|