#1027 - Showing different content to mobile users
| Identifier | #1027 |
|---|---|
| Issue type | Feature request or suggestion |
| Title | Showing different content to mobile users |
| Status | Closed (rejected) |
| Handling member | Deleted |
| Addon | General / Uncategorised |
| Description | New tutorial.
You basically just do this... {+START,IF,{$MOBILE}} Mobile content! {+END} {+START,IF,{$NOT,{$MOBILE}}} Desktop content! {+END} |
| Steps to reproduce | |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".


Comments
Follow these steps to enable this feature:
* Open the page in Composr, in which we need to enable this feature. Press the “Edit this page” link in the bottom of the page. (image_001.png)
* We can make changes to the template in the built-in editor of the “Edit” page.
* Add the following “Tempcode” to the template file:
{+START,IF,{$MOBILE}}
Mobile content!
{+END}
* Replace the “Mobile content!” with the content to be shown for the mobile users.
* For showing different content to desktop users, use the following “Tempcode” in the template file:
{+START,IF,{$NOT,{$MOBILE}}}
Desktop content!
{+END}
* Replace the “Desktop content!” with the content to be shown for the desktop users.
Code explanation
------------------------------
The line {+START,IF,{$MOBILE}} checks whether the user is a mobile user or not. If the user is a mobile user, it will display the content in the webpage. The tempcode “{$MOBILE}” is responsible for the check here.
The line {+START,IF,{$NOT,{$MOBILE}}} checks whether the user is a mobile user or not. And it shows the desktop content only when the user is not a mobile user. The tempcode “{$NOT,{$MOBILE}}” returns a true value only if the user is NOT a mobile user.
Example
-------------------------
{+START,IF,{$MOBILE}}
This text is shown to mobile users only !!!
{+END}
{+START,IF,{$NOT,{$MOBILE}}}
This text is shown to desktop users only !!!
{+END}
Image of the editor with the example tempcode: (image_002.png)
Mobile users' example image: (image_003.png)
Desktop users' example image: (image_004.png)
(Click to enlarge)
(Click to enlarge)
(Click to enlarge)
(Click to enlarge)
-----------------------------------------------------------
Composr is capable of showing different contents to mobile users. Webmasters can show separate contents to the desktop users and mobile users in the same page with the help of this powerful feature. This is a feature which integrated into the Composr core by default. We can enable this feature for an Composr page by adding some simple tempcodes to the built-in editor of the edit page.
Follow these steps to enable this feature in an Composr page :
- Open the page in Composr, in which we need to enable this feature.
- Press the “Edit this page” link at the bottom of the page. (image_001.png)
- We can make changes to the template using the built-in editor of the “Edit” page.
- Add the following “Tempcode” to the template file:
{+START,IF,{$MOBILE}}
Mobile content!
{+END}
- Replace the “Mobile content!” with the content to be shown for the mobile users.
- For showing different content to desktop users, use the following “Tempcode” in the template file:
{+START,IF,{$NOT,{$MOBILE}}}
Desktop content!
{+END}
- Replace the “Desktop content!” with the content to be shown for the desktop users.
Code explanation
-----------------------------
Code: {+START,IF,{$MOBILE}}
The line {+START,IF,{$MOBILE}} checks whether the user is a mobile user or not. If the user is a mobile user, it will display the content in the webpage. The tempcode “{$MOBILE}” is responsible for the check here.
Code: {+START,IF,{$NOT,{$MOBILE}}}
The line {+START,IF,{$NOT,{$MOBILE}}} checks whether the user is a mobile user or not. And it shows the desktop content only when the user is not a mobile user. The tempcode “{$NOT,{$MOBILE}}” returns a true value only if the user is NOT a mobile user.
Example
-----------------
{+START,IF,{$MOBILE}}
This text is shown to mobile users only !!!
{+END}
{+START,IF,{$NOT,{$MOBILE}}}
This text is shown to desktop users only !!!
{+END}
Image of the editor with the example tempcode: (image_002.png)
Mobile users' example image: (image_003.png)
Desktop users' example image: (image_004.png)