Change XSLT based on role [message #1351] |
Wed, 28 May 2008 11:53 |
cpscdave
Messages: 20 Registered: June 2006
|
Junior Member |
|
|
Is there a way you can change which xsl file is used base on what role the current user is?
I realize that we could add a check in the screen file but then we'd have to make changes to every screen file. Ideally it be nice if there is a way to tell the framework to use xsl_role1/std.list1.xsl if you're role1 or xsl_role2/std.list1.xsl if you're role2.
Any hooks in the framework that will allow this?
Thanks
|
|
|
|
|
Re: Change XSLT based on role [message #1354 is a reply to message #1353] |
Wed, 28 May 2008 18:43 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
If you want to change the 'look' of the output screens your first choice should really be use a different CSS file, as documented in http://www.tonymarston.net/php-mysql/cascading-style-sheets. html
If you really must switch to a different XSL file at runtme then this is possible. The contents of the screen structure file is read into a global variable called $structure at the start of each script, so its contents can be amended before being used to generate the HTML output. You will need to put code into each script similar to the following:
if ($_SESSION['role_id'] == 'whatever') }
$GLOBALS['structure']['xsl_file'] = 'whatever';
}
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|