Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
Jamroom Developers:
Any way to use the jrGeoLocate mod within another mod?
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 09/13/09 00:17 
Is there a way to use the jrGeoLocate Module within another module? If so, any suggestions?

Back to top
smith.kyle
CodeSmith


Joined: 27 Apr 2006
Posts: 22009
Location: Southern California

Posted: 09/13/09 12:37 
At the template level you can, I'm not quite sure what you mean though.

Kyle


_________________
kyle[at]jamroom.net

Yes...that's a soda machine...

I get bored when no one's posting...
Back to top
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 09/13/09 20:53 
Well lets say I have a module that asks for event information, and one of the fields is event region, and its expecting something like Portland Oregon. I am looking for a way to place a default value to the form field, using the geoLocate module. Bu being able to use the geolocate module, it would sink up with one of my custom artist form fields that uses the geolocate module. Any Ideas?

Back to top
smith.kyle
CodeSmith


Joined: 27 Apr 2006
Posts: 22009
Location: Southern California

Posted: 09/14/09 14:34 
Hmm...I'm not sure - you might try looking for a way via smarty to check and see if a smarty function is present, and if it is, use it (of course, in your case looking for the jr_geolocate function). That might not work/be possible though, and you cannot bundle the jrGeoLocate module with your own module.

Kyle


_________________
kyle[at]jamroom.net

Yes...that's a soda machine...

I get bored when no one's posting...
Back to top
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 09/14/09 16:39 
Thanks for the reply Kyle,
I realize I can't bundle the geolocate module into my module but shouldn't I be able to add support for the geolocate module within my module? IE: check to see if the geolocate module is installed, and if so, make calls to its functions?

Back to top
smith.kyle
CodeSmith


Joined: 27 Apr 2006
Posts: 22009
Location: Southern California

Posted: 09/14/09 17:56 
Yes, but I think you'd have to do it at the template level. I'm not sure if there is already a way to do that via smarty, or if you'd have to build something.


_________________
kyle[at]jamroom.net

Yes...that's a soda machine...

I get bored when no one's posting...
Back to top
SteveX
Ultrabubble


Joined: 30 Aug 2005
Posts: 8792
Location: Ultrabubble

Posted: 09/15/09 02:48 
In your template you would be able to check the value of jr_geo_locate. But if you can't use it in that way you can make a new smarty plugin to check using function_exists.

function.uj_functionexists.php :

Code
<?php
function smarty_function_uj_functionexists($params,&$smarty)
{   
    $tmp = function_exists($params['function']);
    if (!empty($params['assign'])) {
        $smarty->assign($params['assign'],$tmp);
    } else {
        return($tmp);
    }   
}
?>


Then in your smarty template use it like this:

Code
{uj_functionexists function='jrGetGeoLocation' assign="geo_exists"}
{if $geo_exists == 1}
...Do your thing here...
{/if}



_________________
Kulshi Mezian!

"Stranger from another planet, welcome to our hole. Just strap on your guitar and we'll play some rock and roll"

Ultrabubble create things.
Back to top
Brian
Jamroom Team


Joined: 09 Jul 2003
Posts: 37583
Location: Seattle, WA

Posted: 09/15/09 13:37 
You can use the internal jrGeoLocate functions directly in your code - i.e.


Code

// jrGetGeoLocation returns an XML object containing the IP data
$xml = jrGetGeoLocation($jamroom['ip_address']);

// use jrXmlToArray to convert XML data to a PHP array
$array = jrXmlToArray($xml);


Hope this helps!

- Brian


_________________
Make sure and check out:
* The Jamroom FAQ
* The Jamroom Documentation
Back to top
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 09/15/09 19:05 
Thanks for all your help guys. If I sell my module and incuded support for the jrGeoLocate module, would I violating any licensing for the jrGeoLocate Module?

Back to top
Brian
Jamroom Team


Joined: 09 Jul 2003
Posts: 37583
Location: Seattle, WA

Posted: 09/16/09 10:33 

musiccreatures:
Thanks for all your help guys. If I sell my module and incuded support for the jrGeoLocate module, would I violating any licensing for the jrGeoLocate Module?


No - as long as you are simply referencing the functions, that's no problem. Your module will need to check to be sure the jrGeoLocate module has been installed on the user's system however, since it in effect becomes a requirement for your module.

Hope this helps!

- Brian


_________________
Make sure and check out:
* The Jamroom FAQ
* The Jamroom Documentation
Back to top
Display posts from previous:   
User Support Forum Archive (Read Only)
Jamroom Developers

 
Solutions
• Social Media Platform
• Social Networking Software
• Musician Website Manager
• Community Builder
Products
• Jamroom Core
• Jamroom Addons
• Jamroom Modules
• Jamroom Marketplace
Support
• Support Forum
• Documentation
• Support Center
• Contact Support
Community
• Community Forum
• Member Sites
• Developers
Company
• About Us
• Contact Us
• Privacy Policy
©2003 - 2010 Talldude Networks, LLC.