Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi

I have built 2 versions of a website (despktop & mobile). I have developed the couch functionality in the desktop version and created the html files of the mobile version. Now how do I display the same content in both the versions simultaneously.

Note that apart from the regular content data there are cloned page displaying job posting in the desktop site so they need to be be shown in the mobile site as well.

Any help will be greatly appreciated.

PS: Due to the specific design requirements of the client a responsive site could not be created so have a mobile version is the only option.

Alok
Hi!

Lemme try to help you.

Lets say, you have folder structure like this :
Code: Select all
- couch (main instalataion of couch)
-- index.php
-- porfolio.php

- mobile (mobile view)
-- index.php
-- m_portfolio.php


Lets say you have this code on your portfolio template :
Code: Select all
<cms:editable name='port_img' type='image' />



to display this image on "portfolio.php", simply put this code :
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>

<cms:template title='Portfolio'>

<cms:editable name='port_img' type='image' />

</cms:template>

<!DOCTYPE html>
<html>
<body>

<img src="<cms:show port_img">

</body>
</html>
<?php COUCH::invoke(); ?>



and to display the image on "m_portfolio.php", we can use '<cms:pages>' tag :
Code: Select all
<?php require_once( '../couch/cms.php' ); ?>

<cms:template title='Portfolio Mobile View' hidden='1'>

<!DOCTYPE html>
<html>
<body>

<cms:pages masterpage='portfolio.php'>
   <img src="<cms:show port_img">
</cms:pages>

</body>
</html>
<?php COUCH::invoke(); ?>



and thats all! You can try to implement it to your code.


Thx!
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
Hi all!
It happens that I work too on mobile/desktop versions. My case is that i have mobile version ready first.

I will share here my thoughts evaluating different approaches to create this. I wrote it to myself, to sort things out.

Code: Select all
   Basically, I have a mobile version ready. SO:
   1. No gains in desktop-v as separate domain, like m.domain.ru:
         .2 installations of Couch
         .2 times to input all fields
         .no sync between versions
   2. No SEO gains in having 2 files like 'index' & 'index-m'
                        .same content will not be added to index
         .many files get more hassle and also no sync.
         .abundance of using tag 'get_custom_field' and 'pages'
         .can't share same editables
   3. Both versions as snippets also are non-profit. Overload.
   4. Both versions in one file. Good!
         .sharing same editables
         .same template and native views and variables--
         .copy-paste parts of code easily
         .on errors recopy and repaste, works as raid, lol
         .ability to /set/ & /get/ session for user choice and preference,
               this way call for 'mobile-detect' can be done only once.
               Brilliant!
               
      OK. So, to implement the best approach:
         a. prepare snippets.
         b. prepare separate css.
         c. js, font, images need no touch


That said, I'm going to use script Mobile_Detect.php and serve html depending on user-device.
My choice is not necessarily objective and fits any other's case. It is that I decided to go the easy way. ;)
PS I can post some code too :D !
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
3 posts Page 1 of 1