Author Topic: Template für Categories  (Read 5115 times)

0 Members and 1 Guest are viewing this topic.

Offline honda2000

  • 4images Guru
  • *******
  • Posts: 3.263
    • View Profile
    • Wir machen Internet!
Template für Categories
« on: May 22, 2008, 06:03:00 PM »
Hallo, ja, ich weis, die Kategorien werden in category_bit.html angezeigt und erzeugt.
Wo aber werden die Subkategorien erzeugt,

und
 wenn ich eine Hauptkategorie anlegen, erscheint diese über:
category_bit.html mit:

Quote
<table border="0" cellspacing="0" cellpadding="0" class="row1">
  <tr>
    <td valign="top">
     <img src="{template_url}/images/folder.gif" width="18" height="9" alt="" />
      <!-- {if random_cat_image_file}<a href="{cat_url}"><img src="{random_cat_image_file}" border="1"></a>{endif random_cat_image_file}  -->
    </td>
    <td>
     <a href="{cat_url}" class="row1">{cat_name}</a>&nbsp;({num_images})
      {if cat_is_new}<sup class="new">{lang_new}</sup>{endif cat_is_new}
   </td>
  </tr>
</table>

aufgerufen

allerdings baut sich laut Quelltext noch eine:

Quote
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" width="100%" class="catbgcolor">
<table border="0" cellpadding="3" cellspacing="1">
<tr>
<td valign="top">
<table border="0" cellspacing="0" cellpadding="0" class="row1">
  <tr>
    <td valign="top">
     <img src="./templates/default/images/folder.gif" width="18" height="9" alt="" />
      <!--   -->
    </td>
    <td>
     <a href="./categories.php?cat_id=xyz" class="row1">123</a>&nbsp;(1)
      <sup class="new">neu</sup>   </td>
  </tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table border="0" cellspacing="0" cellpadding="0" class="row1">
  <tr>
    <td valign="top">
     <img src="./templates/default/images/folder.gif" width="18" height="9" alt="" />
      <!--   -->
    </td>
    <td>
     <a href="./categories.php?cat_id=XYZ" class="row1">123</a>&nbsp;(0)
         </td>
  </tr>
</table>
<br><a href="./categories.php?cat_id=xxx" class="subcat">XYZ</a>, <a href="./categories.php?cat_id=x" class="subcat">123</a>, <a href="./categories.php?cat_id=x" class="subcat">ABC</a>, <a href="./categories.php?cat_id=x" class="subcat">123</a>, <a href="./categories.php?cat_id=x" class="subcat">XYZ</a>, <a href="./categories.php?cat_id=x" class="subcat">123</a><br></td>
</tr>
</table>
</td>
</tr>
</table>
u.s.w.

drum herum, die muss ja irgendwo erzeugt werden.

ich möchte dort die Hintergrundfarbe ändern, und ich möchte, das vor jeder Subkategorie ein folder2.gif erscheint und alle Subkategorien untereinander und nicht wie Platz ist, nebeneinander!

@mawenzi, ich hab wieder gesucht, ohne Erfolg  :wink: :lol:

hat jemand einen Tipp/Rat oder gar gleich die Lösung bei der Hand???

EDIT:
mir ist noch was eingefallen:
ich nutze nicht die Anzeige der Kategorien/Subkategorien in der home.html
sondern ich habe die Anzeige ausgelagert mit:

Quote
$site_template->register_vars(array(
  "categories_all" => get_categories(0)
 ));

in page_header.php vor:
Quote
?>

und lasse die Kategorien in allen Haupttemplates in der linke Spalte mit:
Quote
{categories_all}
anzeigen

hier die Testseite: www.cre-arts.net/testgalerie/

es geht also um die Kategorien/Subkategorien links

« Last Edit: May 22, 2008, 06:30:11 PM by honda2000 »

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: Template für Categories
« Reply #1 on: May 22, 2008, 06:32:01 PM »
Hi honda,

hoffe das ist was du suchst...
includes/functions.php

Code: [Select]
function get_subcategories($parent_id) {
  global $cat_parent_cache, $cat_cache, $site_sess, $config;

  if (!isset($cat_parent_cache[$parent_id]) || $config['num_subcats'] < 1) {
    return "";
  }

  $visible_cat_cache = array();
  foreach ($cat_parent_cache[$parent_id] as $key => $val) {
    if (check_permission("auth_viewcat", $val)) {
      $visible_cat_cache[$key] = $val;
    }
  }

  $num_subs = sizeof($visible_cat_cache);
  $sub_cat_list = "";
  $i = 1;
  foreach ($visible_cat_cache as $subcat_id) {
    if ($i <= $num_subs && $i <= $config['num_subcats']) {
      $sub_url = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$subcat_id);
      $sub_cat_list .= "<a href=\"".$sub_url."\" class=\"subcat\">".format_text($cat_cache[$subcat_id]['cat_name'], 2)."</a>";
      if ($i != $config['num_subcats'] && $i < $config['num_subcats'] && $i < $num_subs) {
        $sub_cat_list .= ", ";
      }
      if ($i == $config['num_subcats'] && $i < $num_subs) {
        $sub_cat_list .= " ...\n";
      }
    }
    $i++;
  }
  return $sub_cat_list;
}
cheers
Nicky
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 ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline honda2000

  • 4images Guru
  • *******
  • Posts: 3.263
    • View Profile
    • Wir machen Internet!
