Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » One different picture in an article...
One different picture in an article depending on the country
One different picture in an article depending on the country
Hello,
I am using joomla 1.5.26 and last free version of metamod.
my question is simple bt i don't know if it is easy to achieve.
Here is an example of what i wish i could do :
let's say there are 2 pictures picture A and picture B.
Let's say if people are in UK they can see picture A in an article but they can't see the B.
If people are outside of UK they see picture B instead of the A in the same article.
I am just wondering if it is possible?
Thanks in advance and thanks again for this amazing extension.
EDIT: Seems like it's working with {loadposition x} inside an article which is a great thing. I managed to make visible or exclude a photo for only one country. But how to do both at the same time? I mean in 1 recipe photo A visible and photo B excluded, is it possible?
Finally i come back several jours later with some feedback, i just wanna say my bad because actually its working but not with non existing position of my template. loadposition doesn't work with it but works perfectly with any positions of my template which is not that bad but not so good because i really wanted to load those photos in the middle of an article.
24-May-12 17:34:38
Re: One different picture in an article depending on the country
Hi Meyloo,
I don't know why this would fail to work with module positions that are not in your template - that's strange.
Disregarding that for a moment, here's how I would approach this:
1 - set up your two image modules with the appropriate images. Set them to a module position that IS in your template, but keep them unpublished.
2 - download the GeoIP library from MaxMind, unzip it and put it into a folder in the root of your web folder called "geoip"
3 - set up a MetaMod in a module position that ISN'T in your template, e.g. "countryswitcher". Keep it PUBLISHED.
4 - in the MetaMod, turn on the GeoIP support for GeoLiteCountry
5 - in the MetaMod, use the following PHP code:
if ($fromCountryId == "GB") return XXX;
else return YYY;
// replace XXX with the module id to use for the UK image,
// and YYY with the module id to use for everyone else.
6 - in your article, use {loadposition switcher}
That should work!
Best regards,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » One different picture in an article...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Posts this week:
- 2
- User Info:
- Total Users:
- 7628
- Newest User:
- horlogekorting34
- Members Online:
- 0
- Guests Online:
- 103
- 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