4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: 0711concept on October 12, 2002, 03:03:23 PM

Title: [Mod] Verschiedene thumbnail_bit Templates
Post by: 0711concept on October 12, 2002, 03:03:23 PM
Wie man verschiedene Templates für Kategorien verwendet hat Jan schon bestens in seinem Mod beschrieben :D :
http://www.4homepages.de/forum/viewtopic.php?t=1847 (http://www.4homepages.de/forum/viewtopic.php?t=1847)
Mir war es wichtig die thumbnail_bit Datei in verschiedenen Kategorien anders darzustellen und habe das Mod erweitert: :wink:

This mod allows you to use different thumbnail templates. Templates will be inherited on subcategories.
----
Diese Modifikation erlaubt es, verschiedene Thumbnail-Templates für Kategorien zu verwenden. Dabei wird ein Template auf seine Unterkategorien vererbt.

Installation:

1. Open "includes/functions.php" and add after:
Code:
Code: [Select]
if (!defined('ROOT_PATH')) {
  die("Security violation");
}
this code:
Code:
Code: [Select]
function get_cat_template($tpl_name, $cat_id = 0) {
  global $cat_cache;
  if (!$cat_id) {
    $new_tpl_name = $tpl_name;
  }
  elseif (file_exists(TEMPLATE_PATH."/".$tpl_name."_".$cat_id.".html")) {
    $new_tpl_name = $tpl_name."_".$cat_id;
  }
  else {
    $new_tpl_name = get_cat_template($tpl_name, $cat_cache[$cat_id]['cat_parent_id']);
  }
  return $new_tpl_name;
}

2. Search in  "categories.php" :
Code: [Select]
$main_template = 'categories';
and insert below:
Code: [Select]
$thumb_art= 'thumbnail_bit';

3. Open "categories.php" and replace:
Code: [Select]
$thumbnails .= $site_template->parse_template("thumbnail_bit");
with this code:
Code:
Code: [Select]
$thumbnails_neu= get_cat_template($thumb_art, $cat_id);
$thumbnails .= $site_template->parse_template($thumbnails_neu);


4. Create a new thumbnail-template for a specific category (you may duplicate "thumbnail_bit" and modify it) and save it under this name:
Code:
Code: [Select]
thumbnail_bit_<cat_id>.html
Replace <cat_id> with id of the category.
This category and all subcategories will now use this template.

Hoffe ich habe nichts vergessen. Bitte um kurzes Feetback.

By the way: wirklich gutes script.

0711concept
Title: [Mod] Verschiedene thumbnail_bit Templates
Post by: k4nth on February 05, 2003, 05:34:45 AM
Template Error: Couldn't open Template ./templates/default/thumbnail_bit_8.html

2. Open "categories.php" and change on top:
Code:
$templates_used = 'categories,category_bit,thumbnail_bit,thumbnail_bit_8,home,whos_online';
$main_template = 'categories';
$thumb_art= 'thumbnail_bit';

change to

$templates_used = 'categories,category_bit,thumbnail_bit,home,whos_online';
$main_template = 'categories';
$thumb_art= 'thumbnail_bit';

when i remove the 'thumbnail_bit_8' it works properly. will it affect anything?
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: ruudvroon on April 05, 2005, 03:01:25 PM
Is it also possible to show only one tumbnail on a row?
And make more rows per page.

I know I can change that in the admin panel, but I want it only for a few cats
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: graficalicus on May 05, 2005, 05:15:12 PM
this works well - but I have a question -

I'd like to use this MOD on thumbnails wherever they appear in the site for certain categories - in random images, new images, top images, etc. - sort of like:

Code: [Select]
if this image is in this category or any sub-category, use this thumbnail_bit template;
if this image is in any other category, use the regular template

Basically, I'm trying to hide uploader's username for certain cats - - -

thanks in advance... :?
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: V@no on July 02, 2005, 04:45:56 PM
seems like u've installed another mod (the one that mentioned on top of this mod description) that also has get_cat_template function
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: Marion on September 23, 2005, 11:39:12 AM
Hallo :)

Gibt es eine Möglichkeit den Mod von Jan für die unterschiedlichen Kategorie-Templates mit den unterschiedlichen Thumbnail_bits zu kombinieren ?

Is there any possibilty to combine Jan's categorie templates mod with this thumbnail_bits mod ?

As soon as I insert respectively change this code
Sobald ich
Quote
with this code:

Code:
$thumbnails_neu= get_cat_template($thumb_art, $cat_id);
$thumbnails .= $site_template->parse_template("$thumbnails_neu");

