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.

 

Mosets or Satement

Mosets or Satement

Using Joomla 2.5.8 Metamod 3-13b

I want to show adsense only when i am in a category and not in the listing self. I have used the advanced debugging to get the code working for a category. As per the code below when i am in category 2274 - it displays the adsense code and that is working fine.

i am stugling to change the code that if i am in catecory 2274 or 2275 or 2276 that the code must be displayed - i have tried to put '2274, 2275, 2276' in place of the '2274' but that does not work and then nothing displays - could you please help me to get the OR statement working.

if ( $option == 'com_mtree' and $Itemid == '176' and $jinput->get('task') == 'listcats' ) {
    if ( $jinput->get('cat_id') == '2274' ) {
        ?>
        <script type="text/javascript">
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
   var gads = document.createElement("script");
   gads.async = true;
   gads.type = "text/javascript";
   var useSSL = "https:" == document.location.protocol;
   gads.src = (useSSL ? "https:" : "http:") + "//www.googletagservices.com/tag/js/gpt.js";
   var node =document.getElementsByTagName("script")[0];
   node.parentNode.insertBefore(gads, node);
  })();
</script>


<div id="div-gpt-ad-1356898040075-1">
  <script type='text/javascript'>
    googletag.cmd.push(function() {
      googletag.defineSlot('/13259005/at_Knysna_All_TopRight_250x250', [250, 250], 'div-gpt-ad-1356898040075-1')
        .addService(googletag.pubads())
        .setTargeting("Directory", "Accommodation");
      googletag.enableServices();
      googletag.display('div-gpt-ad-1356898040075-1');
  });
  </script>
</div>

<div id="div-gpt-ad-1356898040075-0">
  <script type='text/javascript'>
    googletag.cmd.push(function() {
      googletag.defineSlot('/13259005/at_Knysna_All_BotRight_250x250', [250, 250], 'div-gpt-ad-1356898040075-0')
        .addService(googletag.pubads())
        .setTargeting("Directory", "Accommodation");
      googletag.enableServices();
      googletag.display('div-gpt-ad-1356898040075-0');
  });
  </script>
</div>
        <?php
    }
}

bossies
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Mosets or Satement

Hi,

the 1st part of your rule would become:

Code:

if ( $option == 'com_mtree' and $Itemid == '176' and $jinput->get('task') == 'listcats' ) { 

    $cat_id = $jinput->get('cat_id');
    if ( in_array($cat_id,array('2274','2275','2276') ) ) {

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
3328 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Posts this week:
3
User Info:
 
Total Users:
4401
Newest User:
jason59312
Members Online:
0
Guests Online:
105

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