Author Topic: Full category list on each page ???  (Read 10003 times)

0 Members and 1 Guest are viewing this topic.

Offline MRJEE

  • Newbie
  • *
  • Posts: 17
    • View Profile
Full category list on each page ???
« on: November 27, 2005, 06:03:44 PM »
Hello!

Help me please. I need to see the full list of categories on each page (not drop down form).


Offline MRJEE

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Full category list on each page ???
« Reply #1 on: November 28, 2005, 10:43:06 AM »
Dear users, help me. I can not understand what to do. How to make the full list of categories on all pages.
Помогите сделать полный список категорий на всех станицах сайта.


Flowers  [2 images]       full, macro...
Nature [5 images]         winter, summer...   

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Full category list on each page ???
« Reply #2 on: November 28, 2005, 12:16:40 PM »
hi MRJEE,

take this ...

Full category list on each page

open includes/page_header.php and add right before ?> :
Code: [Select]
//-----------------------------------------------------
//--- Full category list on each page ---
//-----------------------------------------------------
$full_category_list = "";
$sql = "SELECT cat_images, cat_name, cat_id, cat_description FROM ".CATEGORIES_TABLE." ORDER BY cat_id ASC";
$result = $site_db->query($sql);
$max_out = 15; //max letters for description, but whole words are shown !
$full_category_list .= '<table border="0" cellspacing="0" cellpadding="0">';
while ($row = $site_db->fetch_array($result)) {
$cat_description = format_text($row['cat_description'],1);
$cat_description_short = (strlen($cat_description)>$max_out) ? substr($cat_description,0,$max_out). substr(substr($cat_description,$max_out),0,strpos(substr($cat_description,$max_out)," "))." ..." : $cat_description;
$full_category_list .= '<tr><td><b><a href ="'.$site_sess->url(ROOT_PATH.'categories.php?cat_id='.$row['cat_id']).'">'.$row['cat_name'].'</a></b> [ '.$row['cat_images'].' images ]&nbsp;&nbsp;</td><td>'.$cat_description_short.'</td></tr>';
}
$full_category_list .= '</table>';
$site_template->register_vars("full_category_list", $full_category_list);
unset($full_category_list);
//-----------------------------------------------------

Now you can use for your category list in each main template :
Code: [Select]
{full_category_list}

thats all ...  :wink: ... I hope I could help
mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Full category list on each page ???
« Reply #3 on: November 28, 2005, 02:53:07 PM »
Dont forget we have all categories cached in $cat_cache array, basicaly no need query database again ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline koikonut

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
    • http://www.konradin.net
Re: Full category list on each page ???
« Reply #4 on: April 20, 2006, 05:51:17 AM »
Dont forget we have all categories cached in $cat_cache array, basicaly no need query database again ;)

Then, how would a category list look?

Is it possible to include a category-list from another page too? e.g. from www.domain.com/index.php a file called www.domain.com/gallery/cat_list.php or something like that?

Thx for helping! Bye Konradin

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: Full category list on each page ???
« Reply #5 on: April 21, 2006, 10:50:51 AM »
Wollte das eben mal testen um zu schauen wie es aussieht aber ich bekomme immer folgende Meldung

DB Error: Bad SQL Query: SELECT cat_images, cat_name, cat_id, cat_description FROM bildergalerie_categories ORDER BY cat_id ASC
Unknown column 'cat_images' in 'field list'

Habe auch nachgeschaut und ich habe gar kein cat_images Feld :(


*EDIT*

OK, habe einfach cat_images aus dem page_header Code entfernt und nun geht es. Aber ne Drop Down Liste ist mir dann doch lieber :) Ist doch alles ein wenig to big dann....
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-