what skip mentioned is also interesting...especially the java script files and pictures make about 1MB download size for the client. with mobile devices this is much.
so what I would do is: create a landing page where you just request the kind of device from client (desktop, mobile etc.) or the browser size as nick mentioned. within FTL it is not possible (without Java script), because this is server side. So you have to decide on client side what to do (reason for the landing page). on client side just check with like java script if he uses a mobile device. Than redirect the client to i.ex a subdomain (i.ex. m.domain.tld instead of www.domain.tld). this subdomains just uses other screens, or handle it maybe with properties in screens / session / groovy files. I would create a completely new website for mobile, because most of the time it is completly different, so you need to use other css and js files to reduce the bandwith requirements. you as addition can use the same ftl and groovy files (to have better overview about all files), and just check the session if he is a mobile...than do these checks in groovy and ftl, so at the end of the day you just load parts of these ftl files. for the javascript check build a door to your server session object with an ajax call, which lands on a i.ex. java file which writes attributes to session. with this procedure you can check on serverside the device state and other variables you want to set from client side. kindly robert Mit freundlichen Grüßen Dipl.-Ing. Robert Gan Geschäftsführer Mercon GbR Lückstr. 72/73 D-10317 Berlin (Berlin-Lichtenberg) Email: [email protected] Tel: +49 (30) 54785060 Fax: +49 (30) 69207219 www.mercon24.de Am 16.01.2013 23:43, schrieb Nick Rosser [via OFBiz]: > good luck! > > Best Regards, > > Nick Rosser > [hidden email] </user/SendEmail.jtp?type=node&node=4638965&i=0> > O: 516.742.7888 x221 > C: 516.901.1720 > > > On 1/16/2013 5:04 PM, Skip wrote: > > > Nick > > > > Thanks for the link. This is essentially what I did except that I > did not > > have any small device specific content. However, what I wanted to > do was > > just not render the content in the ftl to reduce the bandwidth > requirements. > > A considerable amount of the hidden content on small devices were > images and > > it would have been nice to not have it at all. > > > > For example: > > > > <#assign screenWidth = context.screenWidth?default(2000) /> > > > > <#if screenWidth> 499> > > ... Render some context that might be useful but not required > > </#if> > > > > I am exploring how to do this by having an ajax call that sets the > device > > width into the context and then subsiquent pages can be smarter in > their > > rendering. However, what I have now works much like yours and is > sufficient > > for now. > > > > Skip > > > > > > -----Original Message----- > > From: Nick Rosser [mailto:[hidden email] > </user/SendEmail.jtp?type=node&node=4638965&i=1>] > > Sent: Wednesday, January 16, 2013 12:56 PM > > To: [hidden email] </user/SendEmail.jtp?type=node&node=4638965&i=2> > > Subject: Re: getting screen.width in ftl > > > > > > Skip, > > > > We have a pretty good way of doing this in our BigFish eCommerce > > solution. Obviously the entire approach is not applicable for what you > > are trying to do but you may want to read the guide that we have ... it > > has some good general pointers that may be useful for you. > > > > http://bigfish.salmonllc.com/help/howSetupMobile.htm > > > > Best Regards, > > > > Nick Rosser > > [hidden email] </user/SendEmail.jtp?type=node&node=4638965&i=3> > > O: 516.742.7888 x221 > > C: 516.901.1720 > > > > > > On 1/15/2013 7:47 PM, Skip wrote: > >> Nothing much in these about getting screen width for use in the > ftl. Was > >> expecting that to be in the session of something. Saw some jquery > setting > >> of form widths, but I wanted to do this in FTL before the screen > html code > >> is rendered. > >> > >> However, got it done with CSS media query like this: > >> > >> @media handheld, only screen and (max-width: 800px){ > >> .notRequired {display: none !important;} > >> } > >> > >> by adding a notRequired class to all the elements I did not want to > show > > on > >> handheld devices. Probably a better solution anyway. > >> > >> Skip > >> > >> -----Original Message----- > >> From: Jacques Le Roux [mailto:[hidden email] > </user/SendEmail.jtp?type=node&node=4638965&i=4>] > >> Sent: Tuesday, January 15, 2013 1:59 PM > >> To: [hidden email] </user/SendEmail.jtp?type=node&node=4638965&i=5> > >> Subject: Re: getting screen.width in ftl > >> > >> > >> Look at files ending with js.ftl and how they are used > >> > >> Jacques > >> > >> From: "Skip"<[hidden email] > </user/SendEmail.jtp?type=node&node=4638965&i=6>> > >>> I am trying to make some ftl code look better on cell phones without > >>> sacrificing the look on desktops. > >>> > >>> I can remove some non-critical content in the ftl if I knew the > screen > >> width > >>> was less than a certain value. Can I get screen.width in a bash > (groovy) > >>> script or in the ftl? > >>> > >>> Its obviously easy in javascript, but I need to get it in the ftl > code. > >>> > >>> > >>> Thanks in advance > >>> > >>> Skip > >>> > > > ------------------------------------------------------------------------ > If you reply to this email, your message will be added to the > discussion below: > http://ofbiz.135035.n4.nabble.com/getting-screen-width-in-ftl-tp4638951p4638965.html > > > To start a new topic under OFBiz - User, email > [email protected] > To unsubscribe from OFBiz - User, click here > <http://ofbiz.135035.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=135036&code=Z2FuQG1lcmNvbjI0LmRlfDEzNTAzNnwxMDI0Mzk5ODc1>. > NAML > <http://ofbiz.135035.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > > -- View this message in context: http://ofbiz.135035.n4.nabble.com/getting-screen-width-in-ftl-tp4638951p4638966.html Sent from the OFBiz - User mailing list archive at Nabble.com.
