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.

 

[solved] Getting data from geoip

[solved] Getting data from geoip

I could create 40000+ modules with local weather coordinates and have metamod select module with ipcity user data. I am no pro at programming so this would be a solution. In the module it says:

You have access to the following PHP variables:
$geoip->latitude
$geoip->longitude
(the ones important to me)

I am assuming they are only available for the metamod only.
What would i need to do to make these values available in another module co i can get the coordinates from the data base direcly into the module fields?

I understand this is not a support issue for metamod, but any help would really be appreciated!

Regards,
Adrian

Edited By: metamodguy
29-May-13 21:45:50

adrianboogaard
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: [solved] Getting data from geoip

Hi Adrian,

Yes, you can make those values available to other modules. The easiest way is if the target module has parameters for longitude and latitude. i.e. when you edit the target module, if there are text fields for entering longitude and latitude.

See the page on Module Parameter control:

http://www.metamodpro.com/metamod/contr … parameters

you would end up doing something like this:

$target = XXX; // enter module id of the weather module
$changes->mod( $target )->setParam("longitude", $geoip->longitude);
$changes->mod( $target )->setParam("latitude", $geoip->latitude);
return $target;


This relies on the target module actually having parameters called "longitude" and "latitude". I don't know of any weather modules that do that... but perhaps you have one.

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
3329 Posts
User info in posts
Administrator has disabled public posting

Re: [solved] Getting data from geoip

Hey thanks for your time,

Here is what the module parameters are:

$lat = $params->get('lat', '40.43336');
$lon = $params->get('lon', '-3.717155');
$width = $params->get('width', '180px');
$height = $params->get('height', '250px');
$type = $params->get('type', 'ROADMAP');
$grados = $params->get('grados', 'CELCIUS');
$km = $params->get('km', 'KILOMETERS_PER_HOUR');

here is my metamodpro reciepe:
$target = 240; // enter module id of the weather module
$changes->mod( $target )->setParam("lon", $geoip->longitude);
$changes->mod( $target )->setParam("lat", $geoip->latitude);
return $target;

do you see anything wrong? Nope I don't either.

Works like a charm!!!!!!!!!!!!
Thank you so much.

How do I mark as solved?

adrianboogaard
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: [solved] Getting data from geoip

Great - well solved. This is a useful feature, isn't it?

I'll edit the post to change the title to solved.

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
3329 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1698
Total Polls:
6
Total Posts:
5944
Posts this week:
3
User Info:
 
Total Users:
5550
Newest User:
anjanarajput
Members Online:
0
Guests Online:
146

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