Skipping thumbnail page in subalbums when using jcarousel

Denn Member
In one implementation of zenphoto, using zenpage, I would like to go from the subapbums staright to the first image in the album with the jcarousel slide strip on top.

The image pages show the jcarousel nav properly but I can't see any way to go from the subablum listing straight to that without the intervening page of album thmbnails 9obviously they are unnedded and redundant with the jcarousel.

Put another way, I go to the albums page, pick one, get the listing of subalbums, click one, see a page full of thumbs I DON'T want to see, click one and get the image page with the jcarousel nav. OHow do I skip the page full of thumbs.

See here if this doesn't seem clear:
http://www.adrianrtio.com/portfolio

Comments

  • acrylian Administrator, Developer
    You have to modify the theme to achieve this by replacing the link to the album within the next_album loop. You will have to use the object model framework to get teh first image using the method `getImage($index)`.

    Recommending readings first the theming tutorial and then the object model tutorial.
  • Denn Member
    Won't that be a problem at the first album level? It looks to me like the album page is used for the top level album thumb generation and then the subalbum thumb generation too.

    I will check into the docs you suggest.
    Thx
  • acrylian Administrator, Developer
    The top level album thumbs are displayed on index.php and the thumbs of the top level albums and all sublevels itself on album.php. The only problem you have if you jump to the image page directly is accessing subalbums. The album menu plugin for example would be the tool to keep those accessible. It has options for the first image instead of album page as well.
  • Denn Member
    OK, some reading and some testing. Since obviously in the while loop for the album list build I can get the url for the album with
    <?php echo html_encode(getAlbumLinkURL());?> and since in the wile loop for images lists this gets the link to the image
    <?php echo html_encode(getImageLinkURL());?>

    I would expect either a combination of <?php echo html_encode(getAlbumLinkURL());?><?php echo html_encode(getImageLinkURL());?>
    or just the second part to ge me what I need as a url.

    But in the album while loop the getimagelinkurl returns nothing. I can't find any syntax references and it seems there are no code examples and the site is not searchable by functions names like getimagelinkurl so any help on the syntax to get the url to the first image in the album during the album while loop would be greatly appreciated.

    It seems that is all i would need since if I hard code the image name onto the <?php echo html_encode(getAlbumLinkURL());?> I get exactly the results I want.
  • acrylian Administrator, Developer
    The imagelinkurl function of course does not work because how shall Zenphoto know which image of the album you want to link to. In the loop the current album object is available but of course not any image one. So you need to tell it that and as said you have to use the object model for this.

    Please read the object model tutorial and read about the global object variables.
  • Denn Member
    I did read it. It could use some clear examples of how to use the objects, not just descriptions of what they are.

    I would assume that the image calls would either take the current album as a starting point or you would be able to pass it an album as a parameter. But I see no syntax for that and, again, no examples other than combing through them code and trying to extrapolate. Since ANY image url in the gallery would work it only needs to return ANY image url so first, whatever one it found on access or last would work equally well.
  • acrylian Administrator, Developer
    There are examples how to use objects with getTitle in the tutorial. Also how to setup objects.

    Generally you have an object of an item like an album and can call its methods. Those methodes are documented for each class on the functions documentation.

    I am sorry, the object model or more specific object orientation is nothing really Zenphoto specific. This is of course more advanced coding so you might need to learn a bit.
  • Denn Member
    Well, since I prefer posting of actual solutions rather than vague hand waving and pointing to inadequate documentation I have already read, while casting aspersions on my willingness to read, learn and work on this stuff, here is a way to actually make it work which is a modification of the div id "albums" in the album.php of the zenpage theme.:
    `

    <?php $link_we_need = ""; ?>
    <?php while (next_album()): ?>

    <?php echo $link_we_need; ?>
    <?php while (next_image()): ?> <?php if ($link_we_need == "") {$link_we_need = html_encode(getImageLinkURL());}?><?php endwhile; ?>


    " title="<?php echo gettext('View album:'); ?> <?php printBareAlbumTitle();?>"><?php printAlbumTitle(); ?>

    <?php printAlbumDate(""); ?>
    <?php echo shortenContent(getAlbumDesc(), 45,'...'); ?>

    <?php
    if (function_exists('printAddToFavorites')) {
    echo "<br />";
    printAddToFavorites($_zp_current_album);
    }
    ?>


    <?php $link_we_need = ""; ?>
    <?php endwhile; ?>
    `
    Hopefully this will help someone some time. Note the conditional stuff on the $link_we_need var is so we link to the jcarousel nave and image on the first, not the last, image of the album as going to the end is a little disconcerting.

    Probably not the best way but I cant even find the next_image() function in the documentation and so don't know if there is a first_image function.

    I hate to be critical of such a good project but the documentation and its search functions are woefully inadequate and an example, is like what I posted above, not something obvious but not very useful like the one you refer to in the tutorial which is simply:

    For example to get the title of the current album selected you can use $_zp_current_album->getTitle(). This is actually the same as the template function getAlbumTitle().

    Thanks for the project anyway.

    (oh, and btw, I have been doing oop since the early 90's.)
  • acrylian Administrator, Developer
    I hate to be critical of such a good project but the documentation and its search functions are woefully inadequate and an example

    It probably is and you like anyone else is invited to help as we did on numerous occasions to others as well.... http://www.zenphoto.org/pages/get-involved

    next_image is a standard template function and found here:
    http://www.zenphoto.org/documentation/functions/_template-functions.php.html

    You can easily find all functions using the browser page search here:
    http://www.zenphoto.org/documentation/elementindex.html

    All class methods are documentated and use normal oo.

    There is no first image function but this album class method:
    `$firstimage = $_zp_current_album->getImage(0)`

    Documented here: http://www.zenphoto.org/documentation/classes/AlbumBase.html#methodgetImage
    It is the album base class as we make use of the inheritance of classes. Those are listed on the tutorial and the functions documentation.

    That returns an image object so from there on you can use the object methods to get all else, title,links whatever. Direct links to class documentation are here:
    http://www.zenphoto.org/news/functions-documentation

    PS: I see the object model tutorial does require an update for the current class nesting.
  • Denn Member
    Thanks.
  • Denn Member
    BTW, missed removing this line from the above which was just a test for the actual return.

    <?php echo $link_we_need; ?>

    Obviously removable from the functioning code.
  • vincent3569 Member, Translator
    I do not want "to put oil on the fire", but it is true that it is not always easy to find help on the forum zenphoto.

    You often have to answer the same questions, and it is certainly very painful and frustrating. but the standard answer is often "RTFM" (documentation and tutorials of zenphoto).

    Be sure this is probably not the best way to develop community zenphoto ...

    However, sometimes there are real questions about good things zenphoto does not or does not do very well.

    This is the case of this post on jcarousel_thumb_nav plugin.
    The real value of this plugin is to avoid display of the image's thumbnails on the page of albums, but nothing explains how to do that.

    Questions I ask myself on the code above:
    - this code is for the gallery page (in case there are only albums and no sub-albums)?
    - what will happen if all images in the album are not published?
    - the limit of the solution is an album should not mix sub-albums and images?

    Please, have some kindness on relevant posts that can advance zenphoto...
  • acrylian Administrator, Developer
    We really try to do our best to answer everything. And I think we really do provide a lot of direct and detailed help. I don't think we are exactly unkind.

    Our object model is fairly standard practice. If you know how to get the title of an object you know to get all else. All methods of the class objects are documented and sometimes you have to try a bit to find out what you need. DOn't think for example think I know all stuff offhand. I fairly often have to look at the doc myself. It really exceeds our resources to provide examples to everything.

    Regarding the jCarousel and skipping the thumbnail view:
    There are several ways to do that. In any case you have to modify the theme next_album loops to jump to the image as this is simply not the standard way.

    Denn has shown one way using a nested next_image loop. I showed the rather proper way for the first image above as well (it is what we use on our site on the themes section). If you use that you get an image object and can do everything you can do with an image object. It's all the same scheme. What is available is documented.

    If you jump to unpublished images directly you will just see them. On ZP you always can link to anything that is unpublished directly unless it is protected additionally.

    Additionally the print_album_menu plugin has an option to use the first image insead the album thumbnail view if available. If the album you wish to link to has no direct images but only subalbums it will normally to the album to show those subalbums. So for usability reasons I would recommend to use that with jCarousel.
    Using the menu manager and custom menus you can of course define it yourself.

    As a theme author you know that modifying or writing a theme is a bit of work. I am sorry that there is sometimes no easy and direct answer. And we don't always know the background of people. If someone does not know PHP at least for the basics it is really work to explain things. The real flexibility of Zenphoto is - as with a lot CMS - the theming itself.

    I agree that the forum search is quite bad, you get much better results if you use Google directly. There is sadly no way around as we currently lack the time to do a forum switch.

    Please let me repeat that we welcome any help on the user guide which of course should have all necessary info (the functions documentation is automatically generated from the source so there is not much to do - no one really wants to do that manually!).

    I hope this explains it a bit.
  • Although this is an old topic I want to say thank you to Denn, helped a lot!
Sign In or Register to comment.