rejetto forum

Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: etherknight on October 04, 2010, 02:24:03 AM

Title: Multiple templates (based on browser)
Post by: etherknight on October 04, 2010, 02:24:03 AM
Can one configure so as to present a particular templates based on the browser family? For example, one connects with an iPhone and they get the iPhone template. But another user connects with a traditional browser, and gets the typical template. Perhaps it could be done by running multiple instances of HFS, using two URLs? Like www.whatever.stuff & mobile.whatever.stuff for mobile browser families...

My apologies if this is one of the gazillion questions that have already been discussed (could not find the topic in search).
Title: Re: Multiple templates (based on browser)
Post by: rejetto on October 10, 2010, 04:25:06 PM
yes, it's possible.
i'll tell you more when i'm back home.
Title: Re: Multiple templates (based on browser)
Post by: rejetto on October 10, 2010, 09:31:05 PM
there's no need for a different address.
probably the best solution is to ALT+F6 and paste something like this

[+request]
{.if|{.{.get|agent.} = iphone.}|{:
  {.load tpl|myOtherTemplate.tpl .}
:}.}
Title: Re: Multiple templates (based on browser)
Post by: etherknight on October 10, 2010, 10:54:47 PM
Sweet. I will give it a try. I will let you know how it goes! Thanks :)
Title: Re: Multiple templates (based on browser)
Post by: rejetto on October 11, 2010, 12:40:21 AM
just a warning: the "load tpl" command won't run any installation on the template.
some templates may need to perform some actions at installation time, like rawr.
Title: Re: Multiple templates (based on browser)
Post by: Onoitsu2 on February 09, 2011, 11:10:16 PM
With regards to mobile devices, as far as blackberry devices, or at very least the BB Curve 9330 uploads fail quite often. Looks like
they simply timeout but once changed the default template upload link to load with the upload status pane have not had any uploads fail. And we are talking failures amounting to >75%. And now I can upload the entire listing with pics and vids. I use HFS for remote access of my files. No data plan so I am one that uses wifi and has every wifi work around imaginable. This failure was in the BB browser, Opera Mini 5.1.22303, as well as Bolt browser. I've set up MIME just right that I can stream mp3 and BB compatable videos, of which I have few.Absolutely LOVE!!! This software using 2.2f because it gets the job done for what I needed.

In fact this was posted from my BB in Bolt browser.
Title: Re: Multiple templates (based on browser)
Post by: rejetto on February 10, 2011, 10:49:23 PM
good to hear it works for you.
what was discussed here before it's only related to version 2.3, anyway.
Title: Re: Multiple templates (based on browser)
Post by: stonecooper on August 13, 2011, 01:47:08 AM
Could someone explain more detail. How do I know the agent = iphone? If I use a Andriod device, how to set it?

 {.load tpl|myOtherTemplate.tpl .}

Does the myOtherTemplate.tpl  can include the path? Like ./mytmp/myOtherTemplate.tpl?

I used my Andriod device to do the test, from the dump log:
User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; zh-cn; Desire_A8181 Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1

how to set this Marco?
Title: Re: Multiple templates (based on browser)
Post by: rejetto on August 22, 2011, 03:53:16 PM
the {.get|agent.} is a facility that currently doesn't support android.
anyway you can use something like
{.if|{.pos|android|{.header|User-Agent.}.}|{:
  {.load tpl|myOtherTemplate.tpl .}
:}.}


and yes, you can use a full path for the file
Title: Re: Multiple templates (based on browser)
Post by: BobS!nce1981 on September 05, 2011, 09:51:14 PM
Help please. Do I need to include another string by chance? Its loading the .tpl as I have specified the full path, but the images and whatnot that go with the theme aren't showing up.

Thanks,

Bob
Title: Re: Multiple templates (based on browser)
Post by: rejetto on September 17, 2011, 05:43:33 PM
welcome and sorry for the late reply bob,
some templates need you to manually load them first, because this way the run some commands (a sort of installation procedure) like adding needed folders.

after that you should be ok.
Title: Re: Multiple templates (based on browser)
Post by: BobS!nce1981 on September 19, 2011, 12:16:49 PM
Ok.  Sorry to ask, but how do i do that?

Thanks.
Title: Re: Multiple templates (based on browser)
Post by: Mars on September 19, 2011, 12:26:57 PM
you can see inside the RAWR-Designs template: section SPECIAL IMPORT

Title: Re: Multiple templates (based on browser)
Post by: rejetto on October 04, 2011, 09:39:01 AM
it's ok if you just drag&drop the .TPL file into HFS.
you will be prompted for installation.
This requires to be done just once (but you have to save the virtual file system afterward).
Title: Re: Multiple templates (based on browser)
Post by: MelkiyProd. on March 31, 2012, 07:21:27 PM
it's ok if you just drag&drop the .TPL file into HFS.
you will be prompted for installation.
This requires to be done just once (but you have to save the virtual file system afterward).

I can add to template - my mobile template and use his through android?
If i will open site through android, will used mobile template?
Title: Re: Multiple templates (based on browser)
Post by: rejetto on April 03, 2012, 07:41:26 PM
it depends on how you "add" it.
try the method suggested above
Title: Re: Multiple templates (based on browser)
Post by: hihihi123hk on April 08, 2012, 06:35:54 AM
Can I have two RAWR template to switch??

one for  ipad/iphone

