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.


Need Help With URL-Parsing Recipe

Need Help With URL-Parsing Recipe

My Goal: I have 12 different cities with business listing data for each city. I want to personalize each city's page by placing an image banner and "featured businesses" module on the top of each city's page.

Setup: Using MetaMod 2.5 and Joomla 1.5.21. Each city's "page" is dynamically created - it's merely the result of a JReviews search, not a hard-coded "page" defined by a menu item - this is why I needed MetaMod in the first place. When the search results are returned, the URL will contain the city name, like so: /tag/city/norfolk/

To display the "image" module, I created a number of "mod_custom" modules containing the appropriate <img> tag for each city. I placed each module into a module position called "city-banner" (to make finding them easier) and then created a MetaMod module, positioned in my desired banner location. The MetaMod module contains the following code:

if ( $core_genius->check("uri contains idaho-falls") ) return 167;
elseif ( $core_genius->check("uri contains pocatello") ) return 176;
elseif ( $core_genius->check("uri contains nampa") ) return 177;
elseif ( $core_genius->check("uri contains boise") ) return 179;
elseif ( $core_genius->check("uri contains meridian") ) return 181;
elseif ( $core_genius->check("uri contains norfolk") ) return 183;
elseif ( $core_genius->check("uri contains chesapeake") ) return 185;

The Problem: This method worked perfectly until Norfolk. The first 5 lines work perfectly. Norfolk and Chesapeake image banners never show up, however, and I can't figure out why. Even stranger, the Norfolk image banner shows up on every page EXCEPT the correct one.

Any idea what I'm doing wrong? Is there a better way to code this?

Edited By: aboutimage
12-Oct-10 17:48:59

Beginner Modder
7 Posts
Administrator has disabled public posting

Re: Need Help With URL-Parsing Recipe

I figured out a solution, thought I can't say I understand the fix, nor the strange results I was previously seeing. Here is the solution: Make the URL search string longer. This is what I am using now (and it works):

if ( $core_genius->check("uri contains tag/city/idaho-falls") ) return 127;
elseif ( $core_genius->check("uri contains tag/city/pocatello") ) return 126;
elseif ( $core_genius->check("uri contains tag/city/nampa") ) return 127;
elseif ( $core_genius->check("uri contains tag/city/boise") ) return 129;
elseif ( $core_genius->check("uri contains tag/city/meridian") ) return 121;
elseif ( $core_genius->check("uri contains tag/city/norfolk") ) return 126;
elseif ( $core_genius->check("uri contains tag/city/chesapeake") ) return 128;

Of course, the numbers at the end are meaningless to you - they're my module position numbers.

Beginner Modder
7 Posts
Administrator has disabled public posting

Re: Need Help With URL-Parsing Recipe

Did you check to see if the original problem might have been the system cache plugin? Random errors like that are often the result of caching where you didn't want it.


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:

There are no members online

Forum Legend:

 New Sticky