Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Addons

Post Reply
 
Thread Tools
  #1  
Old 07-15-2006, 07:58 PM
aliyevramin Offline
forum loafer
 
Join Date: Jul 2006
Posts: 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?
Reply With Quote
  #2  
Old 07-15-2006, 10:55 PM
GeoS's Avatar
GeoS+ Offline
Team Pixelpost
 
Join Date: Apr 2005
Location: Warsaw, Poland
Posts: 3,613
Send a message via ICQ to GeoS Send a message via Skype™ to GeoS
Change the SQL statement which generates order you dont like to one you like.
__________________
photoblog | portfolio | addons | Donate
Reply With Quote
  #3  
Old 07-16-2006, 06:37 AM
derevaun Offline
pp regular
 
Join Date: Mar 2005
Location: oly, wa
Posts: 47
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&amp;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
Reply With Quote
  #4  
Old 07-16-2006, 12:26 PM
GeoS's Avatar
GeoS+ Offline
Team Pixelpost
 
Join Date: Apr 2005
Location: Warsaw, Poland
Posts: 3,613
Send a message via ICQ to GeoS Send a message via Skype™ to GeoS
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 .
__________________
photoblog | portfolio | addons | Donate
Reply With Quote
  #5  
Old 07-09-2007, 03:05 PM
PPersson Offline
forum loafer
 
Join Date: Nov 2006
Posts: 11
Quote:
Originally Posted by GeoS View Post
Change the SQL statement which generates order you dont like to one you like.
@ Geos: What does this mean?

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
Reply With Quote
  #6  
Old 07-12-2007, 10:37 PM
GeoS's Avatar
GeoS+ Offline
Team Pixelpost
 
Join Date: Apr 2005
Location: Warsaw, Poland
Posts: 3,613
Send a message via ICQ to GeoS Send a message via Skype™ to GeoS
There is no subcategories - you must hack the Pixelpost to support it.
__________________
photoblog | portfolio | addons | Donate
Reply With Quote
  #7  
Old 07-25-2007, 03:04 PM
tamitakesphotos Offline
forum loafer
 
Join Date: Jul 2007
Posts: 1
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
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 07:41 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs