Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Google Maps API issues adding icons

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
drakos7
Smarty n00b


Joined: 12 Dec 2006
Posts: 2

PostPosted: Tue Dec 12, 2006 5:25 pm    Post subject: Google Maps API issues adding icons Reply with quote

In function getMapJS() I am getting a couple errors the first time through the icons loop when I am using addMarkerIcon. Line 907
Code:
if(!is_numeric($exist_icn[$icon_key])) {
                    $exist_icn[$icon_key] = $i;

Shouldn't the "is_numeric" be an "isset" instead? Otherwise it is trying to look up an undefined array element (the MD5 hash of the icon). By switching to "isset", one does not have to instantiate the $exist_icn either.


Also, using the firefox extension 'html validator' I found a lot of spots in the code where the closing tags sent to javascript should be escaped. But that is a minor issue.


Last edited by drakos7 on Tue Dec 12, 2006 5:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
drakos7
Smarty n00b


Joined: 12 Dec 2006
Posts: 2

PostPosted: Tue Dec 12, 2006 5:28 pm    Post subject: Reply with quote

I forgot to mention that in the same function
Code:
            for($i = 0; $this->_icons[$i]; $i++) {

generates an Undefined offset error also on line 902.
Back to top
View user's profile Send private message
nmweb
Smarty n00b


Joined: 29 Dec 2006
Posts: 2

PostPosted: Fri Dec 29, 2006 6:45 pm    Post subject: Reply with quote

drakos7 wrote:
I forgot to mention that in the same function
Code:
            for($i = 0; $this->_icons[$i]; $i++) {

generates an Undefined offset error also on line 902.


I fixed this by
Code:
for($i = 0; $i<count($this->_icons); $i++) {
putting this instead. Now the loop actually loops till he reaches the end of array $this->_icons.
Hope it helps anyone

edit: improved code
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7365
Location: Lincoln Nebraska, USA

PostPosted: Tue May 01, 2007 8:29 pm    Post subject: Reply with quote

These changes are committed to CVS, thanks!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP