4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: Benny Change on December 20, 2008, 01:40:41 PM

Title: [MOD]Eine zweite thumbnail_bit.html / A second thumbnail_bit.html
Post by: Benny Change on December 20, 2008, 01:40:41 PM
:flag-de:
Hallo,

ich möchte hier einmal erklären, wie man eine zweite thumbnail_bit.html erstellen, damit man diese auch in anderen Unterseiten unterschiedlich darstellen kann.

:flag-en:
   
Hello,

I would like to once explain how to create a second thumbnail_bit.html so that they can be in other sub-pages may vary.

Step 1

Open / Öffne:  index.php
Search / Suche:

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------

Add above / Füge darüber das ein:

//-----------------------------------------------------
//--- Show New Images 2 ---------------------------------
//-----------------------------------------------------

$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
  $imgtable_width .= "%";
}

$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", i.".$key;
  }
}

$num_new_images = $config['image_cells'];
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        ORDER BY i.image_date DESC
        LIMIT $num_new_images";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);

if (!$num_rows)  {
  $new_images2 = "";
  $new_images2 .= $lang['no_new_images'];
  $new_images2 .= "";
}
else  {
  $new_images2 = "";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images2 .= "";
    }
    $new_images2 .= "";

    show_image($image_row);
    $new_images2 .= $site_template->parse_template("thumbnail_bit2");
    $new_images2 .= "";
    $count++;
    if ($count == $config['image_cells']) {
      $new_images2 .= "";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $new_images2 .= "";
      }
      $new_images2 .= "";
    }
  }
  $new_images2 .= "";
} // end else

$site_template->register_vars("new_images2", $new_images2);
unset($new_images2);

Search / Suche:

$templates_used = 'home,category_bit,whos_online,thumbnail_bit';

Replace this with / ändere es in:

$templates_used = 'home,category_bit,whos_online,thumbnail_bit,thumbnail_bit2';


Step2
:flag-de:
Mache eine Kopie deiner thumbnail_bit.html und benenne diese in thumbnail_bit2.html um.
Du kannst nun deine thumbnail_bit2.html nach deinen Wünschen anpassen und abändern.
:flag-en:
Make a copy of your thumbnail_bit.html and rename it in order thumbnail_bit2.html.
You can now tag your thumbnail_bit2.html according to your wishes and adapt to change.

Step3
:flag-de:
Damit du die neue thumbnail_bit2.html auch verwenden kannst, kannst du nun dieses tag verwenden: {new_images2}
:flag-en:
Thus the new thumbnail_bit2.html you also can use, you can now use this tag: {new_images2}

Fertig / Finish

Danke / Thanks to: Mawenzi: http://www.4homepages.de/forum/index.php?topic=23512.msg128915#msg128915

:flag-de:
1. in der index.php eine Kopie des Abschnitts "Show New Images" machen (und deine sql-Optionen anpassen / ändern) ...
2. darin dann alle "new_images" in "new_images_2" umbenennen ...
2.1 und die "thumbnail_bit" in "thumbnail_bit_2" umbenennen ...
3. in der index.php unter "$templates_used" nun noch "thumbnail_bit_2" hinzufügen ...
4. eine Kopie deiner "thumbnail_bit.html" in deinem Teplate-Ordner machen diese "thumbnail_bit_2.html" benennen und editiern ...
5. in der home.html den Tag {new_images_2} verwenden ...
6. fertig

:flag-en:
1. index.php in a copy of the section "Show New Images" (and your sql-options / change) ...
2. Then it all "new_images" in new_images_2 rename ...
2.1 and the "thumbnail_bit" in thumbnail_bit_2 rename ...
3. in the index.php under "$ templates_used" now "thumbnail_bit_2 add ...
4. a copy of your "thumbnail_bit.html" in your folder Teplate make this "thumbnail_bit_2.html" rename and edit ...
5. home.html in the day) (new_images_2 use ...
6. ready
Title: Re: [MOD]Eine zweite thumbnail_bit.html / A second thumbnail_bit.html
Post by: ivan on December 20, 2008, 07:37:28 PM
Hallo Phisker,
dieser Teil wird für Dein Zweck nicht gebraucht


Code: [Select]
$site_template->register_vars(array(
  "has_rss"   => true,
  "rss_title" => "RSS Feed: ".format_text($config['site_name'], 2)." (".str_replace(':', '', $lang['new_images2']).")",
  "rss_url"   => $script_url."/rss.php?action=images"
));

Übrigens...
Ich denke dieser Weg ist einfacher, weil man sowieso nur ein Thumbnail_Bit anzeigen lässt!
Viele Mods bremsen die Performance und macht den 4images Code unübersichtlich.

Darum an alle...
Installiere keinen Mod wenn es nicht umbedingt sein muss, am besten vorher Local mit Xampp oder 4images Server mit der bestehenden Installation auf Verträglichkeit prüfen!



suche

Code: [Select]
    $new_images .= $site_template->parse_template("thumbnail_bit");
ersetze
Code: [Select]
    $new_images .= $site_template->parse_template("thumbnail_bit2");
Title: Re: [MOD]Eine zweite thumbnail_bit.html / A second thumbnail_bit.html
Post by: Benny Change on December 23, 2008, 11:11:18 PM
Geht das auch, das ich an Stelle des codes eine
include new_images2.php machen kann?
Title: Re: [MOD]Eine zweite thumbnail_bit.html / A second thumbnail_bit.html
Post by: mawenzi on December 23, 2008, 11:25:44 PM
... ja ... !
... und warum noch nicht selbst getestet ... ?
Title: Re: [MOD]Eine zweite thumbnail_bit.html / A second thumbnail_bit.html
Post by: Benny Change on December 24, 2008, 05:09:48 AM
Keine Ahnung,
ich wollte halt erst einmal nachfragen!
Title: Re: [MOD]Eine zweite thumbnail_bit.html / A second thumbnail_bit.html
Post by: jowani on December 28, 2008, 12:33:26 PM
{new_images2}

wie kann ich dann news_images2 so ändern,dass es nur bestimme neue bilder von einer kategorie auf der startseite zeigt.

und thumbnail_bit dann so ändern,dass nicht das bild dann anklickbar ist sondern bildname.?

Also startseite:
Neue Bilder aus Kategorie 30
Bild
<link>BildName</link>
usw usw
Title: Re: [MOD]Eine zweite thumbnail_bit.html / A second thumbnail_bit.html
Post by: Benny Change on January 11, 2009, 06:33:12 AM
Ist auf diesem Wege auch möglich, dass man zwei verschiedene user_loginform.htm und {user_box} verwenden kann?
Title: Re: [MOD]Eine zweite thumbnail_bit.html / A second thumbnail_bit.html
Post by: gann on April 21, 2010, 05:54:15 PM
Hello - I would appreciate any input on the following issue. Currently I am experiencing the following error:

Notice: Undefined variable: thumb_height in /home/workshee/public_html/printable/includes/functions.php on line 507

I have used the following mods -  Second Thumbnail Size as well as [MOD]Eine zweite thumbnail_bit.html / A second thumbnail_bit.html

Now let me explain how I arrived at this point (after many hours of trial and error) . My goal was to create a 2nd thumbnail size. This 2nd thumbnail size is used on the category page. The 2nd thumbnail is the smaller of the two image files. The larger image is used on the details page so the user can view the larger version of the image prior to downloading the file, which is PDF format.
So in a nutshell -  the user clicks on the small thumbnail which opens a page showing the full size with a download link for the PDF file.

Everything works fine except for the search option, which gives the above error message. The resulting search shows the full size image in the search results rather than the smaller thumbnail image. Any help of this matter would be greatly appreciated.