Re: Template für Categories
« Reply #2 on: May 22, 2008, 06:52:23 PM »
hm, bin mir nicht sicher, ja, dort werden die Sub-kats aufgebaut, aber was fehlt, ist die Tabelle außen herum

Quote
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" width="100%" class="catbgcolor">
<table border="0" cellpadding="3" cellspacing="1">
<tr>
<td valign="top">
<table border="0" cellspacing="0" cellpadding="0" class="row1">
  <tr>
    <td valign="top">
...
...
...


</td>
  </tr>
</table>
<br><a href="./categories.php?cat_id=xxx" class="subcat">XYZ</a>, <a href="./categories.php?cat_id=x" class="subcat">123</a>, <a href="./categories.php?cat_id=x" class="subcat">ABC</a>, <a href="./categories.php?cat_id=x" class="subcat">123</a>, <a href="./categories.php?cat_id=x" class="subcat">XYZ</a>, <a href="./categories.php?cat_id=x" class="subcat">123</a><br></td>
</tr>
</table>
</td>
</tr>
</table>

weil wie gesagt: ich möchte die Hintergrundfarbe ändern, und vor jeder Sup-Kat einen folder2.gif, und alle Sup-kats untereinander



das:

Quote
><a href="./categories.php?cat_id=xxx" class="subcat">XYZ</a>, <a href="./categories.php?cat_id=x" class="subcat">123</a>, <a href="./categories.php?cat_id=x" class="subcat">ABC</a>, <a href="./categories.php?cat_id=x" class="subcat">123</a>, <a href="./categories.php?cat_id=x" class="subcat">XYZ</a>, <a href="./categories.php?cat_id=x" class="subcat">123</a><br>

scheint ja aus der includes/functions.php zu stammen:

Quote
$sub_url = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$subcat_id);
      $sub_cat_list .= "<a href=\"".$sub_url."\" class=\"subcat\">".format_text($cat_cache[$subcat_id]['cat_name'], 2)."</a>";
      if ($i != $config['num_subcats'] && $i < $config['num_subcats'] && $i < $num_subs) {
        $sub_cat_list .= ", ";
      }
      if ($i == $config['num_subcats'] && $i < $num_subs) {
        $sub_cat_list .= " ...\n";
      }

da muss es noch mehr geben  :wink: :roll:


Offline honda2000

  • 4images Guru
  • *******
  • Posts: 3.263
    • View Profile
    • Wir machen Internet!
Re: Template für Categories
« Reply #3 on: May 22, 2008, 08:32:26 PM »
@Nicky, kann es sein, das es mit dem ControlPanel

Allgemein > Einstellungen > Kategorie Einstellungen
Wieviele Zellen soll die Tabelle der Kategorien haben
 
Wie breit soll die Tabelle der Kategorien sein
Prozentangaben erlaubt
 
Cellspacing der Kategorie Tabelle
 
Cellpadding der Kategorie Tabelle
 
Wieviele Subkategorien sollen unter der Hauptkategorie dargestellt werden

Kann es sein, das es damit zusammenhängt, das von da aus noch eine Tabelle um die Kategorien und deren Supkategorien erzeugt wird??

sieht so aus, nur wie ändere ich dort den Hintergrund (Farbe) ??
 

Offline † manurom

  • Full Member
  • ***
  • Posts: 227
    • View Profile
    • manurom's 4images templates
Re: Template für Categories
« Reply #4 on: May 22, 2008, 09:40:54 PM »
Hello, honda 2000 nd Nicky;
I'd really like to discuss with you. But I am French. Posting in english is yet heavy for me. I was really a bad pupil at school, and do not remeber anything in german language. Fault is mine. Google translation, or anyother bot does not help me much.
If you can post here in english, most members could help you.

Hey, I don't blame you in any way. I just hope that anyone here could help you.

Best regards.

manurom

Offline honda2000

  • 4images Guru
  • *******
  • Posts: 3.263
    • View Profile
    • Wir machen Internet!
Re: Template für Categories
« Reply #5 on: May 22, 2008, 09:56:16 PM »
sorry for bad english
look at: http://www.cre-arts.net/testgalerie/
left side, categorys

categorys are  not in home.html, in all templates width:
Quote
$site_template->register_vars(array(
  "categories_all" => get_categories(0)
 ));

in page_header.php :
?>

and show with
{categories_all}

but: how can i create a background-color???

the table are created in ControlPanel
settings ???

i dont no??!!