Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Recipe for not showing module conatining ads on entry form pages

Recipe for not showing module conatining ads on entry form pages

Hi all,

first off: J1.5.23 - MetaMod 2.8 - Site still offline

I was wondering if you could help me with a recipe for NOT showing my core ad banner module on pages with no content i.e. Submission pages like article submission, review submission, contact us submission.

I'm particularly interested in getting one for Mosets tree 2.1.8 so when a user wants to submit a review of a listing, they don't see the ad banners.

(I need this because I've been told that ads aren't allowed on these types of pages.)

Thank you in advance for your help.

Ray.


P.s. I'm a MetaMod newbie and got recommended from this joomla forum thread: http://forum.joomla.org/viewtopic.php?f … p;t=645068

igolfniray
Beginner Modder
ranks
useravatar
Offline
16 Posts
Administrator has disabled public posting

Re: Recipe for not showing module conatining ads on entry form pages

Hi igolfniray,

Yes, you'll certainly be able to do this. The main thing is to be able to identify all the places where you don't want the banners to appear... or alternatively, to identify the places where you *do* what them to appear.

So, which is going to be easier? Choosing the pages where you do want it to appear, or those where it should not?

Perhaps start by making a list of the types of pages, and work from there. Then can you post the list on this thread?

It would also be useful if you create a MetaMod, publish it, set it to "all" pages, and switch on Advanced Debug mode in MetaMod. Then, visit each of the pages on your list, and take a copy of the MetaMod debug output to paste into here.

This will give a great head-start for creating the PHP rules that will either prevent the banners from appearing on these pages, or will include the banners *only* on these pages.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: Recipe for not showing module conatining ads on entry form pages

Hi Stephen,

I know it's taken me a long time to get back to you about this. But now that I've cracked it, I thought it might be interesting for you and others (maybe newbies like myself who need a hand) to see how I managed to get rid of my ad banners on Mosets tree entry forms etc.

I used this advice from your site: http://www.metamodpro.com/metamod/page-identification
to identify the pages I wanted not to have adverts. I got this code for the submission form:

Code:

if (

$option == 'com_mtree'
and $Itemid == 'XXX'
and JRequest::getVar('task') == 'addlisting'
and JRequest::getVar('cat_id') == '0'
)

Then I used edited in the code for NOT showing i.e.

Code:

! (

and 

Code:

)

to give me:

Code:

if ( ! (

$option == 'com_mtree'
and $Itemid == 'XXX'
and JRequest::getVar('task') == 'addlisting'
and JRequest::getVar('cat_id') == '0'
) )

Then I wanted all category submission forms to be without ads so I removed this line:

Code:

and JRequest::getVar('cat_id') == '0'

'0' refers to the root category, so removing this variable means the code now applies to ALL MTree submission forms as it doesn't take the category into account.


To remove ads from my 'recommend' and 'review listing' pages I used the same process.

Code:


if ( ! (
$option == 'com_mtree'
and JRequest::getVar('task') == 'recommend'
and JRequest::getVar('item_id') == '147'
) )

and again I simply removed the code for the specific item id:

Code:

and JRequest::getVar('item_id') == '147'

leaving:

Code:


if ( ! (
$option == 'com_mtree'
and JRequest::getVar('task') == 'recommend'
) )

So after I identified all my pages and removed the variable of the specific listing, I added:

Code:

return ZZZ;

Where 'ZZZ' is my add banner module ID.

And that was that. Now my listing submission forms and my recommend forms have no ads and google won't cut off my account for having ads on non content pages.

I hope this helps someone!

Drop me a mail: This e-mail address is being protected from spambots. You need JavaScript enabled to view it if any other newbies need this explained a little better!

smile

Ray

igolfniray
Beginner Modder
ranks
useravatar
Offline
16 Posts
Administrator has disabled public posting

Re: Recipe for not showing module conatining ads on entry form pages

Ray, that's great work. Well done on getting that working. That's the power of MetaMod - to be able to combine different conditions and tailor exactly when or on what pages the modules will appear.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1698
Total Polls:
6
Total Posts:
5944
Posts this week:
4
User Info:
 
Total Users:
5534
Newest User:
kaylee
Members Online:
0
Guests Online:
98

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked