413 reputation
1727
bio website
location
age
visits member for 3 years, 8 months
seen Jan 29 '12 at 6:17

I like lacrosse, hence my handle.


Sep
16
comment How Can I Access a PHP Variable in Another PHP Function
Awesome answer! Thank you very much for your kind help. I never would have thought of concatenating the js script in the $output. Thank you for mentioning the localize_script pitfall. I want to understand your solution thoroughly. As I understand it, this bit jQuery.noConflict(); jQuery(document).ready(function($) { } isn't needed? Do I need to worry about this script conflicting with other scripts? Multi-instance friendly: As long as I only have one lax-google-map shortcode per page, then it should work okay? As I understand it, it will only crash if I have multiple maps on one page.
Sep
16
comment How Can I Access a PHP Variable in Another PHP Function
Hi @Chip Bennett, I think that it's a WP question that concerns PHP. If it were straight PHP, I would just pass the $atts as a parameter in a new function as One Trick Pony suggested. But, I don't understand WP well enough to know how to break it out into another function when I've got this: add_action('init', 'lax_google_map_init'); and the wp_localize_script lines. It's a tough one. Thank you.
Sep
15
revised How Can I Access a PHP Variable in Another PHP Function
additional info
Sep
15
comment How Can I Access a PHP Variable in Another PHP Function
@One Trick Pony, Thank you for your message. How do I pass $atts as an argument when lax_google_map_init() is called by add_action('init'...)? I need the $atts in order to set the $params. I can't move $params into another function because I can't add a parameter to lax_google_map_init(). I'm a little stuck. Any suggestions? Thank you.
Sep
15
asked How Can I Access a PHP Variable in Another PHP Function
Sep
15
comment How Can I Pass the Shortcode's $atts Variable to the Plugin's Javascript Function
Hi @kaiser, Thank you for your very detailed solution. I'm still learning php/javascript (and unfortunately, I don't know anything about JSON). Yout skills are much more advanced than mine. I'll have to study your solution and the languages some more. I've updated my question a bit. If I use Toby's idea of using wp_localize_script, how can I pass $atts[latitude] from one php fucntion, lax_google_map_maker() function to the other php lax_google_map_init(). Thank you.
Sep
15
comment How Can I Pass the Shortcode's $atts Variable to the Plugin's Javascript Function
@Toby, Thank you for the suggestion Toby. I added some more info to my question. How do I pass the $atts[latitude] in lax_google_map_maker() to lax_google_map_init() in order to use it as a param for the javascript? Your suggestion works if I hard code the lat and long in php. I just need to figure out how to let the other function use the $atts values instead. Thank you.
Sep
15
revised How Can I Pass the Shortcode's $atts Variable to the Plugin's Javascript Function
additional info
Sep
15
comment How Can I Pass the Shortcode's $atts Variable to the Plugin's Javascript Function
Hi Maciej Kus, Thnak you very much for your solution. I didn't know about the -data prefix in HTML5. I learned something new. I made my example simple, but eventually, I would like to put lots of markers on the map, so I don't think that that marking up the div will work in my case. If you have other idea, I'd love to hear them. Thank you.
Sep
15
asked How Can I Pass the Shortcode's $atts Variable to the Plugin's Javascript Function
Sep
15
comment Problem Building a Simple Google Maps Plugin
@Brian Fegter, Thank you for your help.
Sep
15
accepted Problem Building a Simple Google Maps Plugin
Sep
15
comment Problem Building a Simple Google Maps Plugin
Hi @patnz, Thanks so much for your kind help. It works! I was able to move the add_shortcode line outside of the lax_google_init function. The problem might have been the css as you suggested or the jquery dependency. In any event, I'm stoked. Thank you!
Sep
15
comment Problem Building a Simple Google Maps Plugin
Hi @Brian Fegter, Thnak you for your comment. I'll combine the wp_enqueue_script calls as patnz suggested. I see the scripts in the browser view source and when I click on the script src they open. If you have other ideas, that I can try, I'd love to hear them. Thank you.
Sep
15
comment Problem Building a Simple Google Maps Plugin
Hi @patnz, thank you very much for your message. When I view the source code in the browser, I see the scripts and my map_canvas div. I'm using the Superb theme, which has a google maps shortcode. I thought that there might be a conflict, so I switched to the default theme, but no luck. I checked for JS errors in Firebug. There was one warning, but no errors. In Firebug, I see 200 as the result, except for one 204 for csi.gstatic/csi?v=2... I'm not sure what that is. Both themes have wp_head(). If you have other ideas, I'd love to hear them. Thank you!
Sep
14
asked Problem Building a Simple Google Maps Plugin
Sep
7
comment Do I Need to Prefix Variables Inside Functions?
Thank you for the detailed answer One Trick Pony. Awesome!
Sep
7
accepted Do I Need to Prefix Variables Inside Functions?
Sep
7
asked Do I Need to Prefix Variables Inside Functions?
Sep
3
asked wp_enqueue_style in Plugin