4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: kar76 on May 02, 2013, 04:05:46 AM

Title: Admin Plugin for Enable/Disable Ads Code?
Post by: kar76 on May 02, 2013, 04:05:46 AM
Hello friends

Is there a way to disable-Enable Adsence code or any advertisement code for particular images only through admin control panel? I found some tags which disable or enable particular functions but those tags do that for whole site. But i want for particular pages only.
Title: Re: Admin Plugin for Enable/Disable Ads Code?
Post by: bergblume on May 02, 2013, 08:39:54 AM
hi kar!
yes that is easily possible.
just build up a custom field for images (https://www.4homepages.de/forum/index.php?topic=30264.0) (e.g. called ads)... this field you can then specifically edit in admin panel as you want.
greetz,
bergblume
Title: Re: Admin Plugin for Enable/Disable Ads Code?
Post by: kar76 on May 02, 2013, 11:39:06 PM
Hello bergblume :)

First thanks for reply and help

I did what suggested on page "http://www.4homepages.de/forum/index.php?topic=30264.0"

But that isn't working. I put adsense code in text area and it not visible, i think javascript causing problem.

Then i try radio button option instead of text field, for yes/no option. So i created two tags 

{if adsense} Show Adsense Code  {endif adsense}    for yes option
{ifnot adsense} Hide Adsense Code {endifnot adsense}  for no option

But i don't know how to link these tags with yes or no option in Control Panel

Can you solve this problem?
Title: Re: Admin Plugin for Enable/Disable Ads Code?
Post by: bergblume on May 03, 2013, 01:00:13 PM
hi!

it could be that for your adcode the character line is too short...

try VARCHAR( 5000 ) NOT NULL;

instead of VARCHAR( 255 ) NOT NULL;
Title: Re: Admin Plugin for Enable/Disable Ads Code?
Post by: kar76 on May 03, 2013, 08:26:36 PM
I did what you suggest but its still doesn't work.

------------------------------------------------------------------------------------------

I also did a little trick.  I created two text field in CP. In fist filed i put {ifnot adsense}

In second field  put {endifnot adsense}

And in my html file did this  {image_photograph}Advertisement code{image_photograph2}

But tags not doing their work. I thought its some mistake so i replace {ifnot adsense} , {endifnot adsense}

with some text and those text appeared around advertisement code.

I wonder why tags isn't working.
Title: Re: Admin Plugin for Enable/Disable Ads Code?
Post by: Rembrandt on May 03, 2013, 08:37:59 PM
Hi!
Is there always the same adsense code?

mfg Andi
Title: Re: Admin Plugin for Enable/Disable Ads Code?
Post by: kar76 on May 03, 2013, 09:35:08 PM
Yes, in every page same adsense code.
I use tags around 468x60 advertisement.

I wonder why tags isn't working. I can see adsence code by View Page Source  in browser.
Those tags must hide adsence code but only tags hide adsence code appears.
But when i use them directly in html files they hide adsence code.
Title: Re: Admin Plugin for Enable/Disable Ads Code?
Post by: Rembrandt on May 05, 2013, 05:18:22 PM
1.) add in your DB:
Code: [Select]
ALTER TABLE 4images_images ADD image_ads TINYINT(1) DEFAULT '0' NOT NULL

2.) add in db_field_definitions.php :

$additional_image_fields['image_ads'] = array($lang['image_ads'], "radio", 0);


3.) add in lang/main.php:

 $lang['image_ads'] = "View Adsence :";


4.) add in your details.html:
Code: [Select]
{if image_ads}
  your ads code....
{endif image_ads}

mfg Andi
Title: Re: Admin Plugin for Enable/Disable Ads Code?
Post by: kar76 on May 05, 2013, 08:09:43 PM
Its perfect  :D
This is what i can say
great help
Title: Re: Admin Plugin for Enable/Disable Ads Code?
Post by: Rembrandt on May 05, 2013, 08:13:25 PM
 :thumbup:
Title: Re: Admin Plugin for Enable/Disable Ads Code?
Post by: kar76 on May 05, 2013, 11:01:57 PM
I just realize that its only for images, its not for category

How about category?  :)
Title: Re: Admin Plugin for Enable/Disable Ads Code?
Post by: kar76 on May 18, 2013, 10:53:52 PM
I try above code for categories but no luck, its not working for categories. :(

Does anyone know, how to implement Rembrandt code for categories?
Title: Re: Admin Plugin for Enable/Disable Ads Code?
Post by: Rembrandt on May 20, 2013, 05:09:18 PM
Hi!
...Does anyone know, how to implement Rembrandt code for categories?
yes, I myself. :)
http://www.4homepages.de/forum/index.php?topic=31232.0

mfg Andi
Title: Re: Admin Plugin for Enable/Disable Ads Code?
Post by: sunl on March 09, 2015, 09:28:24 AM
Code: [Select]
{if image_ads}
  your ads code....
{endif image_ads}
This tag isn't working in multi_popup.html window mode.
I think multi-popup mod belongs to download.php file.
I even try to put conditional tag in download.php but it show enabled code but not disable code.
How to configure download.php so this mode work there too?