General Navigation

Hy, i´m new here and i try to figure out how i can realize my theme:

A) Start Page
- random image from a album, doesn´t matter from which.(i don´t have)
- the albums are just text links, so this should be my main navigation (i got)

B) Album view
I figured out how to link directly to the album, where there is now the first image of the album in a big view and the others as thumbnails under it. If i click on thumbs - big image changes. Just as i want.

So here comes my problem:

I wanted this navigation from the startpage (div class=albumdesc) to look exactly he same in the albumview, so the user always can jump directly from the actual album to others without going back to home and than....
I tried just to copy the album-part to the image.php file but i get an error.
How can i realize such a all-over navigation? Also would be nice to show in this text link the currentAlbumTitle in a different way, so the user knows where he is.

Should look like this:

Index.php (Navigation):

Album 1
Album 2
Album 3
Album 4

case: Album 3 selected (-->go to Image.php)

Image.php (Navigation):

Album 1
Album 2
Album 3(selected, not clickable)
Album 4

//Pierre

you can check here:
http://www.uniqrn.com/zenphoto/structure.jpg

Comments

  • acrylian Administrator, Developer
    I assume you use zenphoto 1.1.5? There is already a function within the zp-core/plugins folder that you could use for your naviagtion. See the file `print_album_menu.php`for the usage description on top of the file.
    Since this function leads to the thumbnail page of the album you would have to modify the links within it. This here might be of use for it: http://www.zenphoto.org/support/topic.php?id=752&replies=11 (the post at the bottom by BertSimmons).

    For a random image there is a function http://www.zenphoto.org/documentation/zenphoto/_template-functions.php.html#functionprintRandomImages
  • Hy Acrylian,

    what i did was the following:

    i copied the argument: <?php require_once(SERVERPATH . "/" . ZENFOLDER . "/plugins/print_album_menu.php"); ?> to my index file and than at one point i wrote the <?php printAlbumMenu(); ?> argument. But i get an error that says:

    Warning: Missing argument 1 for printalbummenu() in /homepages/xx/xxx/xxx/xx/xx/zp-core/plugins/print_album_menu.php on line 63

    while my file ends at line 53?

    did i import the plugin wrongly?
  • Ah, ok, found my mistake:

    the "printAlbumMenu" Argument needs some classes to be defined, like:

    <?php printAlbumMenu("list","count","album_menu","album_menu_active","album_menu_sub","album_menu_sub_active"); ?>

    I got it now, thanx a lot!
  • acrylian Administrator, Developer
    The classes are not necesssary if you don't want to use any specific, only the both first parameters("list","count") are mandatory.
  • i tried that redirect function at top of album.php from simmons, but didn´t work.
    in index.php i solved it with writing:

    $_zp_current_image->getImageLink

    instead of:

    $_zp_current_image->getAlbumLink

    how can i do that within the print_album_menu.php?
  • I tried to work on the css style for the menu, but it seems, that it no worky. i wrote:

    <?php printAlbumMenu("list","","","","menu","menuactive"); ?>

    so by default css is menu, and active it has menuactive style.

    my css:

    .menu {
    font-family:Arial, Helvetica, sans-serif;
    font-size:10px;
    font-weight:100;
    text-decoration:none;

    }

    .menuactive {
    font-family:Arial, Helvetica, sans-serif;
    font-size:10px;
    font-weight:200;
    text-decoration:none;
    }

    And it looks like "menu" tries to catch normal a:hover etc styles

    do i have to work on this css_id?
  • acrylian Administrator, Developer
    1. Getting the first image:
    You would have to hack the printAlbumMenu function and change the link within that function. I guess the part I linked to above was a little to complicated. Ok lets try another thing:

    To get the first image in an album use this:
    `$firstimage = $_zp_current_album->getImages();`
    Then replace the ULRs within printAlbumMenu that look like:
    `.$albumlinkpath.$folder[$top].`
    with
    `.$albumlinkpath.$folder[$top]."/".$firstimage[0].`
    (this assumes that you use mod_rewrite). Haven't tried this you will have to try a little.
    2. CSS
    You didn't read the instructions correctly. There are two parameters for the top level album list (ths css_id) and for the subalbums (the css_class you used).
    printAlbumMenu generates a nested unordered html list. You would have to use `.menu`plus `.menu ul`and `.menu ul li`.
  • ah, where has this "$firstimage = $_zp_current_album->getImages();" to go?

    and sorry, but what you meen with .menu plus .menu lu and .menu li lu? should i just paste them in my css? the main and sub css part in the printAlbumMenu i get, but this....

    sorry, i feel a bit stupid today (maby just´not today...)
  • i decided to go like this:

    index.php should be main + menu

    album. php should be the main file to use. i want to have there the main image and under it the thumbnails that switch the main image above. i also found this description:

    "I actually wrote a function for that because I needed it too. My PHP isn't all that great, but this works for me:

    `

    function getAlbumFirstImageURL() {

    global $_zp_current_album, $_zp_current_image;

    $firstimage = $_zp_current_album->getImage(0);

    if (in_context(ZP_IMAGE) && $_zp_current_image->getAlbumPage() > 1) {

    // Link to the page the current image belongs to.

    return rewrite_path("/" . urlencode($_zp_current_album->name) . "/page/" . $_zp_current_image->getAlbumPage(),

    "/index.php?album=" . urlencode($_zp_current_album->name) . "&page=" . $_zp_current_image->getAlbumPage());

    } else {

    return rewrite_path("/" . urlencode($_zp_current_album->name) . "/" . urlencode($firstimage->getFileName()),

    "/index.php?album=" . urlencode($_zp_current_album->name) . "&image=" . urlencode($firstimage->getFileName()));

    }

    }

    Put this in your template-functions.php and use <?=getAlbumFirstImageURL();?> to access it.

    `

    but maybe because this is a newer version of zenphoto it doesn´t work

    is there something i could use different?

  • acrylian Administrator, Developer
    You original idea would work well, we basically use that on our themes page on zenphoto.org. The link you posted only works on image.php. And your new

    The thing is I was mistaken (happens even to devs...:-)) "$firstimage = $_zp_current_album->getImages();" of course can't work within the menu, that only works in the album loop...

    printAlbumMenu would have to be extended with a db query to get the first image of all albums. This is not that easy if you don't have the knowledge. Telling you how to do this would basically mean doing it for you and I just don't have the time right now.

    Your css above does not include any hover setup, so the hover of the general css is taken. You would have to define your own for the menu. Take a look at this theme, the menu is used and styled there:
    http://www.zenphoto.org/zp/theme/garland/image.png.php
  • my index looks like this:

    `

    <?php if (!defined('WEBPATH')) die(); $themeResult <br />
    = getTheme($zenCSS, $themeColor, 'light'); $firstPageImages = normalizeColumns('2', '6');?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-transitional.dtd">





    <?php printGalleryTitle(); ?>

    " type="text/css" />

    <?php printRSSHeaderLink('Gallery','Gallery RSS'); ?>

    <?php zenJavascript(); ?>

    <?php require_once(SERVERPATH . "/" . ZENFOLDER . "/plugins/print_album_menu.php"); ?>

    <br /> </head><br /> <body><br /> <div id="horizon"><br /> <div id="main"><br /> <div id="gallerytitle"><br /> <?php if (getOption('Allow_search')) { printSearchForm(''); } ?><br /> <h2><?php printHomeLink('', ' | '); echo getGalleryTitle(); ?></h2><br /> </div><br /> <div id="Mainmenu"><br /> <?php printAlbumMenu("list","","",""); ?><br /> </div><br /> <br clear="all" /><br /> <?php printPageListWithNav("� prev", "next �"); ?><br /> </div><br /> </div><br /> </div><br /> <div id="credit"><?php printRSSLink('Gallery','','Index', ''); ?><br /> <a href="?p=archive">Archive View</a> | Powered by <a href="http://www.zenphoto.org" title="A simpler web photo album">zenphoto</a><br /> </div><br /> <?php printAdminToolbox(); ?><br />





    `
  • and my album:

    `<?php if (!defined('WEBPATH')) die(); $themeResult = getTheme($zenCSS, $themeColor, 'light'); $firstPageImages = normalizeColumns('2', '6');?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-transitional.dtd">





    <?php printGalleryTitle(); ?> | <?php echo getAlbumTitle();?>

    " type="text/css" />

    /plugins/rating/rating.js">

    /plugins/rating/rating.css" type="text/css" />

    <?php printRSSHeaderLink('Album',getAlbumTitle()); ?>

    <?php zenJavascript(); ?>

    <?php require_once(SERVERPATH . "/" . ZENFOLDER . "/plugins/print_album_menu.php"); ?>



    <br /> <body><br /> <div id="horizon"><br /> <div id="main"><br /> <div id="gallerytitle"><br /> <h2><span><?php printHomeLink('', ' | '); ?><a>" title="Albums Index"><?php echo getGalleryTitle();?></a> | <?php printParentBreadcrumb(); ?></span> <?php printAlbumTitle(true);?></h2><br /> </div><br /> <div id="Mainmenu"><br /> <?php printAlbumMenu("list","","",""); ?><br /> </div><br /> <div id="padbox"><br /> <?php printAlbumDesc(true); ?><br /> <div id="albums"><br /> <?php while (next_album()): ?><br /> <div class="album"><br /> <div class="thumb"><br /> <a>" title="View album: <?php echo getAlbumTitle();?>"><?php printAlbumThumbImage(getAlbumTitle()); ?></a><br /> </div><br /> <div class="albumdesc"><br /> <h3><a>" title="View album: <?php echo getAlbumTitle();?>"><?php printAlbumTitle(); ?></a></h3><br /> <small><?php printAlbumDate(""); ?></small><br /> <?php printAlbumDesc(); ?><br /> </div><br /> <p style="clear: both; "><br /> </div><br /> <?php endwhile; ?><br /> </div><br /> <div id="images"><br /> <?php while (next_image(false, $firstPageImages)): ?><br /> <div class="image"><br /> <div class="imagethumb"><a>" title="<?php echo getImageTitle();?>"><?php printImageThumb(getImageTitle()); ?></a></div><br /> </div><br /> <?php endwhile; ?><br /> </div><br /> <?php printPageListWithNav("� prev", "next �"); ?><br /> <?php printTags('links', '<strong>Tags:</strong> ', 'taglist', ''); ?><br /> </div><br /> <?php if (getOption('Allow_ratings')) { printAlbumRating(); }?><br /> </div><br /> <div id="credit"><?php printRSSLink('Album', '', 'Album RSS', ''); ?> | <a>?p=archive">Archive View</a> | Powered by <a href="http://www.zenphoto.org" title="A simpler web photo album">zenphoto</a></div><br /> <?php printAdminToolbox(); ?><br /> </div><br />



    `
  • So what would you sa is the best way to do it? i coudn´t find any template to realize this. for me it is the easyest way of to think how such a photo-thing should work. i don´t get the regular way of going from a index to an album and than to the image....maybe zenphoto is the wrong thing? hope not, cause it really looks nice to me!
  • and as far i see, the problem is the following:

    case 1: i try to get a loop done in the album.php which allows me to hav thumbnails and the big image, while the thumbnails are looping back to the album.php and changing the actual big image without going to the image.php or

    case2: jumping directly from index.php to the image.php without showing the album.php

    correct?

    the problem in case2 i see is, that my menu is dead, the problem in case 1 is, that i have to write a function that loops the image request from the thumbnails to a big image in the album.php...
  • and my image.php, where i exactly hav what i want to see:

    `

    <?php if (!defined('WEBPATH')) die(); $themeResult = getTheme($zenCSS, $themeColor, 'light'); $firstPageImages = normalizeColumns('2', '6');?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-transitional.dtd">





    <?php printGalleryTitle(); ?> | <?php echo getAlbumTitle();?>

    " type="text/css" />

    /plugins/rating/rating.js">

    /plugins/rating/rating.css" type="text/css" />

    /js/thickbox.css" type="text/css" />

    /js/jquery.js" type="text/javascript">

    /js/thickbox.js" type="text/javascript">



    function toggleComments() {

    var commentDiv = document.getElementById("comments");

    if (commentDiv.style.display == "block") {

    commentDiv.style.display = "none";

    } else {

    commentDiv.style.display = "block";

    }

    }



    <?php printRSSHeaderLink('Gallery','Gallery RSS'); ?>

    <?php zenJavascript(); ?>

    <?php require_once(SERVERPATH . "/" . ZENFOLDER . "/plugins/print_album_menu.php"); ?>



    <br /> <body><br /> <div id="horizon"><br /> <div id="main"><br /> <div id="gallerytitle"><br /> <h2><span><?php printHomeLink('', ' | '); ?><a>" title="Albums Index"><?php echo getGalleryTitle();?><br /> </a> | <?php printParentBreadcrumb("", " | ", " | "); /*printAlbumBreadcrumb("", " | ");*/printAlbumTitle(true); ?></span><br /> </h2><br /> </div><br /> <div id="Mainmenu"><br /> <?php printAlbumMenu("list","","","","",""); ?><br /> </div><br /> <!-- The Image --><br /> <?php if (!checkForPassword()) { ?><br /> <div id="image"><br /> <a>" title="<?php echo getImageTitle();?>"><strong><?php printDefaultSizedImage(getImageTitle()); ?></strong></a><br /> </div><br /> <!-- Description Start --><br /> <div id="narrow"><br /> <?php printImageTitle(true); ?><br /> <?php printImageDesc(true); ?><br /> <?php if (getImageEXIFData())<br /> {echo "<div id=\"exif_link\"><a>Image Info</a></div>";<br /> printImageMetadata('', false); } ?><br /> <?php /* printTags('links', '<strong>Tags:</strong> ', 'taglist', '');*/ ?><br /> <?php printImageMap(); ?><br /> <!-- Comments Start / Not used--><br /> <?php if (getOption('Allow_comments')) { ?><br /> <div id="comments"><br /> <?php $num = getCommentCount(); echo ($num == 0) ? "" : ("<h3>Comments ($num)</h3><hr />"); ?><br /> <?php while (next_comment()){ ?><br /> <div class="comment"><br /> <div class="commentmeta"><br /> <span class="commentauthor"><?php printCommentAuthorLink(); ?></span> says:<br /> </div><br /> <div class="commentbody"><br /> <?php echo getCommentBody();?><br /> </div><br /> <div class="commentdate"><br /> <?php echo getCommentDate();?><br /> ,<br /> <?php echo getCommentTime();?><br /> <?php printEditCommentLink('Edit', ' | ', ''); ?><br /> </div><br /> </div><br /> <?php }; ?><br /> </div><br /> <?php } ?><br /> </div><br /> <!-- Comment End --><br /> <?php } ?><br /> <!-- Thumbnails Start --><br /> <div id="albums"><br /> <?php $_current_image = $_zp_current_image; ?><br /> <?php while (next_album()): next_image(); ?><br /> "title="<?php echo getImageTitle();?>"><?php printImageThumb(getImageTitle()); ?><br /> <div class="album"><br /> <div class="thumb"><br /> <a>" title="View album: <?php echo getAlbumTitle();?>"><?php printAlbumThumbImage(getAlbumTitle()); ?></a><br /> </div><br /> <p style="clear: both; "><br /> </div><br /> <?php endwhile; ?><br /> </div><br /> <div id="images"><br /> <?php while (next_image(false, $firstPageImages)): ?><br /> <div class="image"><br /> <div class="imagethumb"><br /> <a>" title="<?php echo getImageTitle();?>"><?php printImageThumb(getImageTitle()); ?></a><br /> </div><br /> </div><br /> <?php endwhile; ?><br /> <?php $_zp_current_image = $_current_image; ?><br /> </div><br /> <!-- Thumbnails Start --><br /> </div><br /> </div><br /> <div id="credit"><?php printRSSLink('Gallery','','Image', ''); ?><br /> <!--<a>?p=archive">Archive View</a> | Powered by <a href="http://www.zenphoto.org" title="A simpler web photo album">zenphoto</a>--><br /> </div><br /> <?php printAdminToolbox(); ?><br />





    `
  • acrylian Administrator, Developer
    Ok, it was easier so I hacked a little. This modification assumes that you use mod_rewrite and the modrewrite suffix ".php" for you image page:

    1. Localte the album query (it's commented). Paste after the line "$title[$number] (....)" following lines:
    `$image = query_single_row("SELECT filename FROM ". prefix('images') ." WHERE albumid= ".$id[$number]." AND `show` = 1 ".$passwordcheck." ORDER BY sort_order");

    $firstimage[$number] = $image["filename"];`

    2. Then change every link in the menu form this (this is only the toplevel example!):
    `.$albumlinkpath.$folder[$top].`
    to
    `.$albumlinkpath.$folder[$top]."/".$firstimage[$top].".php'`

    And voila the menu leads to the first image.
  • ok, i paste:

    `// album query

    $result = query("SELECT id, parentid, folder, title FROM ". prefix('albums') ." WHERE ```show`` = 1 ".$passwordcheck." ORDER BY sort_order");
    while($row = mysql_fetch_array($result)) {
    $number++;
    $id[$number] = $row['id'];
    $parentid[$number] = $row['parentid'];
    $folder[$number] = $row['folder'];
    $title[$number] = $row['title'];
    $image = query_single_row("SELECT filename FROM ". prefix('images') ." WHERE albumid= ".$id[$number]." AND show = 1 ".$passwordcheck." ORDER BY sort_order");
    $firstimage[$number] = $image["filename"];.....

    and than there are two .$albumlinkpath.$folder[$top]. statments

    `

    / link either for list or jump menu display

    if($option === "list") {

    echo "".$active."
    ".$strong_start."".htmlspecialchars($title[$top])."".$strong_end.$imagecount[$top];

    } else if ($option === "jump") {

    echo "".htmlspecialchars($title[$top]).$imagecount[$top]."";

    }

    $sub1_count = 0;`
    ----> i changed to
    `

    // link either for list or jump menu display

    if($option === "list") {

    echo "".$active."
    ".$strong_start."".htmlspecialchars($title[$top])."".$strong_end.$imagecount[$top];

    } else if ($option === "jump") {

    echo "".htmlspecialchars($title[$top]).$imagecount[$top]."";

    }

    $sub1_count = 0;`
    ---->which gives me an error:
    Zenphoto Error
    MySQL Query ( SELECT filename FROM `zp_images` WHERE albumid= 15 AND show = 1 ORDER BY sort_order ) Failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'show = 1 ORDER BY sort_order' at line 1
  • and strange, i tried to the garland theme and also over the first menu point "id='album_menu'" is showing up. could there be a problem with my print_album_menu.php" file or with the sql data base?
  • acrylian Administrator, Developer
    The show within the query needs to be set within backticks (can't post theme because the forum uses them for code display). Then it should work.

    Garland uses it's own older version of the print album menu as far as I remember.
  • i don´t know, maybe i´m totaly wong, you an check over here:
    http://schmidtdedonno.com/schnitty

    it doesn´t work, and i don´t know why, what you wrote should be exactly what i want (i guess...)

    in the image.php you see how it should look in the album.php...

    i would be very happy if you would like to have a look...
  • If we will get this to work, i will make a good looking template for your project.I swear!
  • acrylian Administrator, Developer
    Hm, probably a pasting error somehow. That happens with code from the forum. I have uploaded the modified version of the menu here : http://www.zenphoto.org/wp-content/uploads/2008/04/print_album_menu-1st-image.zip
  • Great ma man!

    works just perfect!

    So all i need is now the following:

    a view, where are all albums (i don´t have any subalbums) listed with all thumbnails,like:

    album 1
    thumb1 thumb2 thumb3 thumb4 thumb5 etc.

    album 2
    thumb1 thumb2 thumb3 thumb4 thumb5 etc.

    album 3
    thumb1 thumb2 thumb3 thumb4 thumb5 etc.

    Is that possible? I think it could be arranged over the archiv view, but there somehow it seems to be working over the search panel, with a kind of search result. so i don´t get the album titles etc.

    is there a post already or something?

    best!
  • And just a question:

    if i now go to album 1, the font album 1 is showing gets <stong> but still selectable.
    would be nicer, if it would be just and not able to be selcted anymore...
  • acrylian Administrator, Developer
    So you are talking about the index page. Well, with the knowledge and time nearly everything is possible...:-) There has been a thread about that. I believe BertSimmons had done that modifying the album menu a while back, but I can't find it right now..

    Search for the `` within the code and remove the link. (originally the menu is meant to serve as "back to the first album page ", too).
Sign In or Register to comment.