rejetto forum

Change template when logged in

0 Members and 2 Guests are viewing this topic.

Offline rscataran

  • Occasional poster
  • *
    • Posts: 4
    • View Profile
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

  • Tireless poster
  • ****
    • Posts: 910
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
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...
Files I have snagged and share can be found on my google drive:

https://drive.google.com/drive/folders/1qb4INX2pzsjmMT06YEIQk9Nv5jMu33tC?usp=sharing


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
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
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
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 »


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
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]





Offline rscataran

  • Occasional poster
  • *
    • Posts: 4
    • View Profile
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
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
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 »