Wednesday, October 29, 2008

eZtip: Get the current siteaccess from template

I'm currently working on a multilingual site and had to use the name of the siteaccess in the template code. Easy I thought...well it took quite a while to find.

From http://ez.no/doc/ez_publish/technical_manual/4_0/templates/the_pagelayout/variables_in_pagelayout

VariableTypeDescription
$access_typearrayThe name of the siteaccess (as "name") and the ID number (as "type") of the access method that was used (1=URL, 2=Host, 3=Port).


Adding {$access_type|attribute(show,2)} to the pagelayout.tpl template will give the following:

name string 'ezwebin_site'
type integer 2


The siteaccess used to serve the current page is accessible via $access_type.name

2 comments:

  1. It would have taken a while to me if I didn't found your blog, thanks a lot !

    ReplyDelete