Author Topic: Change template when logged in  (Read 2945 times)

0 Members and 1 Guest are viewing this topic.

Offline rscataran

  • Occasional poster
  • *
  • Posts: 4
    • View Profile
Change template when logged in
« 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!



Offline bmartino1

  • Insane poster
  • *****
  • Posts: 776
  • I'm only trying to help i mean no offense.
    • View Profile
    • none - google translate
Re: Change template when logged in
« Reply #1 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...
I'm only trying to help i mean no offense.
thank you for your time and patience,
Bmartino1

Offline rejetto

  • Administrator
  • Insane programmer
  • *
  • Posts: 12851
    • View Profile
Re: Change template when logged in
« Reply #2 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.

Offline rscataran

  • Occasional poster
  • *
  • Posts: 4
    • View Profile
Re: Change template when logged in
« Reply #3 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.
« Last Edit: April 25, 2016, 11:53:29 PM by rscataran »

Offline rscataran

  • Occasional poster
  • *
  • Posts: 4
    • View Profile
Re: Change template when logged in
« Reply #4 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.
« Last Edit: October 26, 2016, 01:56:54 AM by rscataran »

Follow members gave a thank to your post:


Offline Mars

  • Operator
  • Insane poster
  • *****
  • Posts: 1819
    • View Profile
Re: Change template when logged in
« Reply #5 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]



FRENCH MEMBER : Si vous comprenez la langue française,  n'hésitez pas à l'utiliser pour une meilleure aide de ma part

Follow members gave a thank to your post:


Offline rscataran

  • Occasional poster
  • *
  • Posts: 4
    • View Profile
Re: Change template when logged in
« Reply #6 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.

Offline Mars

  • Operator
  • Insane poster
  • *****
  • Posts: 1819
    • View Profile
Re: Change template when logged in
« Reply #7 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.} :}.}
« Last Edit: October 28, 2016, 09:07:03 PM by Mars »
FRENCH MEMBER : Si vous comprenez la langue française,  n'hésitez pas à l'utiliser pour une meilleure aide de ma part