rejetto forum

Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: rscataran on April 22, 2016, 05:12:29 AM

Title: Change template when logged in
Post by: rscataran on April 22, 2016, 05:12:29 AM
Good day,

I am very thankful for this great software.

Searching the forum if possible to change the template when the user logged in.

Currently investigating the hfs.events and load.tpl but I did not see the event that I needed.

The scenario I was hoping for would be like this:

-Upon opening HFS (anonymous), Template is Live 3.0.1
-Once logged in set the default template.

Cheers!


Title: Re: Change template when logged in
Post by: bmartino1 on April 22, 2016, 08:20:03 PM
it is, but it a bit trikey and has (as far as my knowledge) be done with redirects.
you would essentaily be hosting the same fodler twice adn the different tempate would be thte tempalte fo that folder.

whan the user logins, they would become redirected to the tempate, and teh links there can be edited.

Its messy and not a great way to do it, but it is possible...
Title: Re: Change template when logged in
Post by: rejetto on April 24, 2016, 10:48:05 PM
it should be possible with {.load tpl.}
since you want Live to be your base template, i would install it, but first i would save the default template to a file, so it can be loaded by the command above.

the event could be just [request]
and you should check %user% to know if people are logged in
like
Code: [Select]
[+request]
{.if|%user%|{: {.load tpl|myfile.tpl.} :}.}

in events.

I didn't try it, anyway.
Title: Re: Change template when logged in
Post by: rscataran on April 25, 2016, 07:48:02 AM
I did the [+request] instructions and it loads the default template as expected. But I think there is a slight difference on the page.

Here is a screenshot..

It seems the two column layout was gone.

Update:

Upon further checking, I also found out that some of the button on the Actions section was missing.
Title: Re: Change template when logged in
Post by: rscataran on October 26, 2016, 01:49:01 AM
This is the work around I did.

I set the default template in HFS.

then on the events I added

Code: [Select]
[+request]
{.load tpl|themes/Live-3.0.1.tpl.}
[+request]
{.if|%user%|{: {.load tpl|hfs.tpl.} :}.}

It seems that the default template needs to load first before using it in {.load tpl.} to get the correct effect.
Title: Re: Change template when logged in
Post by: Mars on October 26, 2016, 08:53:45 PM
it's not necessary to use events

you can use  the hfs.tpl as principal template

after the line contenting section [], insert only  those two lines

[]
{.load tpl|themes/Live-3.0.1.tpl.}
[loggedin]


Title: Re: Change template when logged in
Post by: rscataran on October 28, 2016, 02:21:06 AM
I tried what you suggested. I also thought that it would work.

But opening the page for the first time shows a blank white paget. Then, when I hit the refresh button, that's when the Live template will load correctly.

Any idea what's happening? I check the page source and its blank.
Title: Re: Change template when logged in
Post by: Mars on October 28, 2016, 03:26:49 PM
Add  your "themes" directory as a real subfolder into root of VFS, then change the properties to hidden recursively

I remember the rejetto solution that works properly with Internet Explorer, and  firefox 49.0.2

because you want the default template once the user is logged and the template LIve otherwise, here's how to do this

Quote
[+request]
{.if not|%user%|{: {.load tpl|themes/live.tpl.} :}.}