Thursday 18 August 2005 5:18:06 pm
I would like to set a variable in pagelayout.tpl (at the very top of the template "tree") then access it anywhere in the following included templates. I have tried everything with set, let, def, namespaces, etc. I've been working on it for an hour, and I've read every shred of documentation. Global namespace or not, I simply cannot access a variable set in pagelayout.tpl from a deeply nested include. Can this be done? If so, does someone have some working code that shows it can be done? I've tried about every code sample I've found. (Specifically, I have some code at the top of pagelayout.tpl that checks if the current user is in the 'Administrators' group:
{let $currentUser = fetch( 'user', 'current_user' )}
{if $currentUser.role_id_list|contains( '2' )}
{def $is_admin=1}
{/if}
{/let}
There are several places in the templates below that where I want to use to decide whether to show or not show certain things. What I'm struggling with is to show or not show the class-specific pop-up menu in full.tpl. I don't want people not in the Admnistrators group to be able to access this menu.) Is there a better way to do this?
|