one for normal window

I try the above code but  it can't load it
Title: Re: Multiple templates (based on browser)
Post by: rejetto on April 15, 2012, 01:03:07 PM
if you want multiple templates you have to read the rest, not just the my last answer

http://www.rejetto.com/forum/index.php/topic,9166.msg1052455.html#msg1052455
Title: Re: Multiple templates (based on browser)
Post by: nooy on August 08, 2013, 12:45:21 PM
the {.get|agent.} is a facility that currently doesn't support android.
anyway you can use something like
{.if|{.pos|android|{.header|User-Agent.}.}|{:
  {.load tpl|myOtherTemplate.tpl .}
:}.}


and yes, you can use a full path for the file


Please show an example of how and where to insert this code.
If it should be inserted in the TPL - please show by example. I do not understand where to insert it.
And another question: Can I do that with the browser loads a template from another iphone on the third Android device? Or at least two options, one for browser on a computer, the other on mobile
Title: Re: Multiple templates (based on browser)
Post by: rejetto on August 16, 2013, 09:29:07 PM
you can repeat the thing and get how many templates you want.

How to use it was explained here

probably the best solution is to ALT+F6 and paste something like this

[+request]
{.if|{.{.get|agent.} = iphone.}|{:
  {.load tpl|myOtherTemplate.tpl .}
:}.}
Title: Re: Multiple templates (based on browser)
Post by: nooy on August 21, 2013, 07:38:54 PM
you can repeat the thing and get how many templates you want.

How to use it was explained here
:(

I need that with a computer's browser opened a template for example terayon, and when coming from mobile devices and iphone andoid opened PABP such as a template.

How to do it?

I have read this entire post.

That's what I do:
I go to the HFS click ALT + F6 opens the file:

insert:

{. if | {. pos | android | {. header | User-Agent.}.} | {:
   {. load tpl | http://liners.com/imig/mobail.tpl.}
:}.}

template does not work on mobile devices

What I doing wrong?

how to insert into one HFS two templates? One for mobile devices. another for desktop computers?
Is that even possible? Or should we open two HFS program?
Title: Re: Multiple templates (based on browser)
Post by: rejetto on August 24, 2013, 11:59:22 AM
1. you didn't paste the whole text, missing one line
2. you shouldn't load the template from the net, that's damn slow. Download it on your computer first.
Title: Re: Multiple templates (based on browser)
Post by: nooy on August 27, 2013, 05:34:44 PM
1. you didn't paste the whole text, missing one line
2. you shouldn't load the template from the net, that's damn slow. Download it on your computer first.

That's what I do:
I go to the HFS click ALT + F6 opens the file:

That's what I put in - so, too, does not work  :( (*does not load the template on your mobile device)

[+request]
{.if|{.pos|android|{.header|User-Agent.}.}|
{:{.load tpl|mytempleate-1.1.tpl .}:}.}

Show how to write?
Title: Re: Multiple templates (based on browser)
Post by: Mars on September 18, 2013, 07:27:58 PM
if your template mytempleate-1.1.tpl is  not in the same folder as HFS.EXE,

then you have to put an entire valid path for it, as

[+request]
{.if|{.pos|android|{.header|User-Agent.}.}|
{:{.load tpl|c:\hfs\mytempleate-1.1.tpl .}:}.}
Title: Re: Multiple templates (based on browser)
Post by: MelkiyProd. on March 08, 2014, 07:53:08 PM
I've done the same in "event" -
Code: [Select]
[+request]
{.if|{.pos|iPhone|{.header|User-Agent.}.}|
{:{.load tpl|d:\Server\mobile\iPhone\iPhone.tpl .}:}.}

Everything works, but why if I add new page, for example [not found] - doesn't work? But [not found] page works from main template. Help plz
Title: Re: Multiple templates (based on browser)
Post by: rejetto on March 10, 2014, 01:14:04 AM
thanks for reporting.
if you don't want to wait for the day a new version is officially published ou can find a temp version at http://ge.tt/4NZ1LjP1/v/0
Title: Re: Multiple templates (based on browser)
Post by: MelkiyProd. on March 11, 2014, 01:36:12 PM
thanks for reporting.
if you don't want to wait for the day a new version is officially published ou can find a temp version at http://ge.tt/4NZ1LjP1/v/0

nice  :) But these pages (not found, deny, overload...etc) load css from the main template, others normally works  :)
Title: Re: Multiple templates (based on browser)
Post by: rejetto on March 11, 2014, 11:14:42 PM
you mean it doesn't work?
Title: Re: Multiple templates (based on browser)
Post by: MelkiyProd. on March 12, 2014, 09:43:48 PM
As I know these pages created in new template must be without design.
I mean if I write

Code: [Select]
[Not found]
Test

that page must have only text, but my second template automatically loads css from main template and I think so should not be.
If I'm wrong, sorry  :)
Title: Re: Multiple templates (based on browser)
Post by: rejetto on March 15, 2014, 12:01:24 AM
i know what you mean.
i was undecided about it, because both ways make sense.
for now i opted for this way, to keep the old template living under the one you load, because you can always override it.
In your case, that happens because you didn't define [error-page]
try!
Title: Re: Multiple templates (based on browser)
Post by: rejetto on March 29, 2014, 09:18:41 PM
some posts moved here
http://www.rejetto.com/forum/programmers-corner/add-folders/