Author Topic: [Mod] Neueste 5 Kategorien auf Home Seite  (Read 66029 times)

0 Members and 1 Guest are viewing this topic.

Offline Kai0r

  • Pre-Newbie
  • Posts: 2
    • View Profile
[Mod] Neueste 5 Kategorien auf Home Seite
« on: May 16, 2010, 01:53:05 AM »
Hallo.

Anstatt der 5 neueste Bilder würde ich gerne die 5 neuesten Kategorien mit einem kleinen Vorschaubild auf der Home Seite anzeigen lassen.

Ist dies irgendwie möglich?

Mit freundlichen Grüßen,
Kai

Offline Kai0r

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #1 on: June 13, 2010, 02:09:11 AM »
Hat denn wirklich niemand eine Lösung für mich parat?  :(

Rembrandt

  • Guest
Re: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #2 on: June 20, 2010, 07:34:22 PM »
Hi!

hat ein bischen länger gedauert, aber es gibt eine lösung ..  :)

Der Mod Funktioniert nur wenn in der Kategorie auch Bilder sind!
The mod works only when pictures are in the new category!

DEMO


suche in der index.php:
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------

füge darüber ein:

//################################# Start New Cat #####################################
$num_new_cat $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").")
        GROUP BY i.cat_id DESC
        ORDER BY i.cat_id DESC
        LIMIT 
$num_new_cat";
if (
$result $site_db->query($sql))
  
$num_rows $site_db->get_numrows($result);
else
  
$num_rows 0;

if (!
$num_rows)  {
  
$new_cat "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  
$new_cat .= $lang['no_new_images'];
  
$new_cat .= "</td></tr></table>";
}
else  {
  
$new_cat "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  
$count 0;
  
$bgcounter 0;
  while (
$image_row $site_db->fetch_array($result)){
    if (
$count == 0) {
      
$row_bg_number = ($bgcounter++ % == 0) ? 2;
      
$new_cat .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    
$new_cat .= "<td  valign=\"top\">\n";

    
show_image($image_row);
    
$new_cat .= $site_template->parse_template("thumbnail_bit");
    
$new_cat .= "\n</td>\n";
    
$count++;
    if (
$count == $num_new_cat) {
      
$new_cat .= "</tr>\n";
      
$count 0;
    }
  } 
// end while

  
if ($count 0)  {
    
$leftover = ($num_new_cat $count);
    if (
$leftover >= 1) {
      for (
$f 0$f $leftover$f++) {
        
$new_cat .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      
$new_cat .= "</tr>\n";
    }
  }
  
$new_cat .= "</table>\n";
// end else

$site_template->register_vars("new_cat"$new_cat);
unset(
$new_cat);
//#################################### End New Cat ###########################################


einfügen kannst du das natürlich in der home.html wo immer du möchtest, z.b. suche in der home.html:
Code: [Select]
{if msg}<b>{msg}</b><br /><br />{endif msg}und füge darunter ein:
Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td class="head1">
                          <table width="100%" border="0" cellspacing="0" cellpadding="4">
                            <tr>
                              <td class="head1" valign="top">New Categorie</td>
                            </tr>
                          </table>
                        </td>
                      </tr>
                      <tr>
                        <td class="head1">{new_cat}</td>
                      </tr>
                    </table>
                    <br>

mfg Andi
« Last Edit: August 24, 2014, 07:23:48 PM by Rembrandt »

Offline hongoctrien

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Thư viện tư liệu LÀNG ANH TUẤN
Re: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #3 on: July 31, 2010, 03:54:41 AM »
Quote
An unexpected error occured. Please try again later.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\Program Files\phpLemon Server\WWW\lang\includes\db_mysql.php on line 116

hic, I saw problem on top
http://anhtuanqt.net - Thư viện tư liệu LÀNG ANH TUẤN

Offline hongoctrien

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Thư viện tư liệu LÀNG ANH TUẤN
Re: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #4 on: August 04, 2010, 06:26:01 AM »
whow is help me!
http://anhtuanqt.net - Thư viện tư liệu LÀNG ANH TUẤN

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: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #5 on: August 04, 2010, 07:03:15 AM »
Replace
$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);


With:
if ($result $site_db->query($sql))
  
$num_rows $site_db->get_numrows($result);
else
  
$num_rows 0;
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: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #6 on: August 04, 2010, 08:05:57 AM »
@V@no:
ok... I understand the error, but when this is true?
but the mod works only when pictures are in the new category.

mfg Andi

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #7 on: August 04, 2010, 11:08:59 AM »
Hi Rembrandt,
kannst du das auch so abwandeln, dass er der eigentlichen Kategorieansicht auf der Startseite ähnelt, also das die Ordner angezeigt werden? Nur eben das immer die neuesten angezeigt werden.

Rembrandt

  • Guest
Re: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #8 on: August 04, 2010, 04:45:06 PM »
... Nur eben das immer die neuesten angezeigt werden.
das geht leider nicht, da die categorien keine datum od. zeitstempel haben.
das einzige was du machen kannst ist wenn du eine neue kategorie erstellst, die als oberste anlegen.

der mod selber sortiert ja auch nicht wirklich nach einen datum, sondern nach der cat_id nummer.
im normalfall bekommt eine neue kategorie die höchste cad_id nummer und die wird zuerst angezeigt.

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #9 on: August 04, 2010, 06:24:59 PM »
Alles klar, danke!

Offline hongoctrien

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Thư viện tư liệu LÀNG ANH TUẤN
Re: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #10 on: August 07, 2010, 06:49:11 AM »
...
The mod works only when pictures are in the new category!...

Problem

Code: [Select]
An unexpected error occured. Please try again later


please do not full quote @Rembrandt
« Last Edit: August 07, 2010, 06:57:24 AM by Rembrandt »
http://anhtuanqt.net - Thư viện tư liệu LÀNG ANH TUẤN

Rembrandt

  • Guest
Re: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #11 on: August 07, 2010, 06:58:15 AM »
post your index.php as attachment.

Offline hongoctrien

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Thư viện tư liệu LÀNG ANH TUẤN
Re: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #12 on: August 07, 2010, 12:33:15 PM »
This it. It deleted insert code
http://anhtuanqt.net - Thư viện tư liệu LÀNG ANH TUẤN

Rembrandt

  • Guest
Re: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #13 on: August 07, 2010, 04:24:45 PM »
This it. It deleted insert code
and why? (see Attachment)

Offline hongoctrien

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Thư viện tư liệu LÀNG ANH TUẤN
Re: [Mod] Neueste 5 Kategorien auf Home Seite
« Reply #14 on: August 08, 2010, 12:40:22 PM »
I don't know
http://anhtuanqt.net - Thư viện tư liệu LÀNG ANH TUẤN