Code for displaying iphone in albums

1 view
Skip to first unread message

Sam

unread,
Dec 26, 2009, 1:29:30 PM12/26/09
to zenphoto iphone
Hey all,

Excellent plugin, looks brilliant.

However, when I followed the instructions for amending the code in
functions.php, I found it only changed the main gallery page and not
the album page(s). I had to amend the code as follows to ensure the
album page displayed the iphone theme

HTH

Sam

function setupTheme() {
global $_zp_gallery, $_zp_current_album, $_zp_current_search,
$_zp_options, $_zp_themeroot;
if (!is_object($_zp_gallery)) $_zp_gallery = new Gallery();
$albumtheme = '';
if (in_context(ZP_SEARCH_LINKED)) {
$name = $_zp_current_search->dynalbumname;
if (!empty($name)) {
$album = new Album($_zp_gallery, $name);
} else {
$album = NULL;
}
} else {
$album = $_zp_current_album;
}
/* removed to insert iPhone browser code
$theme = $_zp_gallery->getCurrentTheme();
*/

/* replacement iPhone browser text */
$UA = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER
['HTTP_USER_AGENT'] : "";
$iphone = stristr($UA, 'iPhone') ? true : false;

if($iphone){
$theme = "iphone_directory"; // iphone theme.
}else{
$theme = $_zp_gallery->getCurrentTheme(); // regular theme
}
/* replacement text ends here */

$id = 0;
if (!is_null($album)) {
$parent = getUrAlbum($album);
$albumtheme = $parent->getAlbumTheme();
if (!empty($albumtheme)) {
/* might have to insert another style element here to accommodate
the $theme = $albumtheme */
/* replacement iPhone browser text */
$UA = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER
['HTTP_USER_AGENT'] : "";
$iphone = stristr($UA, 'iPhone') ? true : false;

if($iphone){
$theme = "iphone_directory"; // iphone theme.
}else{
$theme = $albumtheme; // regular theme
}
/* replacement text ends here */


/* replaced text $theme = $albumtheme; */
$id = $parent->id;
}
}
...

Reply all
Reply to author
Forward
0 new messages