4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 24, 2014, 09:42:22 AM

Login with username, password and session length
Search:     Advanced search
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Releases & Support) (Moderators: mawenzi, Rembrandt)
| | |-+  [MOD] See new pictures of a specified category
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 » »» Print
Current Topic Rating: *****
Author Topic: [MOD] See new pictures of a specified category  (Read 9621 times)
Sumale.my
Addicted member
******
Offline Offline

Posts: 1787

Thank You
-Given: 161
-Receive: 75

Neverdie


View Profile
« on: June 15, 2010, 06:07:26 PM »

Open / Öffne: index.php
Search / Suche:
1
2
$site_template->register_vars("new_images"$new_images);
unset(
$new_images);
Add after / Füge danach ein:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//-----------------------------------------------------
//--- Show New Images By Category ---------------------
//-----------------------------------------------------
$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_news_images_bycat $config['image_cells'];
// Option Start
$bycat_in = array(72,132); // Change the Number in your category-id - ID ripping by commas
                           // Ändere die Nummer in deine Kategorie-ID - ID trennen durch Komma
// Option Ende
$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 IN ("
.get_auth_cat_sql("auth_viewcat").") AND i.cat_id IN (".implode(", "$bycat_in).") 
        ORDER BY i.image_date DESC
        LIMIT 
$num_news_images_bycat";
$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);

if (!
$num_rows)  {
  
$news_images_bycat "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  
$news_images_bycat .= $lang['no_news_images_bycat'];
  
$news_images_bycat .= "</td></tr></table>";
}
else  {
  
$news_images_bycat "<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;
      
$news_images_bycat .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    
$news_images_bycat .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    
show_image($image_row);
    
$news_images_bycat .= $site_template->parse_template("thumbnail_bit");
    
$news_images_bycat .= "\n</td>\n";
    
$count++;
    if (
$count == $config['image_cells']) {
      
$news_images_bycat .= "</tr>\n";
      
$count 0;
    }
  } 
// end while

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

$site_template->register_vars("news_images_bycat"$news_images_bycat);
unset(
$news_images_bycat);

Suche nach // Option Start. Dort müssen die ID´s der Kategorien eingetragen werden
Search / / Start option. Where the ID's of the categories listed


Add this code in your home.html
Füge diesen Code in deiner home.html ein
1
{news_images_bycat}

Finish
Fertig
Logged
Sumale.my
Addicted member
******
Offline Offline

Posts: 1787

Thank You
-Given: 161
-Receive: 75

Neverdie


View Profile
« Reply #1 on: June 26, 2010, 09:58:10 AM »

Wie kann man das eiegntlich extern ausgeben lassen?
Logged
GaYan
Sr. Member
****
Offline Offline

Posts: 300

Thank You
-Given: 6
-Receive: 23

♫ | G2 | ♫


View Profile WWW
« Reply #2 on: July 05, 2010, 03:28:29 AM »

great mod  Wink cant we control this over the admin panel ;  its always pain to edit the code  Mr. Green ! thanks !
Logged

G2 DesignLabs - Creative web Design And Development - www.dsignvilla.com
  • Developing Flash Apps [ Games , Applications , Web Sites , etc .... ]
  • 4image Templates ( css or fully flash ) [ Fully Flash or css 4image designing ]
  • Any PSD to 4image template [ Convert Your Psd to a 4image Template ]
  • Digital Video Production [ 3D And Visual FX , Digital Promoz & etc .. ]
  • Graphic Designing [ PS . AI . MaYa ]
khan
Newbie
*
Offline Offline

Posts: 35

Thank You
-Given: 2
-Receive: 3


View Profile
« Reply #3 on: August 29, 2010, 11:55:30 PM »

great and very useful mod, is there way to disply new images from all sub categories under a specified main category?

for example :
I have the main category "Main Category" and its sub ctegories "Sub Cat1>Sub Cat2>Sub Cat3>Sub Cat4>"   in the code (index.php) assign only the main category ID and the script disply new images from all its sub categories.

things are very much clear in your post i can get the result by adding all sub cats IDs but I frequently adding new sub categories under different Main Categories and its a bit difficult to add Cat IDs every time i add a new sub cat.
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 556

