Author Topic: show categories / Kategorien anzeigen  (Read 7373 times)

0 Members and 1 Guest are viewing this topic.

Offline osnapicture

  • Full Member
  • ***
  • Posts: 152
    • View Profile
show categories / Kategorien anzeigen
« on: May 16, 2010, 05:32:56 PM »
if I try to show my categories with {categories} on mh home.html it works fine. but if I try it with {categories} at an other page than the home.html it doesn't work. anyone an idea why?

________________

Ich würde gerne eine seperate Seite erstellen und dort meine Kategorien anzeigen lassen. Mittels {categories} Befehl klappt das aber nur auf der home.html und nicht auf anderen Seiten im Template-Ordner. Irgendwer eine Idee warum das so ist und wie ich das beheben kann?

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: show categories / Kategorien anzeigen
« Reply #1 on: May 16, 2010, 08:21:32 PM »
Because to save on server's resources 4images does not generate {categories} on each page, only on pages it was initially designed for.
What pages do you want show it on?
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)

Rembrandt

  • Guest
Re: show categories / Kategorien anzeigen
« Reply #2 on: May 16, 2010, 08:51:32 PM »
...
Ich würde gerne eine seperate Seite erstellen und dort meine Kategorien anzeigen lassen. Mittels {categories} Befehl klappt das aber nur auf der home.html und nicht auf anderen Seiten....
suche in der page_header.php

//-----------------------------------------------------
//--- Category Dropdown -------------------------------
//-----------------------------------------------------



füge darüber ein:

//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
$categories get_categories(0);
if (!
$categories)  {
  
$categories $lang['no_categories'];
}
$site_template->register_vars("categories2"$categories);
unset(
$categories);


mittels {categories2} kannst du dir jetzt die kategorien anzeigen lassen..

mfg Andi

Offline CodeMan

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • ArabGlobe.com
Re: show categories / Kategorien anzeigen
« Reply #3 on: April 15, 2013, 08:48:28 PM »
Rembrandt,

thanks for this great tip!

I found that it also works with the origanal code:


//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
$categories get_categories(0);
if (!
$categories)  {
  
$categories $lang['no_categories'];
}
$site_template->register_vars("categories"$categories);
unset(
$categories);


When the original code is placed as Rembrandt mentioned, you can also use the original {categories} on every page you wish to show categories.

I'm using 4Images 1.7.11