to categories.php
in die categories.php einfüge bzw. den vorhandenen Code

Quote
$thumbnails .= $site_template->parse_template("thumbnail_bit");

ersetze, funktioniert die Zuweisung von unterschiedlichen Kategorie-Templates nicht mehr und alle Kategorien sehen wieder gleich aus   :?
Benutze 4images 1.7.1

all changes in categories.html's are gone and they look equal again.

Marion
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: Michael on November 04, 2005, 10:30:06 PM
Hallo,

ein super Mod aber wieso wird die veränderte thumbnail_bit nicht auch bei den neuen Bildern angezeigt,
dort wird immer noch die alte thumbnail_bit angezeigt, in der entsprechenden Kategorie wird es allerdings richtig angezeigt!

Gruß, Michael
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: Michael on November 07, 2005, 08:03:26 PM
hat keiner eine Antwort da drauf  :?:
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: Acidgod on November 07, 2005, 09:19:16 PM
Ich denke das dieser Mod nur für die Kategorien ist und nicht für die Startseite... (o:

Wenn Du das ändern willst dann ändere doch gleich die orginal thumbnail_bit...
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: Michael on November 07, 2005, 10:32:45 PM
Ich denke das dieser Mod nur für die Kategorien ist und nicht für die Startseite... (o:

Wenn Du das ändern willst dann ändere doch gleich die orginal thumbnail_bit...

Dann gilt das ja für alle Kategorien, ich möchte aber nur bestimmte Kategorien so eingestellt haben.
Sinn macht das ganze zum Beispiel bei einem Wettbewerb.

Gruß, Michael
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: Acidgod on November 07, 2005, 10:34:31 PM
Ich weiss ehrlich gesagt nicht 100% was dieser Mod macht, kann ich mir das mal bei Dir anschauen?
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: Michael on November 07, 2005, 10:53:50 PM
Den Mod habe ich eingebaut aber noch nicht aktiviert da es mit der Thumb_bit noch nicht hinhaut.

Das ganze arbeitet wie folgt:

Man erstellt eine oder auch mehrere zusätzliche details_(cat_id).html und thumbnail_bit_(cat_id).html.
Beim Aufruf eines Bildes wird dann bei mir weder ein Username noch eine Bewertung sowie Exif angezeigt, eben nur das was man braucht.
Das Thumbnail in der Kategorie wird dann genauso wenig anzeigen, Problem ist aber das auf der Hauptseite immer noch "alles" angezeigt wird.

Gruß, Michael
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: Chicco on January 23, 2006, 11:54:04 AM
HI. Genau das gleiche Problem habe ich nu auch bei der Startseite. Hat dies nun jemand hinbekommen bzw. weiss wie man es auch auf der Startseite machen kann?
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: atornaya on May 19, 2006, 12:37:26 PM
Wie man verschiedene Templates für (member_uploadform.html )
machen kann :?:
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: impss on June 05, 2007, 09:51:27 PM
How would you go about changing the thumbnail_bit for the new images on the home page?

I assume what i have to change is this in the index.php

Code: [Select]
$new_images .= $site_template->parse_template("thumbnail_bit");
but everything i have tried so far hasnt worked.

thanks for the help
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: mawenzi on June 05, 2007, 11:20:43 PM
@impss,

- make a new thumbnail_bit for you new images ... !
- make a copy of your thumbnail_bit.html, edit this thumbnail_bit.html for your needs and save it as thumbnail_bit_new.html
- now you can change in the index.php
Code: [Select]
$new_images .= $site_template->parse_template("thumbnail_bit");
to
Code: [Select]
$new_images .= $site_template->parse_template("thumbnail_bit_new");


 
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: impss on June 05, 2007, 11:24:49 PM
sorry mawenzi

maybe i didnt explain in correctly.

I need it to change the thumbnail_bit for the new images specifically for a certain category.

I have thumbnail_bit_10.html working in the categories and search page. but i cant figure out how to make it select for the new images and random image.
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: mawenzi on June 05, 2007, 11:39:13 PM
... mmm ...  :?
... I don't understand ... maybe this ... ?
... if a image from category 10 is shown as new image in the index.php ...
... this image must be shown in thumbnail_bit_10.html ... ?
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: impss on June 06, 2007, 12:08:10 AM
yes.. a new image from category 10 will used the thumbnail_bit_10.html. while the rest of the new images will use the regular thumbnail_bit.html template

thats what im looking for.
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: mawenzi on June 06, 2007, 12:16:44 AM
... then try this ...
... change in the index.php ...
Code: [Select]
$new_images .= $site_template->parse_template("thumbnail_bit");
to
Code: [Select]
if ($image_row['cat_id'] == 10) {
$new_images .= $site_template->parse_template("thumbnail_bit_10");
} else {
$new_images .= $site_template->parse_template("thumbnail_bit");
}

Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: impss on June 06, 2007, 12:26:08 AM
so theres no way for it to automatically detect the use of a custom template like it does for catogories?

cause i was thinking in the future i may use custom thumbnail_bits for other categories to.

*edit* what u posted works for just that template like it should.. but if i have multiple custom thumbnail bit i dont know what to do..

sorry if im being a pain.
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: mawenzi on June 06, 2007, 12:53:27 AM
... then try this ...
... change in the index.php ...
Code: [Select]
$new_images .= $site_template->parse_template("thumbnail_bit");
to
Code: [Select]
if (file_exists(TEMPLATE_PATH."/thumbnail_bit_".$image_row['cat_id'].".html")) {
    $thumbnail_bit_cat = "thumbnail_bit_".$image_row['cat_id'];
    $new_images .= $site_template->parse_template("$thumbnail_bit_cat");
} else {
    $new_images .= $site_template->parse_template("thumbnail_bit");
}
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: impss on June 06, 2007, 01:04:58 AM
Parse error: syntax error, unexpected '"' in /home/fbiss/public_html/gallerytest/index.php on line 263

my line 263 is

Code: [Select]
$thumbnail_bit_cat = thumbnail_bit_".$cat_id.";
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: mawenzi on June 06, 2007, 01:31:42 AM
... oh sorry ... I've udated my post above ... ;)
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: impss on June 06, 2007, 01:42:55 AM
hmmm.. now it just shows the regular template

I hope u know, im so lost.

lol

but i really appreciate the help trying to get this working
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: mawenzi on June 06, 2007, 03:26:37 PM
... I've udated my post above ... now tested ...  ;)
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: impss on June 06, 2007, 03:31:52 PM

Awesome!!!!!!!!!! it works  8)


Thanks a ton mawenzi
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: luener on November 04, 2009, 08:44:19 PM
... then try this ...
... change in the index.php ...
Code: [Select]
$new_images .= $site_template->parse_template("thumbnail_bit");
to
Code: [Select]
if (file_exists(TEMPLATE_PATH."/thumbnail_bit_".$image_row['cat_id'].".html")) {
    $thumbnail_bit_cat = "thumbnail_bit_".$image_row['cat_id'];
    $new_images .= $site_template->parse_template("$thumbnail_bit_cat");
} else {
    $new_images .= $site_template->parse_template("thumbnail_bit");
}

I´m using 1.7.7.

The new thumbnail_bit_<cat_id>.html works only in the Cat, but not on the Index-Page...!!!

You can see it at www.topfoto24.com in the Cat: Wettbewerbe

Can someone help me please???


Ralf
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: mawenzi on November 04, 2009, 08:55:30 PM
... folgendes mal ändern ...
Code: [Select]
$new_images .= $site_template->parse_template("$thumbnail_bit_cat");
... in ...
Code: [Select]
$new_images .= $site_template->parse_template("thumbnail_bit_cat");
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: luener on November 05, 2009, 01:18:34 AM
sorry, auch nix...!

gruß
ralf
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: MrAndrew on February 22, 2011, 06:14:49 PM
Ok. A little problem... I have this parameters for show thumnails in my categories.php

  $thumbnails = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">\n";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $thumbnails .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $thumbnails .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($image_row);
    $thumbnails_neu = get_cat_template($thumb_art, $cat_id);
    $thumbnails .= $site_template->parse_template("$thumbnails_neu");
    $thumbnails .= "\n</td>\n";

    $count++;
    if ($count == $config['image_cells']) {
      $thumbnails .= "</tr>\n";
      $count = 0;
    }
  } // end while


  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover > 0) {
      for ($i = 0; $i < $leftover; $i++){
        $thumbnails .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $thumbnails .= "</tr>\n";
    }
  }
  $thumbnails .= "</table>\n";

See this part:

if ($count == $config['image_cells']) {

In my config in ACP this parameter set is 1...

For new template i need to change this part to 3, but if i will do this it will give affect on all categories templates.... Please, any ideas?

Many thanks

Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: khansahib on September 11, 2011, 07:35:52 PM
MrAndrew are u looking for this???
Code: [Select]
http://www.4homepages.de/forum/index.php?topic=28703
Title: Re: [Mod] Verschiedene thumbnail_bit Templates
Post by: MrAndrew on September 11, 2011, 07:41:43 PM
Many thanks! But i`ve resolved this problem...