Page 1 of 1

Calguys Google Maps 2 - Populating information window...

Posted: Wed Mar 21, 2018 2:42 pm
by naturelab
I am using Calguys Google Maps 2, and populating the information window dynamically with a simple link, using the code below.

It has stopped working, but I am pretty sure this was working previously, before a recent update. map is here

Code: Select all

http://www.orchardlink.org.uk/dev/growing-orchard-communities-project/about-the-sites/

Code: Select all

<!-- Create Map -->
{$children=cgsimple::get_children('about-the-sites')}
{foreach from=$children item='child'}
{if $child.show_in_menu}


{$maptitle=cgsimple::get_page_title($child.alias)}
{$popuptxt=cgsimple::get_page_content($child.alias)|truncate:40}
{page_attr page=$child.alias key="show_on_home" assign='showonhome'}

{cms_selflink page=$child.alias text="<strong>`$maptitle`</strong><br /><span>Read more &#9654;</span>" title="`$maptitle` - Read more" assign='maplink'}

{if $page_alias == $child.alias }
{assign var="icon" value='dd-end'}
{else}
{assign var="icon" value='OL_Marker'}
{/if}

{if !empty( {page_attr page=$child.alias key='latitude'}  )}
{cggm2_add_dynpoint map=1 name=$maptitle lat={page_attr page=$child.alias key='latitude'} long={page_attr page=$child.alias key='longitude'} desc="<h4>`$maplink`</h4>" icon=$icon }

 {/if}
{/if}
{/foreach}

{CGGoogleMaps2}

Code: Select all

----------------------------------------------

Cms Version: 2.2.6

Installed Modules:

    AdminSearch: 1.0.4
    CGBlog: 1.15.7
    CGContentUtils: 2.2.2
    CGExtensions: 1.60
    CGGoogleMaps2: 1.1.1
    CGSimpleSmarty: 2.1.8
    CGSnapshot: 1.3
    CMSContentManager: 1.1.6
    CMSMailer: 6.2.14
    CmsJobManager: 0.1.2
    DesignManager: 1.1.4
    FileManager: 1.6.5
    FilePicker: 1.0.2
    FormBuilder: 0.8.1.6
    Gallery: 2.3.2
    JQueryTools: 1.4.0.3
    MenuManager: 1.50.3
    MicroTiny: 2.2.2
    ModuleManager: 2.1.3
    Navigator: 1.0.8
    News: 2.51.3
    Search: 1.51.3
    Uploads: 1.25.8


Config Information:

    php_memory_limit:
    max_upload_size: 2000000
    url_rewriting: mod_rewrite
    page_extension: /
    query_var: page
    auto_alias_content: true
    locale:
    set_names: true
    timezone: Europe/London
    permissive_smarty: false


Php Information:

    phpversion: 5.6.34
    md5_function: On (True)
    json_function: On (True)
    gd_version: 2
    tempnam_function: On (True)
    magic_quotes_runtime: Off (False)
    E_ALL: 32767
    E_STRICT: 2048
    E_DEPRECATED: 8192
    test_file_timedifference: No time difference found
    test_db_timedifference: No time difference found
    create_dir_and_file: 1
    memory_limit: 128M
    max_execution_time: 30
    register_globals: Off (False)
    output_buffering: 4096
    disable_functions: symlink, dl, system, passthru, exec, shell_exec, escapeshellarg, escapeshellcmd, popen, posix_uname
    open_basedir:
    test_remote_url: Success
    file_uploads: On (True)
    post_max_size: 8M
    upload_max_filesize: 2M
    session_save_path: /tmp (0700)
    session_use_cookies: On (True)
    xml_function: On (True)
    xmlreader_class: On (True)
    check_ini_set: On (True)
    curl: On


Re: Calguys Google Maps 2 - Populating information window...

Posted: Thu Mar 22, 2018 1:11 pm
by naturelab

Re: Calguys Google Maps 2 - Populating information window...

Posted: Tue Mar 27, 2018 6:51 pm
by calguy1000
seems to be working fine now.

Re: Calguys Google Maps 2 - Populating information window...

