Author Topic: different thema for some categories. possible?  (Read 10954 times)

0 Members and 1 Guest are viewing this topic.

Offline ilaslan

  • Newbie
  • *
  • Posts: 44
    • View Profile
different thema for some categories. possible?
« on: September 22, 2010, 08:09:28 AM »
hello.

i am using 4images 1.7.8. and using adsense.

but i have a problem. in some categories musn't have adsense codes ( due to the rules ) .

is it possible?
i know possible but easy?

but i think a bit hard. maybe for every categories choies the thema.

but i don't need complex change or code.

maybe easier. only one input  like   ("1,4,6,13,78,98") ( for category number other thema) . it is OK for me.

can anybody help us?
« Last Edit: September 22, 2010, 09:19:37 AM by ilaslan »

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: different thema for some categories. possible?
« Reply #1 on: September 22, 2010, 02:36:13 PM »
In categories.html template use something like this:

Code: [Select]
<?php
global $cat_id;
if (
in_array($cat_id, array(1,4,6,13,78,98)))
{
?>


YOUR ADSENSE CODE HERE

<?php
}
?>
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)

Offline ilaslan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: different thema for some categories. possible?
« Reply #2 on: September 22, 2010, 02:59:52 PM »
thanx . i will try.
but i wonder

will this code working details.html ?
this is also important for us.


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: different thema for some categories. possible?
« Reply #3 on: September 22, 2010, 03:02:36 PM »
Theoretically it should too
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)

Offline ilaslan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: different thema for some categories. possible?
« Reply #4 on: September 22, 2010, 06:12:03 PM »
yes. code is working.

thnx.
some new categories can come every time.  so i did categories array in constant.php.

thnx alot for help

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: different thema for some categories. possible?
« Reply #5 on: September 22, 2010, 06:19:14 PM »
some new categories can come every time.  so i did categories array in constant.php.
you should do it in page_header.php instead
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)

Offline ilaslan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: different thema for some categories. possible?
« Reply #6 on: September 22, 2010, 06:35:56 PM »
ok.

Offline ilaslan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: different thema for some categories. possible?
« Reply #7 on: September 24, 2010, 09:35:27 PM »
now..
i have a small detail problem..
in fact (1,4,6,13,78,98) this categories doesnt have adsense code. and the others have adsense...

i dont want this categories (1,4,6,13,78,98) pictures ( even thumnail ) with adsense code.

category page is ok.
details page is ok.

ok . but this images is coming new images.
or i think it comes search page.

at now most of this categories auth_viewimage is only registered users.
if i do auth_viewcat is only registered users will problem is solve?

but 

i prefer (1,4,6,13,78,98)  this categories hold external from new images and searchs...

 is there easy coding solve?

(my english isn't very good . sory if you don't understand any sentences)

Edit : i examine a bit
and in index.php have this code


$num_new_images = $config['image_cells']*3;
$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);



maybe this section must edit..

i dont know :S
 
can anybody help me?


« Last Edit: September 24, 2010, 09:56:56 PM by ilaslan »

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: different thema for some categories. possible?
« Reply #8 on: September 24, 2010, 09:56:42 PM »
If you want exclude these categories from showing adsense, then simple add ! infront of in_array:
Code: [Select]
if (!in_array($cat_id, array(1,4,6,13,78,98)))
The rest of your message I didn't quiet understand. You don't want show images from these categories on home page and in search results?
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)

Offline ilaslan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: different thema for some categories. possible?
« Reply #9 on: September 24, 2010, 10:05:18 PM »
 yes
i am using your code. i am using if and else.

and

there is no problem details.html and categories.html.

and this categories images isnt suitable for adsense.

so i dont want show images on home page ( as new images ) and in search results

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: different thema for some categories. possible?
« Reply #10 on: September 24, 2010, 10:19:47 PM »
In index.php find:

Code: [Select]
        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").")
Replace it with:
Code: [Select]
        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").", 1,4,6,13,78,98)

In search.php find:
  if (!empty($sql_where_query)) {

Insert above:
  $sql_where_query .= " AND i.cat_id NOT IN (1,4,6,13,78,98)";
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)

Offline ilaslan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: different thema for some categories. possible?
« Reply #11 on: September 24, 2010, 10:58:11 PM »
two codes are working good. but i think i must working in php :idea:..
in page_header.php

Quote
$cat_ext_adsense = array(1,4,6,13,78,98);

when i wrote your code

Quote
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").", $cat_ext_adsense)
or
Quote
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").", .$cat_ext_adsense)

has come db error :D

but i hope i can will I will succeed in future. and only one input. ty.

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: different thema for some categories. possible?
« Reply #12 on: September 25, 2010, 02:00:57 AM »
you almost got it right.

Code: [Select]
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")."," . implode(",", $cat_ext_adsense) .")
In templates you can use:
Code: [Select]
global $cat_id, $cat_ext_adsense;
if (in_array($cat_id, $cat_ext_adsense))
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)

Offline ilaslan

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: different thema for some categories. possible?
« Reply #13 on: January 19, 2011, 03:39:15 AM »
Hi V@no, and other experts

i have used an mod. and mod has  this code - command

WHERE i.image_active AND c.cat_id i.cat_id AND i.cat_id IN (".get_auth_cat_sql("auth_viewcat").")".$selection_cutoff[$cnt]."

i want to exclude some categories


$cat_ext_adsense = array(1,4,6,13,78,98);

how can i change first sql command?


help plss.

ty