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 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 16:58:33

icculus
Beginner Modder
ranks
useravatar
Offline
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:

Code:

$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:

Code:

$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:

Code:

$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

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

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10746
Newest User:
victor1234
Members Online:
0
Guests Online:
186

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