Elxis CMS Forum
Support => Elxis 4.x/5.x DEV => Topic started by: nikos on May 09, 2013, 13:29:45
-
I just saw the article Elxis for mobiles and tablets (https://www.elxis.net/docs/using-elxis/getting-started/elxis-mobile-tablet.html) and i would like to ask if in the same logic which is indicated for template (creating a mobile.php file) we have to follow in order to make mobile friendly and an extension (module, plugin). Are you going to write a relative article for developers?
-
No, you don't need to do so although you can if you want.
A module or a plugin is a small application you don't need special files. To display a mobile friendly version of it all you have to do is to check the value of the ELXIS_MOBILE constant and change your code (if needed).
if (ELXIS_MOBILE == 1) {
//display the mobile version
} else {
//display the desktop version
}
Most modules and plugins don't require changes in the HTML part.
By following a responsive design style you can create a good looking mobile version of your extension with just CSS without modifying the extension's code.
Example
.myext img { float:left; width:300px; }
@media only screen and (max-width:320px) {
.myext img { float:none; display:block; width:98%; }
}
You can use the max-width and the max-device-width properties for this purpose.