New param required to display Image for Mobile/Tablet.

More
11 years 4 months ago #38703 by brandonking

ggppdk wrote: Hello,
thanks for suggestions / and code contribution

-- About system cache plugin i have not looked into a way to bypass it, maybe it is possible:

this plugin is great for speed and FLEXIcontent works smoothly with it (maybe you will not needed it once we fix performance of universal content module (soon)),
-- your options are
1. check if it is possible to do some check inside template index.php (does system plugin allow execution to reach this file i think yes , i have not checked ...)
2. hack the joomla cache plugin to include the mobile detect code ...
3. duplicate it and make a custom version of it ???


Just one thing about your changes , please read below:

i think one of your changes not best approach ...

-- You have added 2 more OPTIONS for parameters "popuptype", so far this is good

... but you added also a 3rd option "9" for autoselecting these when mobile client is detected, this not best approach, because you limit your choices to just 2 options ...

It is better to add 1 more LIST parameter called "popuptype_mobile" which will have the same OPTIONS as "popuptype" but also one more:

Code:
<option value="">Same as non-Mobile</option>
(notice that value is empty we will use strlen below)
so:
Code:
$popuptype = $field->parameters->get( 'popuptype', 1 ) ;
add:
Code:
$popuptype_mobile = $field->parameters->get( 'popuptype_mobile', '' ) ; if ($detect && strlen($popuptype_mobile)) $popuptype = $popuptype_mobile;

and then in your code replace:
Code:
!$detect && $popuptype == 9
with:
Code:
$usepopup && $popuptype == 7
and
Code:
$detect && $popuptype == 9
with:
Code:
$usepopup && $popuptype == 8

and now you can use ANY js image library for mobile

i will commit these changes ... in next commit

when you update to latest FLEXIcontent, just edit image field and set both 'popuptype' and 'popuptype_mobile'



Yeap, followed as you mentioned and just works like a charm!!
Thank you

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #38708 by ggppdk
Hello,

I tested the time required to execute the mobile detector and of course time is minimal e.g. on my dev pc is 0.006 seconds (that is regardless of how many times you call it because after 1st call the results are cached ...,
which is mostly some regular expression tests executed on rather small string,

consider that system plugin executed regular expressions on the full page text may take up to e.g. 1 second (e.g. jqueryeasy plugin is a great plugin but it is very costly ... e.g. can take up to 1 second on loaded server)


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.415 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline