Setting Zenpage Homepage on zpMobile

I have my website functioning perfectly using a modified zenpage theme for desktop browsers, now I am just trying to get it to work on mobile devices using the zpMobile theme.

I have almost everything done except for one issue I can't quite figure out:

on the desktop theme, I have a unpublished page called "home" which is the splash page I have set as the Homepage under Custom Theme Options under Zenpage. I am trying to duplicate the same behavior in zpMobile.

I tried using the code from the zenpage index.php in zpmobile:

`
<?php

// force UTF-8 Ø

if(function_exists("checkForPage")) { // check if Zenpage is enabled or not
if (checkForPage(getOption("zenpage_homepage"))) { // switch to a news page
$ishomepage = true;
include ('pages.php');
} else {
include ('gallery.php');
}
} else {
include ('gallery.php');
}
?>
`
But this leads to the gallery page being used as home. The zenpage plugin is active, is the 'zenpage_homepage' option still active when the zmMobile theme is active? or can I fake this behavior somehow?

Thanks for the great work, I am slowly getting a handle on theming with jQuery mobile, but that's a whole other story.

Comments

  • acrylian Administrator, Developer
    I have not setup the theme for that at all but actually that code should work. Besides that jquerymobile is a bit special regarding html5 setup it is just a theme. But sometimes its own js cache causes issue (for example it is not possible to link to anchors within the same page).

    Did you clear the browser and if used the html cache of ZP (although the latter is not active if your are logged in).

    You could also manually modify the index.php to use the page in question using the object model.

    You also could open a ticket for this homepage feature for 1.4.4.
  • Figured it out: went into zpMobile themeoptions.php and added:

    `setThemeOptionDefault('zenpage_homepage', 'none');`

    to the function Themeoptions and

    `gettext('Homepage') => array('key' => 'zenpage_homepage', 'type' => OPTION_TYPE_CUSTOM, 'desc' => gettext("Choose here any un-published Zenpage page (listed by titlelink) to act as your site's homepage instead the normal gallery index.")."

    ".gettext("Note: This of course overrides the News on index page option and your theme must be setup for this feature! Visit the theming tutorial for details.")."

    "),`

    to the getoptionssupported function

    then threw in

    `
    if($option == "zenpage_homepage") {
    $unpublishedpages = query_full_array("SELECT titlelink FROM ".prefix('pages')." WHERE show != 1 ORDER by sort_order");
    if(empty($unpublishedpages)) {
    echo gettext("No unpublished pages available");
    // clear option if no unpublished pages are available or have been published meanwhile
    // so that the normal gallery index appears and no page is accidentally set if set to unpublished again.
    setOption("zenpage_homepage", "none", false);
    } else {
    echo '' . "\n";
    echo ''."\n";
    if($currentValue === "none") {
    $selected = " selected = 'selected'";
    } else {
    $selected = "";
    }
    echo "".gettext("none")."";
    foreach($unpublishedpages as $page) {
    if($currentValue === $page["titlelink"]) {
    $selected = " selected = 'selected'";
    } else {
    $selected = "";
    }
    echo "".$page["titlelink"]."";
    }
    echo "\n";
    }
    }
    `
    into function handleOption

    All that did not work exactly, it printed a list of my pages on the splash page... until I figured out that I had to get rid of this code from pages.php

    `
    <?php if(empty($_GET['title'])) { ?>

    <?php echo gettext('Pages'); ?>


      <?php printPageMenu("list-top","","menu-active","submenu","menu-active",NULL,true,false,NULL); ?>
    <?php } else { ?>
    `
    now it works like a charm. I also bogarted the custom menu plugin and made a mobile version that lists my pages in the menu.

    I figure someone could use this in the future. It was all theme tweaking, basically stealing from zenpage.
  • acrylian Administrator, Developer
    This is how thtemes are meant, to be modified if needed. If you like to see this an official feature please open a ticket. Otherwise it most likely gets forgotten.
Sign In or Register to comment.