Page 1 of 1

PostPosted: Wed Nov 22, 2006 4:49 pm
by geller
I am wanting to use a unique 'Dataface_Application_Menu.html' file for each user. The problem is that it appears that this file persists in the template_c/default directory. I belive that it is a compile issue within the 'smarty templates'.

Is there a way to force this file to be re-compiled for each user or deleted or some other solution?

Any help appreciated
Graham

PostPosted: Wed Nov 22, 2006 5:33 pm
by shannah
Hi Graham,

This file is a Smarty template, meaning that it can do dynamic things. If you want something different to be displayed for different users, perhaps adding some if/else clauses to decide what to display inside the Dataface_Application_Menu.html file. E.g.:

Code: Select all



Or if you want to keep john and susan's menu in separate files you could do:

Code: Select all
{if $ENV.username == 'John'}
    {include file="John-menu.html"}
{elseif $ENV.username == 'Sue'}
    {include file="Sue-menu.html"}
{/if}


Then you would add templates named "John-menu.html" and "Sue-menu.html" to your templates directory.

Or, perhaps you want to make something a little more extensible, and have files included with the naming convention "%username%_menu.html" so that John's menu would be stored in a template named "john_menu.html" and Sue's menu would be stored in a template named "sue_menu.html", etc... You could do something like:

Code: Select all
{include file="`$ENV.username`_menu.html"}


Hope this helps a little.

-Steve

PostPosted: Thu Nov 23, 2006 4:21 pm
by geller
Hi Steve

As usual you are 'on the ball' I have tried the 3rd option and that will work fine but for one issue. When accessing the login page, before logging in, there is a smarty error ( because there is no username yet! I presume)

{include file="`$ENV.username`.inc"}

Smarty error: unable to read resource: ".inc" in /httpdocs/dataface-build/lib/Smarty/Smarty.class.php on line 1088.

Can this error message be supressed or could an alternative login page be used and then load the application_dataface_menu.html after login?

Cheers
Graham

PostPosted: Fri Nov 24, 2006 2:58 pm
by shannah
Hi Graham,

Wrap your menu in an If statement to avoid this:

Code: Select all
{if $ENV.username}
    {include file="`$ENV.username`.inc"}
{/if}



-Steve

PostPosted: Sun Nov 26, 2006 3:57 pm
by geller
Cheers Steve thats done it.