mmm PHP...


View Profile WWW
« Reply #4 on: August 30, 2010, 04:00:34 AM »

You can use something like this:
1
2
3
4
$main_cat_id 123//Main Category ID
$subcat_ids = array();
get_subcat_ids($main_cat_id$main_cat_id$cat_parent_cache);
$bycat_in $subcat_ids[$main_cat_id];
« Last Edit: September 01, 2010, 05:34:18 AM by V@no » Logged

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)
khan
Newbie
*
Offline Offline

Posts: 35

Thank You
-Given: 2
-Receive: 3


View Profile
« Reply #5 on: August 30, 2010, 08:56:51 PM »

hi v@no!
i add the code after line
1
$bycat_in = array(my cat ID);
but there is no output except a blank space. please let me know where i exactly place or replace the code.

Thanx
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 556

mmm PHP...


View Profile WWW
« Reply #6 on: August 30, 2010, 09:09:29 PM »

blank space? if anything, it should tell you that there is no images...or you mean blank page?
Logged

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)
khan
Newbie
*
Offline Offline

Posts: 35

Thank You
-Given: 2
-Receive: 3


View Profile
« Reply #7 on: August 30, 2010, 09:21:27 PM »

i added th tag {news_images_bycat} on my home page, i have a main category ID = 2 and it has a sub cat ID = 8 when i assign sub cat ID directly to (   $bycat_in = array(my sub cat ID Cool;  ) without adding your code it works and display the new images from that sub cat, but after adding the code i assign Main Cat ID which is in my case 2, there is nothing to display.

rest of the page is ok, every things are displying, my code is:
1
2
3
4
5
6
7
8
9
// Option Start

$bycat_in = array(2); // Change the Number in your category-id - ID ripping by commas

$main_cat_id 2//Main Category ID
$subcat_ids = array();
get_subcat_ids($main_cat_id$main_cat_id$cat_parent_cache);
$bycat_id $subcat_ids;
// Option Ende
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 556

mmm PHP...


View Profile WWW
« Reply #8 on: August 31, 2010, 02:29:06 AM »

oopsy daisy  Embarassed

Replace $bycat_id with $bycat_in
Logged

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)
khan
Newbie
*
Offline Offline

Posts: 35

Thank You
-Given: 2
-Receive: 3


View Profile
« Reply #9 on: August 31, 2010, 10:07:08 PM »


same as before but now i get error message "An unexpected error occured. Please try again later."
« Last Edit: August 31, 2010, 10:45:49 PM by khan » Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 556

mmm PHP...


View Profile WWW
« Reply #10 on: September 01, 2010, 05:35:08 AM »

hmmm apparently I forgot how that function works..
replace
1
$bycat_in $subcat_ids;

With:
1
$bycat_in $subcat_ids[$main_cat_id];
Logged

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)
khan
Newbie
*
Offline Offline

Posts: 35

Thank You
-Given: 2
-Receive: 3


View Profile
« Reply #11 on: September 01, 2010, 12:42:30 PM »

Wow .... thanx v@no it works now
Logged
sigma.
Full Member
***
Offline Offline

Posts: 148

Thank You
-Given: 3
-Receive: 1

cydonian.com/potd


View Profile WWW
« Reply #12 on: December 29, 2010, 04:21:18 AM »

exactly what i needed. Thanks!
Logged
nightfallsnet
Pre-Newbie

Offline Offline

Posts: 8

Thank You
-Given: 1
-Receive: 2


View Profile
« Reply #13 on: January 04, 2011, 10:15:37 AM »

hmm edited index.php and added {news_images_bycat} to home not showin anything.. 1.7.9
Logged
a1367h
Pre-Newbie

Offline Offline

Posts: 5

Thank You
-Given: 2
-Receive: 1


View Profile
« Reply #14 on: December 20, 2012, 03:03:53 AM »

Hi.
I want  to use it just for one category. when i set my category number, it just repeat one image in two rows and 4 columns same as new images number.(8 images)
I need 4 images in one row.
could anyone help me?

sorry for my bad English. I'm not expert in English.
I hope you understand what I  want.
Logged

Hossein Rad
Pages: [1] 2 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.135 seconds with 20 queries.
Post your comments here