Problem when using Dataface_Application_Menu.html

A place for users and developers of the Xataface to discuss and receive support.

Postby geller » Wed Nov 22, 2006 4:49 pm

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
geller
 
Posts: 26
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Wed Nov 22, 2006 5:33 pm

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby geller » Thu Nov 23, 2006 4:21 pm

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
geller
 
Posts: 26
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Nov 24, 2006 2:58 pm

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby geller » Sun Nov 26, 2006 3:57 pm

Cheers Steve thats done it.
geller
 
Posts: 26
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 16 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved