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.

 

Return metamod on a certain URL string

Return metamod on a certain URL string

Hi Stephen,

I have a simple scenario
I would like to return the module ID 855

Conditions-
Exclude:
http://www.quebecguitare.ca/localisez-u … e-guitare/
http://www.quebecguitare.ca/localisez-u … /locations

Include only all possible entries on the third level:
http://www.quebecguitare.ca/localisez-u … locations/[all possible entries]

Return: 855

Thank you
Regards

atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Re: Return metamod on a certain URL string

Ok, you can do it this way:

if ($core_genius->check("url regex #quebecguitare.ca/localisez-un-prof-de-guitare/location/.+#")) return 855;

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: Return metamod on a certain URL string

Hi Stephen,

It works.

if ($core_genius->check("url regex #quebecguitare.ca/localisez-un-prof-de-guitare/location/.+#")) return 856;

I forgot to mention that on top of that PHP condition, I would like to use the Assigned Menu Item functionality of the metamod (joomla core). So in other words, the module shouldn't only return 856 when the condition is met, but ALSO when a selected menu item for this module to returned is enabled.

As of now the module only return if the Assignation is toggled to "All pages"

Thank you
Regards

atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Re: Return metamod on a certain URL string

Hi, thanks for noticing the 3000 posts! That's a bit of a milestone smile

It's interesting that the module is only returning when set to All Pages. Perhaps you can turn on advanced debug mode (temporarily) and view one of the pages concerned, and see what Itemid is being reported. Then match this up with the ids shown in the Joomla menu manager. Hopefully that will show you what menu it thinks it's on.

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: Return metamod on a certain URL string

Hi Stephen,

For this metamod with Advanced Debug enabled:
http://www.quebecguitare.ca/administrat … amp;id=924

Current config:
if ($core_genius->check("url regex #quebecguitare.ca/localisez-un-prof-de-guitare/location/.+#")) return 855;

Page assignation: Only on selected pages

I get the following info:
Page d'identification
Le code PHP ci-dessous peut être utilisé par Metamod pour identifier la page que vous visualisez. Pour une aide à cette utilisation, cliquez ici.
if (
$option == 'com_k2'
and $view == 'itemlist'
and $id == '150'
and $Itemid == '826'
and $jinput->get('limit') == '12' /*!*/
and $jinput->get('featured') == '1' /*!*/
and $jinput->get('task') == 'category' /*!*/
and $jinput->get('layout') == 'category' /*!*/
) return XXX; /* remplacer XXX par l'ID du module ou par sa position pour le faire apparaître */
Note: les lignes commencant avec "and" et finissant par /*!*/ contiennent des règles qui peuvent être optionnelles. Vous pouvez les laisser vide.
MetaMod debug info:
Module ID: 924
$option: com_k2
$view: itemlist
$id: 150
$Itemid: 826
$timezone: UTC
$language: en-us
$language_code: en
$language_region: us
Modules inclus: Aucun

Resolution:
The PHP code should include selected pages not only return the module when this condition is met:
if ($core_genius->check("url regex #quebecguitare.ca/localisez-un-prof-de-guitare/location/.+#")) return 855;

Could you provide the PHP code that includes "selected pages" as well as including the condition above?

Thank you
Regards

atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Re: Return metamod on a certain URL string

Hi Alex,

I've been puzzling over your request. In the end I can't understand what you are asking for.

What are "selected pages"? Do you mean something like "all item pages in K2 category 150" or "on all category pages" or something like that?

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: Return metamod on a certain URL string

Sorry about the confusion Stephen.

SB wrote:


What are "selected pages"? Do you mean something like "all item pages in K2 category 150" or "on all category pages" or something like that?

Neighter of those. I meant "Selected pages" from the "assigned menu item" of the metamod module backend configuration.

Thank you
Regards

atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Re: Return metamod on a certain URL string

ok, well the way it works is that the MetaMod will only activate "at all" if it's on one of the "selected pages" (the standard module setting that all modules have). Once it's on one of those pages, then any code in the MetaMod will be run/activated.

So what's happening at the moment that you don't want to happen?
Or what pages do you want to include the target modules on, that it is not already?

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: Return metamod on a certain URL string

I would like this module:
http://www.quebecguitare.ca/administrat … amp;id=855

Which already has some "selected pages" (the standard module setting that all modules have), to have these additional pages returning it as well:

if ($core_genius->check("url regex #quebecguitare.ca/localisez-un-prof-de-guitare/location/.+#")) return 855;

Example: http://www.quebecguitare.ca/localisez-u … e-beaulieu

Thank  you
Regards

atherrien
Modder Extraordinaire
ranks
useravatar
Offline
140 Posts
Administrator has disabled public posting

Re: Return metamod on a certain URL string

Oh I see what you mean, you want to combine the assigned pages of the "target" modules with the assigned pages of the MetaMod.

That's not particularly easy to achieve, as the MetaMod doesn't have an easy way to retrieve the list of pages that the target module is already assigned to. It would need those in order to prevent duplication (so the MetaMod doesn't return that module on pages that it's already assigned to).

I suggest making a list of the Itemids of the pages that the target module is assigned to, and just adding that to the MetaMod with an appropriate rule e.g.

if ($menu_genius->check("itemid = one of 123, 124, 125, 126, 127")) return 855;
// replace those Itemids with the proper ones.

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
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:
4397
Newest User:
tull687318
Members Online:
0
Guests Online:
118

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