Jump to content

Recommended Posts

Posted

I have a number of pages which belong to countries. I've arrange the urls structure like this:

http://dmc.dudmc.com/region/europe/weichlein-tours-and-incentives/

I've purposely not included the region as a field in the page template as I new it would be hanging off the right branch or my url tree as above.

I've just got myself into a bit of a pick about how to access the segment 'europe' as a variable from other pages.

I'm trying to add it into this call:

    $items = $pages->find("template=dmc, DMC_map!='', sort=title");
    $map = $modules->get('MarkupGoogleMap');
    echo $map->render($items, 'DMC_map');

I'm calling this from the europe page to list on the map all child pages of the current page.

So i'm trying it like this:


$region = $page->title;
echo "<H3> you are looking in $region </H3>";



    $items = $pages->find("template=dmc, DMC_map!='', parent=$region,  sort=title");
    $map = $modules->get('MarkupGoogleMap');
    echo $map->render($items, 'DMC_map'); 

but it complains i've not escaped my selector?

Posted

I think I solved it; although i'm sure someone will be able to see far smarter way to achieve this:

$region = $page->title;
echo "<H3> you are looking in $region </H3>";



    $items = $pages->find("parent=/region/$region, template=dmc, DMC_map!=''  sort=title");
    $map = $modules->get('MarkupGoogleMap');
    
     if($items!=''){
	    echo $map->render($items, 'DMC_map', array('height' => '500px')); 
}
Posted

Which line is producing the "not escaped selector" message? Your $pages->find() is missing a comma between "DMC_map!=''" and "sort=title", but that's the only issue I can see. 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...