so we want to serve up a differnet element depending on the user's platform. has anyone tried this in zope? is a simple javascript the answer or is there a zope method to accomplish this? thanks, kyle http://www.newtimes.com
Here's some dtml I use for this purpose. It could probably be extended, but it works for me. <dtml-call "REQUEST.set('ua',HTTP_USER_AGENT)"> <dtml-if "_.string.find(ua,'MSIE') != -1"> <dtml-comment> Its MSIE </dtml-comment> <dtml-call "REQUEST.set('bMSIE',1)"> <dtml-if "_.string.find(ua,'MSIE 3.0') != -1"> <dtml-call "REQUEST.set('bMSIE3',1)"> </dtml-if> <dtml-call "REQUEST.set('iMSIE4',_.string.find(ua,'MSIE 4.0'))"> <dtml-if "iMSIE4 == -1"> <dtml-call "REQUEST.set('iMSIE4',_.None)"> </dtml-if> <dtml-if iMSIE4> <dtml-call "REQUEST.set('bMSIE4',1)"> </dtml-if> <dtml-if bMSIE4> <dtml-call "REQUEST.set('minorVer',ua[iMSIE4+8])"> <dtml-if bMSIE4> <dtml-if "minorVer == 'p' or minorVer == 'b'"> <dtml-call "REQUEST.set('bMSIE4_beta',1)"> </dtml-if> <dtml-if "minorVer == '1'"> <dtml-call "REQUEST.set('bMSIE4_01',1)"> </dtml-if> </dtml-if> </dtml-if> <dtml-if "_.string.find(ua,'MSIE 5') != -1"> <dtml-call "REQUEST.set('bMSIE5',1)"> </dtml-if> <dtml-else> <dtml-comment> Let's assume netscape </dtml-comment> <dtml-call "REQUEST.set('bNetscape',1)"> <dtml-if "ua[8] >= '4'"> <dtml-call "REQUEST.set('bNetscape_4',1)"> <dtml-elif "ua[8] >= '3'"> <dtml-call "REQUEST.set('bNetscape_3',1)"> <dtml-else> <dtml-call "REQUEST.set('bNetscape_2',1)"> </dtml-if> </dtml-if> HTH Phil phil.harris@zope.co.uk ----- Original Message ----- From: Kyle Burnett <kburnett@ep.newtimes.com> To: <zope@zope.org> Sent: Friday, December 17, 1999 12:31 AM Subject: [Zope] pc - vs - mac
so we want to serve up a differnet element depending on the user's platform.
has anyone tried this in zope? is a simple javascript the answer or is there a zope method to accomplish this?
thanks, kyle http://www.newtimes.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
on 12/16/1999 4:31 PM, Kyle Burnett at kburnett@ep.newtimes.com wrote:
so we want to serve up a differnet element depending on the user's platform.
Why double your workload? Creative and constructive design can yield a site that will work well on either platform, without the need for separate designs per platform. Besides, Mac or PC are not the sole platforms, and IE and Netscape aren't the only browsers. You'd need to consider Mac, PC, and Unix (at the very least), as well as Netscape/PC, MSIE/PC, Netscape/Mac, MSIE/Mac, iCab/Mac, Opera/Unix/Win, Mnemonic/Unix, etc... Bear in mind that MSIE/Mac and MSIE/Win work *VERY* differently in terms of what they support, or what they can display (hence, stay away from that idiotic PNG format, since MSIE/Mac doesn't support it.)
has anyone tried this in zope? is a simple javascript the answer or is there a zope method to accomplish this?
What specifically do you want to achieve by doing this? Generally, I would figure a JavaScript would be enough to do the arbitration, and then it could send the browser to one of several sites, each optimized for the specific browser. Since Zope generates the site dynamically, it *could* be easier to support this, since the content could conceivably remain the same, and the individual sites would just use browser specific templates... Sounds interesting, but it's still double the work - and for what? To validate MS' drive to divide and 'extend' a standard? Harry
Hello Kyle, Friday, December 17, 1999, 1:31:33 AM, you wrote: KB> so we want to serve up a differnet element depending on the user's platform. KB> has anyone tried this in zope? is a simple javascript the answer or is there KB> a zope method to accomplish this? I have done this by parsing the USER_AGENT variable. It (usually) tells you what browser, on what platform your visitor is using. There is as yet no Product or facility in Zope that does this for you. Volunteering? =) -- Best regards, Martijn Pieters mailto:mj@digicool.com
participants (4)
-
Harry -
Kyle Burnett -
Martijn Pieters -
Phil Harris