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.

 

[Solved] How to include Javascript directly in MetaMod ?

[Solved] How to include Javascript directly in MetaMod ?

Hi...

Many Thanks to Stephen Brandon, this is a great extension, I very like it

I want to put Javascript (Google Adsense code) directly in Metamod & not include the other module, is this possible ?

Site : http://www.freejoomlatemplatez.com/
Joomla version : 1.57
Metamod version : 1.0g/2.2c

Thanks in advance smile

Edited By: chuk
24-Jul-10 20:04:24

chuk
Beginner Modder
ranks
useravatar
Offline
10 Posts
Administrator has disabled public posting

Re: [Solved] How to include Javascript directly in MetaMod ?

Sure, you can do that. See this page for instructions on how to include HTML (or JS) code directly inside the MetaMod:

http://www.metamodpro.com/metamod/recip … in-metamod

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

Re: [Solved] How to include Javascript directly in MetaMod ?

Hi Stephen...

Many Thanks for your reply.
I've tried a tutorial as you said above and it's work smile

I want to customize / modificate module display by spesific country and page display, like this :

Countries : US & UK
- Pages : Cat Blog Layout
- JS Code : Google Adsense Code 1

- Pages : Full Article
- JS Code : Google Adsense Code 2

Countries : Except US & UK
- Pages : Category Blog Layout
- JS Code : Google Adsense Code 3

- Pages : Full Article
- JS Code : Google Adsense Code 4


I've read Documentation and Recipes pages, and I got these tutorials :

Code for spesific Country

Code:

if ($fromCountryId == "US")

Code for Category Blog Layout

Code:

if ($option == "com_content" and $view == "category")

Code for Full Article

Code:

if ($option == "com_content" and $view == "article")

Code for include Javascript directly in Metamod

Code:

/* the next line (questionmark greater-than) is important.

* Always put this before a block of html... */
?>
HTML / JAVASCRIPT CODE
<?php
/* after the block of HTML you always have to put the preceding line, even if
* that's the last line of the MetaMod PHP block.
*/

But how to integrate / combine All codes (syntax) above ? I'm very confused because I'm not good in PHP programming smile

Please help me, Stephen. Thanks in advanced smile

Regards
Cuki

chuk
Beginner Modder
ranks
useravatar
Offline
10 Posts
Administrator has disabled public posting

Re: [Solved] How to include Javascript directly in MetaMod ?

Hi Cuki,

thanks for the additional info - that helps a lot.

Try this, I think it's what you are after:

Code:

if ( $fromCountryId == 'US' or $fromCountryId == 'GB' ) {

  if ($option == "com_content" and $view == "category") {
?>

HTML CODE HERE (category view for US and GB users)

<?php
  } else if ($option == "com_content" and $view == "article") {
?>

HTML CODE HERE (article view for US and GB users)

<?php
  }
}

else { /* for visitors from all other countries: */
  if ($option == "com_content" and $view == "category") {
?>

HTML CODE HERE (category view for non-US, non-GB visitors)

<?php
  } else if ($option == "com_content" and $view == "article") {
?>

HTML CODE HERE (article view for non-US, non-GB visitors)

<?php
  }
}

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

Re: [Solved] How to include Javascript directly in MetaMod ?

Perfect !!
This is a code / syntax what I'm looking for
Thank you very much, Stephen. You're a Joomla Hero

Regards smile
Cuki

chuk
Beginner Modder
ranks
useravatar
Offline
10 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1686
Total Polls:
6
Total Posts:
5933
Total Posts Today:
7
User Info:
 
Total Users:
4432
Newest User:
kinggambling14
Members Online:
0
Guests Online:
201

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