changing to an 'admin' style template on login..

About the template and stylesheet - and changing the menu
kweku
Posts: 90
Joined: Sun Jan 18, 2009 3:37 pm

changing to an 'admin' style template on login..

Post by kweku » Wed Jan 28, 2009 12:04 am

hi
i would like to know if it is possible to have the template change once you are logged in, and only change back when you select the 'normal mode' button ( like preview mode )?

so basically, while you are logged in the template would maintain this ' back end' interface feel for all your admin management and only when you log out or press the 'normal mode' link should the template revert to the 'front end' main template.

the reason is i would like to create a more CMS style 'feel' when you are logged in, like joomla or cms made simple etc .
i know there is a function like 'template on the fly' which this is similar to . from a user point of view it really adds much more appeal to CMSimple - giving the actual site template a more ' front end ' feel. if you look at this CMS demo, you'll get an idea http://www.pluck-cms.org/?file=kop4.php

BTW: the structure and layout of all the admin elements does not need to change, only the template!

I eagerly await your replies!! :)

soduno
Posts: 2
Joined: Mon Jan 26, 2009 10:10 am

Re: changing to an 'admin' style template on login..

Post by soduno » Wed Jan 28, 2009 12:21 pm

well dunno if this helps, but if you wan't to style the top headlines in the login page,
you can write .edit (class stylesheet) and then type ex. font-family:arial, or font-size then something will happend :D

Holger
Site Admin
Posts: 3470
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: changing to an 'admin' style template on login..

Post by Holger » Wed Jan 28, 2009 12:54 pm

I don't know if it works in the template, but maybe this "change template on the fly" from the manual should do the job.
If so, I'll be happy to see your modificated backend ;) .

Try in top of your "frontend" - template:

Code: Select all

<?php
if ($adm && (!$normal)) {
    $cf['site']['template']="my_new_admin_template";
    $pth['folder']['template']=$pth['folder']['templates'].$cf['site']['template'].'/';
    $pth['file']['template']=$pth['folder']['template'].'template.htm';
    $pth['file']['stylesheet']=$pth['folder']['template'].'stylesheet.css';
    $pth['folder']['menubuttons']=$pth['folder']['template'].'menu/';
    $pth['folder']['templateimages']=$pth['folder']['template'].'images/';
}
?>
Change "my_new_admin_template" to the template-name of your choice.

Holger

kweku
Posts: 90
Joined: Sun Jan 18, 2009 3:37 pm

Re: changing to an 'admin' style template on login..

Post by kweku » Wed Jan 28, 2009 1:09 pm

Thank you Holger! i will try this and give a response when i have some results :)

kweku
Posts: 90
Joined: Sun Jan 18, 2009 3:37 pm

Re: changing to an 'admin' style template on login..

Post by kweku » Wed Jan 28, 2009 1:25 pm

Excellent! tHANK YOU Holger, my initial test with your code has proved successful. it works just as i had imagined.

it will take me a day or two to show a good working example.

when its ready i will send you a private message with login details so you can have a good look at the working example. :)

thanks again

Holger
Site Admin
Posts: 3470
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: changing to an 'admin' style template on login..

Post by Holger » Wed Jan 28, 2009 1:54 pm

kweku wrote:when its ready i will send you a private message with login details so you can have a good look at the working example. :)
That would be nice! Looking forward...

WBR

Holger

Till
Posts: 337
Joined: Tue May 20, 2008 7:20 am
Location: Germany: Bremen
Contact:

Re: changing to an 'admin' style template on login..

Post by Till » Thu Jan 29, 2009 7:54 am

Holger wrote:Try in top of your "frontend" - template:

Code: Select all

<?php
if ($adm && (!$normal)) {
    $cf['site']['template']="my_new_admin_template";
    $pth['folder']['template']=$pth['folder']['templates'].$cf['site']['template'].'/';
    $pth['file']['template']=$pth['folder']['template'].'template.htm';
    $pth['file']['stylesheet']=$pth['folder']['template'].'stylesheet.css';
    $pth['folder']['menubuttons']=$pth['folder']['template'].'menu/';
    $pth['folder']['templateimages']=$pth['folder']['template'].'images/';
}
?>
In my hands this code brings up a mixed template. It uses the "new" stylesheet.css but the "old" template.htm file.

Till

kweku
Posts: 90
Joined: Sun Jan 18, 2009 3:37 pm

Re: changing to an 'admin' style template on login..

Post by kweku » Thu Jan 29, 2009 7:59 am

you are right Till, just discovered that now...

the templates that i initialy tried out seemed to work well because they were using very similar stylesheets but as i found out with other templates that were quite different its not working :(

Holger
Site Admin
Posts: 3470
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: changing to an 'admin' style template on login..

Post by Holger » Thu Jan 29, 2009 8:21 am

You're right. As I said, I've not tested, sorry for that :? .
This "change template on the fly" from the manual can only run with CMSimple-Scripting, because scriping is executed before the template loads.

So, IMHO, the "simplest" way is to put the the front- and backend code in the same template.htm and put all your styles in the normal stylesheet.css.
By this way there's no need for a template-switch:

Code: Select all

<?php
if ($adm && (!$normal)) {
    
 // Complete code for Admin-Mode

   exit;
} 
else {

  // Code for the frontend

}
?>
Seems this solution is more CMSimple-like.
Any other "simple" ideas?

Holger

Edit: Or if you want to reuse yor admim-templates just include this file in your normal template.
Define your separate admin-CSS in your admin-template as usual with <link rel= ....>

Code: Select all

<?php
if ($adm && (!$normal)) {
    
   include('path/admin_template.htm');

   exit;
} 
else {

  // Code for the frontend

}
?>

kweku
Posts: 90
Joined: Sun Jan 18, 2009 3:37 pm

Re: changing to an 'admin' style template on login..

Post by kweku » Thu Jan 29, 2009 8:46 am

thanks Holger,

i will give both a try....

Post Reply