Hi.

--On 12/31/00 13:04:04 +0100 [EMAIL PROTECTED] wrote:
> I would like to know if it is possible for Midgard to handle more
> then  one layout for one page? I have to use one layout for
> Netscape4, IE4  one layout for Version 3 and one layout for
> text-browser. But every  browser should see the same file at the same
> location like the other  browser. I dont like a structure like > 
>domain.com/newbrowser/index.html
> domain.com/oldbrowser/index.html
> domain.com/textbrowser/index.html
This is no problem, you have to use a little trick though. This
solution was on the list earlier and I adopted it for my page where it
works fine:

You need to define only one style for the whole thing. The basic
problem is, that Midgard can't change the applied style on runtime. So
you have to implement this change.

Normally you'd include any style elements you'd need directly into the
ROOT Element of the style. The dynamic Styles require a little change
there. Here's my ROOT Element:

---<[ROOT]>---
<?
switch($style) {
  case 1:
    ?><[ROOT-oldbrowser]><?
    break;
  case 2:
    ?><[ROOT-newbroser]><?
    break;
  case 3:
    ?><[ROOT-textbrowser]><?
    break;
}
?>
---<[ROOT]>---

The trick is to define multiple styles within one style. My real style
definitions start at ROOT-whatever not at ROOT directly. The variable
Style is defined in code-global. Of course you cold determine it
directly in the ROOT Style. Which you can do however you like. In your
case you'd have to evaluate the environment Variable HTTP_USER_AGENT. 
In your code-global (alternativly in the style itself) you could use
something like this to set the right style:

---<[code-global]>---
  $browser = getenv("HTTP_USER_AGENT");

  if ( eregi("lynx", $broswer) )
     style = 3;
  elseif ...
  elseif ...
---<[code-global]>---


Live long and prosper!
Torben Nehmer

-- ICQ-ID : 14148813 -�- E-Mail : [EMAIL PROTECTED]
WWW    : http://www.nathan-syntronics.de --- http://www.nehmer.net



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to