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.

 

Show module in specific article

Show module in specific article

Hi,

Im new to Metamod and I need a step-by-step guide to how i can show modules in a specific article. I dont even now where I should put the code, so Im really struggling.

I want to show a couple of picture in my moduleposition "right" when viewing a specific article.

What code should i use, and where should i put it?

Thanks alot!

KaffeKarsK
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Show module in specific article

Hi KaffeKarsK,

Please read the Quick Start guide first:

http://www.metamodpro.com/metamod/quick-start

Also, since you are posting in the Pro forum, do you have MetaMod Pro? If so you need to have both MetaMod *and* MetaMod Pro installed, *and* you need to enable the MetaMod Pro plugin in the Plugin Manager.

Once you have those set up and you have read the Quick Start guide, here's a checklist:

1 - create a normal (e.g. Custom HTML, or any other sort of module that contains images) module that has the images in it. Leave it UNpublished because we don't want it to show up, except inside of a MetaMod. Take a note of the module id number.

2 - create a MetaMod and assign it to either ALL pages, *or* if you can, to the menu item where people might click first before they get to the article. (e.g. a blog-style category or section page).

3 - the MetaMod needs to be enabled, but generally have title OFF.

In the MetaMod PHP section, put the following:

if ($content_genius->check("article_id = XXX") ) return YYY;

... except, replace XXX with the article id number of the article, and replace YYY with the module id of the other module with the images in it.

4 - save the MetaMod and try out the page.


Write back if you need any more help with it!

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

Re: Show module in specific article

Thanks Stephen! Workes excellent!

How do I get space between modules?
When Im showing several modules in one metamod-modul i need to get at least a 5px gap between the modules.

I also got a problem with white spaces on empty modules. I guess I need to buy the pro-version for this.

KaffeKarsK
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Show module in specific article

To get spaces between modules, you really need to do that with CSS. I use Firefox with the FireBug extension. This allows me to isolate the particular HTML and CSS that are responsible for the spacing/color/padding/size etc, and I can play around with this "live" until it looks right. Then I can transfer the new settings back into the site's CSS file to make it permanent.

For white spaces in empty modules: yes, MetaMod Pro is the easiest way to address this. With MetaMod Pro, if the rule in the MetaMod module decides NOT to include any module, then the MetaMod itself will completely disappear... it will be as if it was never there in the first place. This helps empty columns to be able to collapse properly, etc.

Hope that helps,
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
3312 Posts
User info in posts
Administrator has disabled public posting

Re: Show module in specific article

For me it does not work with Joomla 1.64. I have debug on.
The message in the correct position is

MetaMod Debug-Information:
Module ID: 111
$option: com_content
$view: category
$id: 93
$Itemid:
$timezone: UTC
$language: de-de
$language_code: de
$language_region: de
Eingebundene Module: Keine (none)

I uses this code
if ($content_genius->check("article_id = 72") ) return 108;

Please, can you help me?
regards Marge

Eisele
Beginner Modder
ranks
useravatar
Offline
11 Posts
Administrator has disabled public posting

Re: Show module in specific article

Hi Marge,

The debug code shows that you are on a category page, not an article page. The content_genius check that you are doing is checking for a particular article page being displayed. But since it's a category page, then the check is failing, and the module is not being displayed.

Do you want the module to display on the category page whenever that particular article is showing on the category page? (presumably as 1 in a list of other articles?) If so then you need to approach it in a different way. I'd suggest just doing a check for the particular category, like this:

if ($content_genius->check("category_id = XXX")) return 108;
// replace XXX with the category id that the article is in.


Hope that helps,
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
3312 Posts
User info in posts
Administrator has disabled public posting

Re: Show module in specific article

Hi Stephen,
I have a category blog with many articles. On every article i will publish different modules. Sorry about my bad english.

best regards
Marge

Eisele
Beginner Modder
ranks
useravatar
Offline
11 Posts
Administrator has disabled public posting

Re: Show module in specific article

Hi Stephen,
I tried this
if ($content_genius->check("category_id = 93") and $content_genius->check("article_id = 72")) return 108;
but ist does not work

regards
Marge

Eisele
Beginner Modder
ranks
useravatar
Offline
11 Posts
Administrator has disabled public posting

Re: Show module in specific article

Hi Stephen,
I tried also this

if ($content_genius->check("category_id = 93") and $content_genius->check("page_number = 0")) return 108;
if ($content_genius->check("category_id = 93") and $content_genius->check("page_number = 1")) return 105;
it also not works
regards
Marge

Eisele
Beginner Modder
ranks
useravatar
Offline
11 Posts
Administrator has disabled public posting

Re: Show module in specific article

Hi Stephen,
I tried also a Receipe "Control modules based on page content/keywords/description"

In the metamod I put this code

$document =& JFactory::getDocument();
$content = $document->getMetaData('keywords');
$result = preg_match_all('#LINK_([0-9a-z_\-]+)(?:[^0-9a-z_\-]|$)#', $content, $matches);
if ($result > 0) { return $matches[1];
}

In the Article in Blog-View I wrote in Keyword LINK_101

It also does not work.

regards
Marge

Eisele
Beginner Modder
ranks
useravatar
Offline
11 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Posts this week:
1
User Info:
 
Total Users:
10137
Newest User:
lexispoker1
Members Online:
1
Guests Online:
265

Online: 
liaskas

Forum Legend:

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