Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Need Help With URL-Parsing Recipe
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?
12-Oct-10 18:48:59
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.
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.
Cheers,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » Need Help With URL-Parsing Recipe
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 7638
- Newest User:
- moner86658
- Members Online:
- 1
- Guests Online:
- 113
- Online:
- moner86658
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked