Forums / Developer / Calling a ezurl from inside a template

Calling a ezurl from inside a template

Author Message

Kedar Deshpande

Thursday 18 February 2010 10:49:04 am

Hi, I have override templates for different classes and what I need to do is call a complete ezurl (localhost/cms/index.php/manage/People/John) from within a City override tpl. In other words, when I send in the URL for City (localhost/cms/index.php/manage/Town/Paris), somewhere in there I want to call the link for John which will then drop in the content generated from his own override template.

Thanks.

Gaetano Giunta

Friday 19 February 2010 1:09:28 am

Many solutions are available:

  • if the city node does not exist, you can set up an url alias for the person node
  • even if the city node does exist, set up an url alias for the person node (url aliases are taken into account before node urls). This might have the side effect of changing the url for the city though
  • fetch in the city template the person node, use its .url_alias attribute and do a redirect to it. Since redirects are better done from within the pagelayout, you can use the persistent_variable to pass the new url from the node template to the pagelayout. In the pagelayout you can output an html meta redirect tag, or you can create your own http_header template operator that will do a real http redirect
  • fetch in the city template the person node and use content_view_gui to display its template, without doing a redirect

Principal Consultant International Business
Member of the Community Project Board

Kedar Deshpande

Friday 19 February 2010 8:47:13 am

Thank you Gaetano for giving such a detailed reply. This really helps, appreciate it.