Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.



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


Recipe help for a PHP neophyte

Recipe help for a PHP neophyte

I apologize if this has been asked before, but I could not find any reference to it. I was hoping to load content (an article) to be directly displayed within MetaMod 2.2c and Joomla 1.5. I figured there must be a way due to the powerful possibility of PHP code injection, but I only know enough PHP to make extremely minor code alterations and how to return blank error pages.

As a side note, I was wondering how to directly place phoca galleries into MetaMod without using Phoca's module addon. The reason being that each page would have a different gallery and having to make a module for each gallery would quickly become unwieldy.

The first request would be a lifesaver, but an answer to the second problem would be nice for flexibility in my design.

P.S. I love your product and it patches one of the most massive oversights in Joomla. Thank you.

Edited By: icculus
11-Dec-09 15:58:33

Beginner Modder
1 Posts
Administrator has disabled public posting

Re: Recipe help for a PHP neophyte

Hi icculus,

I'm sure that there are several modules out there that should be able to display the contents of an article inside a module - you shouldn't really need to do this in MetaMod (though of course it's possible).

Then you could just get MetaMod to control the article ID that the module will display, and you have the ability to turn it on or off.

See here for a list of modules which can do this:

http://extensions.joomla.org/extensions … tent-embed

I'll try out the 1st one on the list, "Article Module"... so I just installed that. The parameter name for the article id is simply "id".
So I kept the Article Module disabled (turned off), because the MetaMod will auto-enable it.

I used the following rule:


$module = 95; /* the Article Module id*/

$article_id_to_display = 46;
$changes->mod( $module )->setParam("id", $article_id_to_display);
return $module;

Simple! Now I can use other rules to enable or disable this, or to change the article ID that it's going to display.

Next, you asked for a similar thing for Phoca Galleries. Actually you asked if the gallery could be placed directly into MetaMod code, but I think the approach above is much more elegant. It allows the Phoca Gallery to do what it does best (display the images and handle all that), but MetaMod gets to tell it which images to display.

So I am looking at the "Phoca Gallery Image Module" - I assume that what you're referring to. I see in the mod_phocagallery_image.xml file that there's a parameter called "category_id" which can take (I think) either a single category id, or a list of ids like this:   2|3|4

I'd do a rule just like the one above, to control this:


$module = 96; /* the Phoca Gallery Module */

$category_id_to_display = 2; /* phoca gallery id 2 */
$changes->mod( $module )->setParam("category_id", $category_id_to_display);
return $module;

Now we can start playing with that, to display different galleries on different pages. For example, we'll display gallery 1 on article pages, gallery 2 on article category pages, and gallery 3 on all other pages:


$module = 96; /* the Phoca Gallery Module id*/

if ($option == "com_content" and $view == "article" ) $category_id_to_display = 1;
else if ($option == "com_content" and $view == "category" ) $category_id_to_display = 2;
else $category_id_to_display = 3;
$changes->mod( $module )->setParam("category_id", $category_id_to_display);
return $module;

Hope that helps,

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

3330 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
Total Topics:
Total Polls:
Total Posts:
Total Posts Today:
User Info:
Total Users:
Newest User:
Members Online:
Guests Online:


Forum Legend:

 New Sticky