|
Sumale.nin
|
 |
« on: June 15, 2010, 06:07:26 PM » |
|
Open / Öffne: index.phpSearch / 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++ % 2 == 0) ? 1 : 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 \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 listedAdd this code in your home.html Füge diesen Code in deiner home.html ein Finish Fertig
|
|
|
|
|
|
Logged
|
|
|
|
|
Sumale.nin
|
 |
« Reply #1 on: June 26, 2010, 09:58:10 AM » |
|
Wie kann man das eiegntlich extern ausgeben lassen?
|
|
|
|
|
|
Logged
|
|
|
|
GaYan
Sr. Member
  
Offline
Posts: 300
Thank You
-Given: 6
-Receive: 18
♫ | G2 | ♫
|
 |
« Reply #2 on: July 05, 2010, 03:28:29 AM » |
|
great mod  cant we control this over the admin panel ; its always pain to edit the code  ! 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
Posts: 35
Thank You
-Given: 2
-Receive: 3
|
 |
« 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
Posts: 17849
Thank You
-Given: 47
-Receive: 498
mmm PHP...
|
 |
« 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
|
|
|
|
khan
Newbie
Offline
Posts: 35
Thank You
-Given: 2
-Receive: 3
|
 |
« 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
Posts: 17849
Thank You
-Given: 47
-Receive: 498
mmm PHP...
|
 |
« 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
|
|
|
|
khan
Newbie
Offline
Posts: 35
Thank You
-Given: 2
-Receive: 3
|
 |
« 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 ; ) 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
Posts: 17849
Thank You
-Given: 47
-Receive: 498
mmm PHP...
|
 |
« Reply #8 on: August 31, 2010, 02:29:06 AM » |
|
oopsy daisy  Replace $bycat_id with $bycat_in
|
|
|
|
|
|
Logged
|
|
|
|
khan
Newbie
Offline
Posts: 35
Thank You
-Given: 2
-Receive: 3
|
 |
« 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
Posts: 17849
Thank You
-Given: 47
-Receive: 498
mmm PHP...
|
 |
« 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
|
|
|
|
khan
Newbie
Offline
Posts: 35
Thank You
-Given: 2
-Receive: 3
|
 |
« Reply #11 on: September 01, 2010, 12:42:30 PM » |
|
Wow .... thanx v@no it works now
|
|
|
|
|
|
Logged
|
|
|
|
sigma.
Full Member
 
Offline
Posts: 148
Thank You
-Given: 3
-Receive: 0
cydonian.com/potd
|
 |
« Reply #12 on: December 29, 2010, 04:21:18 AM » |
|
exactly what i needed. Thanks!
|
|
|
|
|
|
Logged
|
|
|
|
nightfallsnet
Pre-Newbie
Offline
Posts: 8
Thank You
-Given: 1
-Receive: 0
|
 |
« 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
Posts: 5
Thank You
-Given: 2
-Receive: 0
|
 |
« 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
|
|
|
|