Hi David,
there is no built-in support, but you don't need to use separate URLs
either.
Since your templates don't contain any logic, you should be able to
just create an alternative, stripped-down layout for mobile phones.
If there are areas that don't have to display at all, but that are
being referenced inside your regular layout Java code, you can
surround them with a B tag so that they are simply not displayed in
the mobile version.
There are several ways of structuring this:
* using declarative precedence
With precedence, you can execute any element before on particular
element, a group or a subsite.
(http://rifers.org/wiki/display/RIFE/Precedence)
Using this, you can write a browser-detection element and instantiate
a template that is specific for the active browser and store it
inside a request attribute:
http://rifers.org/docs/api/com/uwyn/rife/engine/
ElementSupport.html#setRequestAttribute(java.lang.String,%
20java.lang.Object)
Instead of using getHtmlTemplate inside your successive elements, you
can then obtain the template from the request attributes:
http://rifers.org/docs/api/com/uwyn/rife/engine/
ElementSupport.html#getRequestAttribute(java.lang.String)
* using Java inheritance (this is my preferred approach)
You can simply create an extension of the Element class and for
example call it BrowserDetectionElement. There you overload the
getHtmlTemplate method and detect the browser there, adaptively
returning the template that's appropriate.
Alternatively, you can also leave the getHtmlTemplate alone and
implement the initialize() method inside your
BrowserDetectionElement, storing the appropriate template inside
member variable. You can then add a getter to retrieve that member
variable from your extending elements.
Hope this helps.
Best regards,
Geert
On 09 Dec 2006, at 06:17, David HM Spector wrote:
Hi,
Is there any built in support in RIFE for detection of what browser
the user is running? The 2nd stage of my app needs to run on
mobile phones.. of course we can have a special URL for a stripped
down page that displays correctly on web-enabled phones, etc, but
it would be nice to be able to do it automatically...
I didn't see anything in the web engine API, and the closest thing
I saw in the list archives was detection of the URL that was
presented to the engine by the user's browser.
regards,
David
----------------------------------------------------------------------
---------------------
David HM Spector
spector (at) zeitgeist.com
http://www.zeitgeist.com/
~ ~ ~
"New and stirring things are belittled because if they are not
belittled, the
humiliating question arises, 'Why then are you not taking part in
them?'"
--H. G. Wells
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users
--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users