ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Skip" <s...@thedevers.org>
Subject RE: getting screen.width in ftl
Date Wed, 16 Jan 2013 22:04:24 GMT

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

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.


-----Original Message-----
From: Nick Rosser [mailto:nrosser@salmonllc.com]
Sent: Wednesday, January 16, 2013 12:56 PM
To: user@ofbiz.apache.org
Subject: Re: getting screen.width in ftl


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.


Best Regards,

Nick Rosser
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
> handheld devices.  Probably a better solution anyway.
> Skip
> -----Original Message-----
> From: Jacques Le Roux [mailto:jacques.le.roux@les7arts.com]
> Sent: Tuesday, January 15, 2013 1:59 PM
> To: user@ofbiz.apache.org
> Subject: Re: getting screen.width in ftl
> Look at files ending with js.ftl and how they are used
> Jacques
> From: "Skip"<skip@thedevers.org>
>> 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

View raw message