Page 1 of 1
templates based on FEU group
Posted: Fri Dec 15, 2006 5:23 pm
by jmcgin51
I want to change the layout, colors, or other template-controlled features of a page, based on the user's FrontEndUser id. I had thought that I could just create one giant master template file that will actually contain each desired template, with each template protected by appropriate CustomContent tags. Then I use the master template file on each page, and the CC tags ensure that the appropriate template is displayed to the appropriate users.
BUT, I can't protect stylesheets with CC tags, can I?
Is there a way to accomplish different page layouts based on the user's FEU id?
Re: templates based on FEU group
Posted: Fri Dec 15, 2006 5:45 pm
by cyberman
jmcgin51 wrote:
I had thought that I could just create one giant master template file that will actually contain each desired template,
Think the parsing of such an giant master template will eat too much of your server power.
BUT, I can't protect stylesheets with CC tags, can I?
One of possible ways could be:
Code: Select all
{cms_module module=CustomContent}
{if customcontent_loginname == 'member'}
{stylesheet name='member'}
{else}
{stylesheet name='guest'}
{/if}
Place this in head area (haven't tried yet).
If you read at modules help you will see the other way too

...
Re: templates based on FEU group [SOLVED]
Posted: Fri Dec 15, 2006 6:27 pm
by jmcgin51
thanks, Cyberman!
Re: templates based on FEU group
Posted: Fri Dec 15, 2006 6:31 pm
by calguy1000
Yes, this will work for the stylesheets, cyberman's syntax is a bit off, but it's close.
However, you'll want to use the latest and greatest SVN copy of CMS, or 1.0.3 when it comes out, as there's a bug fix in template caching that will cause you problems if you don't have it.
Re: templates based on FEU group
Posted: Fri Dec 15, 2006 6:34 pm
by jmcgin51
ok, thanks!
Re: templates based on FEU group
Posted: Fri Dec 15, 2006 7:44 pm
by cyberman
calguy1000 wrote:
cyberman's syntax is a bit off,
Please correct me - I'm not a coder for real. I've only tried to adapt the help

.
Re: templates based on FEU group
Posted: Fri Dec 15, 2006 11:30 pm
by calguy1000
This should work:
{cms_module module=CustomContent} <<-- Not needed/color]
Code: Select all
{if $customcontent_memberof_Users}
{stylesheet name='member'}
{else}
{stylesheet name='guest'}
{/if}
Actually, I think the {cms_module module=CustomContent} tag isn't needed at all any more.