View Issue Details

IDProjectCategoryView StatusLast Update
0001027Composr documentation[All Projects] General / Uncategorisedpublic2015-09-25 19:15
ReporterChris GrahamAssigned ToLadonna 
SeverityFeature-request 
Status closedResolutionwon't fix 
Summary0001027: Showing different content to mobile users
DescriptionNew tutorial.

You basically just do this...

{+START,IF,{$MOBILE}}
Mobile content!
{+END}

{+START,IF,{$NOT,{$MOBILE}}}
Desktop content!
{+END}
TagsNo tags attached.
Time estimation (hours)
Sponsorship open

Activities

anoops

2015-07-20 07:12

reporter   ~0002967

Last edited: 2015-07-23 04:46

View 2 revisions

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.

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)

anoops

2015-07-23 04:47

reporter  

image_001.png (3,673 bytes)
image_001.png (3,673 bytes)

anoops

2015-07-23 04:47

reporter  

image_002.png (81,200 bytes)
image_002.png (81,200 bytes)

anoops

2015-07-23 04:48

reporter  

image_003.png (35,665 bytes)
image_003.png (35,665 bytes)

anoops

2015-07-23 04:48

reporter  

image_004.png (78,193 bytes)
image_004.png (78,193 bytes)

Rajesh Kumar

2015-07-29 16:35

reporter   ~0003016

Assigned for tutorial review by Deepu

deepu_ms

2015-08-03 06:24

reporter   ~0003042

Last edited: 2015-08-03 06:25

View 2 revisions

Showing different content to mobile users
-----------------------------------------------------------

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)

Chris Graham

2015-09-25 19:15

administrator   ~0003097

Similar but less (needlessly) verbose explanation already included in new mobile tutorial. The verbosity here just re-explains concepts the user must already know if working at this level.

Issue History

Date Modified Username Field Change
2023-02-26 18:29 Chris Graham Category General => General / Uncategorised