Posted: Tue Mar 27, 2018 9:18 pm
by naturelab
No, it isn't for me.

Just to be clear, the links I am talking about are in the info window, which pops up on each map marker...

Does it work for you ? strange ?

Re: Calguys Google Maps 2 - Populating information window...

Posted: Wed Mar 28, 2018 11:46 am
by PinkElephant
Caveat: I don't use the module so I might be more off-track than usual...

The js bubbletext value looks over-escaped, or rather, it looks like an extraneous "\" at the start and end of the <a> element's attributes:

Code: Select all

{   "name"       :  "Ashmeadow_Community_Orchard",
    "position"   :  [50.40257,-3.66177],
    "icon"       :  "dd-end",
    "title"      :  "Ashmeadow Community Orchard",
    "tooltip"    :  "Ashmeadow Community Orchard",
    "bubbletext" :  "<h4><a href=\\\"https:\/\/www.orchardlink.org.uk\/dev\/growing-orchard-communities-project\/about-the-sites\/ashmeadow-community-orchard\/\\\"
                    title=\\\"Ashmeadow Community Orchard - Read more\\\" ><strong>Ashmeadow Community Orchard<\/strong><br \/><span>Read more &#9654;<\/span><\/a><\/h4>"
},
I'm assuming the value arrives via the map's `desc` value:

Code: Select all

desc="<h4>`$maplink`</h4>"
where $maplink is

Code: Select all

{cms_selflink page=$child.alias text="<strong>`$maptitle`</strong><br /><span>Read more &#9654;</span>" title="`$maptitle` - Read more"}
I'm not sure if or where the encoding is tripping up but have you tried without the two sets of `backticks`? Either way, it could be useful to get the loop to print the value of $maplink before it's passed to the map, e.g:

Code: Select all

{$latitude = {page_attr page=$child.alias key='latitude'}}
{if !empty($latitude)}
	<!-- DEBUG $maplink: {$maplink} -->
	{cggm2_add_dynpoint map=1 name=$maptitle lat={$latitude} long={page_attr page=$child.alias key='longitude'} desc="<h4>`$maplink`</h4>" icon=$icon}
{/if}

Re: Calguys Google Maps 2 - Populating information window...

Posted: Wed Mar 28, 2018 12:01 pm
by naturelab
Thankyou so much for your time on this !

What you were suggesting is the first route I went down, however, if I simply print

Code: Select all

<h3>{$maplink}</h3>
Then you can see that the links are perfectly formed at this stage.
It is not until they are placed into the Map module that the issue occurs.

Re: Calguys Google Maps 2 - Populating information window...

Posted: Wed Mar 28, 2018 12:27 pm
by calguy1000
If it is just an escaping issue... I would not use {cms_selflink page=whatever} but {cms_selflink href=whatever} and build the links myself.

And watch the use of backticks.

Re: Calguys Google Maps 2 - Populating information window...

Posted: Wed Mar 28, 2018 3:10 pm
by naturelab
Thanks for the pointers chaps !
Fixed it :-* !

Code: Select all

<!-- Create Map -->
{$children=cgsimple::get_children('about-the-sites')}
{foreach from=$children item='child'}
{if $child.show_in_menu}


{$maptitle=cgsimple::get_page_title($child.alias)}
{$popuptxt=cgsimple::get_page_content($child.alias)|truncate:40}
{page_attr page=$child.alias key="show_on_home" assign='showonhome'}

{cms_selflink href=$child.alias assign='maplink'}
{$mapdesc="<h3><a href=$maplink title=$maptitle>{$maptitle}<br /><span style='white-space:nowrap'>Read more &#9654;</span></a></3>" }

{if $page_alias == $child.alias }
{assign var="icon" value='dd-end'}
{else}
{assign var="icon" value='OL_Marker'}
{/if}

{if !empty( {page_attr page=$child.alias key='latitude'}  )}
{cggm2_add_dynpoint map=1 name=$maptitle lat={page_attr page=$child.alias key='latitude'} long={page_attr page=$child.alias key='longitude'} desc=$mapdesc icon=$icon }

 {/if}
{/if}
{/foreach}

{CGGoogleMaps2}