Problem: redirect on mobile version of detail multi-listing page

3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 27, 2014   (RSS)

By meg - May 27, 2014

I have a multi-listing section (blog) that I have set up for a client. I'm developing a mobile version of the website, but I'm having trouble connecting the links on the mobile pages to the mobile detail pages of the multi-listing. 

In the view URL section of the section editor, I have the list pages as index.php and the detail pages as article.php.

The mobile version has the same naming scheme to the list and detail pages. 

I'm using a redirect on the index.php and article.php pages:

On the index: 

<script language=javascript>if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
location.replace("http://name.com/mobile/index.php");}</script>

On the article, I tried both of these scenarios without success:

<script language=javascript>if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
location.replace("http://name.com/mobile/article.php");}</script>

It takes me to the correct page initially, then redirects to the first article.

<script language=javascript>if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
location.replace("http://name.com/mobile/article.php?<?php echo htmlencode($detailRecord['title']) ?>");}</script>

It takes me to the "named page" but none of the content appears. 

I'm using this to link the mobile pages to the articles.

<?php foreach ($articlesRecords as $listRecord): ?>
<?php $isSelected = ($listRecord['num'] == $detailRecord['num']); ?>
<?php if ($isSelected) { print "<b>"; } ?>

<?php echo htmlencode($listRecord['_link']) ?>

<?php if ($isSelected) { print "</b>"; } ?>
<?php endforeach ?>

How do I properly handle this mobile redirect?

Thank you!

By meg - May 27, 2014

Problem solved. Thank you!