Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Jreviews recipe issue
Jreviews recipe issue
Jreviews recipe issue
I'm trying to setup jreviews field modules to display when specific click2search options are clicked within jreviews.
The recipe I am using doesn't seem to work, can you point me in the right direction here. I'm not a coder and am struggling with this.
Joomla 2.5
MetaMod 3.10
JReviews Version: 2.3.19.213
http://www.inboundreviews.com/
if ($option == "com_jreviews" && isset($_GET['url'])) {
$url = preg_replace("#/$#",'',$_GET['url']);
$parts = explode("/",$url);
$last_part = $parts[count($parts)-1];
$last_part = preg_replace("#_.*$#","",$last_part);
switch ($last_part) {
case "search/tag/marketingtools/seo-tools/": // seo off
case "search/tag/marketingtools/seo:tools/": // seo on
return 104; /* REPLACE 101 with appropriate module id */
// add more as appropriate...
}
} else {
return 87;
}
Recipe returns nothing at the following URL.
http://www.inboundreviews.com/search/ta … seo-tools/
09-Aug-12 17:05:56
Re: Jreviews recipe issue
Hi daxum23,
Thanks for all the info, particularly the version numbers.
I haven't tested out JReviews on J2.5, so things may well have changed.
Could I ask you to turn on Advanced Debug mode in MetaMod, view the page in question, and copy and paste the output of this into a forum reply? That should give some idea of the variables we have to work with.
Best regards,
Stephen
Re: Jreviews recipe issue
Ty for the reply Stephen
Here is the information you requested.
Page Identification
The PHP code below may be used to help MetaMod to identify the exact page that you are viewing. For help using this feature, please click here.
if (
$option == 'com_jreviews'
and $Itemid == '149'
and JRequest::getVar('url') == 'tag/marketingtools/seo-tools' /*!*/
) return XXX; /* replace XXX with the module ID or position to display */
Note: lines starting with "and" and ending with /*!*/ contain rules that may be optional. You may wish to leave them out.
MetaMod debug info:
Module ID: 107
$option: com_jreviews
$view:
$id:
$Itemid: 149
$timezone: UTC
$language: en-us
$language_code: en
$language_region: us
Including modules: None
Also can be viewed http://www.inboundreviews.com/search/ta … seo-tools/
Re: Jreviews recipe issue
ok, so if you are wanting the modules to trigger on exactly that page, you can use the rule almost exactly as suggested:
if (
$option == 'com_jreviews'
and JRequest::getVar('url') == 'tag/marketingtools/seo-tools'
) return 104;
else return 87;
Cheers,
Stephen
Re: Jreviews recipe issue
Awesome that works. Thank you.
I have another quick question on the same subject.
I have a lot of different modules i want displayed depending on the url. Is this also the format I would use?
e.g.
I want module 104 to return on 'tag/marketingtools/seo-tools/'
105 to return on 'tag/marketingtools/social-media-tool/'
107 to return on 'tag/marketingtools/ppc-tools/'
etc..
In the recipe for Jreviews in your documentation you can enter multiple reassignments
http://www.metamodpro.com/metamod/recip … view-pages
switch ($last_part) {
case "jreviews-category-list": // seo off
case "jreviews:category:list": // seo on
return 101; /* REPLACE 101 with appropriate module id */
case "the-community": // seo off
case "the:community": // seo on
return 102; /* REPLACE 102 with appropriate module id */
case "the-project": // seo off
case "the:project": // seo on
return 103; /* REPLACE 103 with appropriate module id */
// add more as appropriate...
Can you tell me how I can do that with the recipe you just gave me? using the recipe above doesn't work.
Re: Jreviews recipe issue
I got it work by doing this
Code:
if (
$option == 'com_jreviews'
and JRequest::getVar('url') == 'tag/marketingtools/seo-tools'
) return 104;
elseif ($option == 'com_jreviews'
and JRequest::getVar('url') == 'tag/marketingtools/social-media-tools'
) return 102;
else return 106;
However there has to be an easier way to make these statements, so that im not repeating the else if ($option == 'com_jreviews' portion.
I tried something like this but it didn't work
Code:
if (
$option == 'com_jreviews'
if JRequest::getVar('url') == 'tag/marketingtools/seo-tools'
) return 104;
elseif JRequest::getVar('url') == 'tag/marketingtools/social-media-tools'
) return 102;
else return 106;
Re: Jreviews recipe issue
Like this:
if ( $option == 'com_jreviews' ) {
$url = JRequest::getVar('url');
if ( $url == 'tag/marketingtools/seo-tools' ) return 104;
if ( $url == 'tag/marketingtools/social-media-tools' ) return 102;
}
return 106;
This way, 106 is used on all pages that don't match the two URLs being tested.
Cheers,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » Jreviews recipe issue
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5967
- Total Posts Today:
- 2
- User Info:
- Total Users:
- 8028
- Newest User:
- musial8334
- Members Online:
- 0
- Guests Online:
- 149
- 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