Skipping (Sub) Album View

Hey guys. I'm looking to modify zp to skip linking to a sub album and go directly to the first image in the sub album. For example, I have my index page which contains all of my top level albums. When I click on one of the top level albums it brings up album.php, which contains a mixture of images and sub albums. The image links point to image.php, while the sub albums go back to album.php to display the images contained within that sub album.

What I would like to have happen is that when you click on the sub album thumbnail you are directed to image.php, where as the first image in the sub album is displayed. I have tried modifying album.php's '<?php echo htmlspecialchars(getAlbumLinkURL());?>' to various strings like getImageLinkURL and getFirstImageURL, but have had no luck. Anyone have any thoughts on how to make this happen? Appreciate it, thanks.

Comments

  • Obviously, this needs to be coded. Here are the hints:

    You can get an image in an album by using the object's `getImage()` method. `$firstimage = $_zp_current_album->getImage(0);` will get the first image if one exists. Of course, you will need to protect your code from the case where there in no image in the album.

    You can create a link to the image with the image method `getImageLink()` so `$image->getImageLink()` is the URL to the image page which you would have to format into an `href`. NOTE: these links may have html characters such as `&`in them. You need to deal with this for validation. We usually use `htmlspecialchars()` to sanitize them before using them in HTML.
  • I don't know if I'm quite following. I think the first part of your response is speaking to placing a full size image in the album. Which is not really what I'm looking to do. The second part of your response sounds like the normal method for linking to an image. I don't know if I'm grasping how to apply it to my situation, skipping the second level album when clicked and going right to the image view. Here is my code to that section if it helps.

    `


    `
    I'm using a java script, grey box, and have changed some of the css style names if you are wondering about some of the references in my code. It's the second `echo htmlspecialchars` is where I think my problems are.

    Thanks. www.peridotsavannah.com/products/index.php?album=chests-casegoods
  • There you go. I did not look to see if there was already a function to give the URL of first image of the album.

    Passing URLs to javascript functions is a bit of a pain. I can't remember the details but I believe they may need double URL encoding. Maybe you should get it working first with just linking to the image.php page without the grey box.
  • I've now removed all references to grey box and am getting the same exact results. What about using the getCustomPageURL command? I've been messing around with that command and my image.php page is at least loading...with error messages though. I've been using `getCustomPageURL(image))`. The error message I'm getting is `Fatal error: Call to a member function getBody() on a non-object in /home/content/p/e/r/peridotsav/html/products/zp-core/template-functions.php on line 2229`. Am I on the right track? Linking right to a image instead of to a sub album sounds like it would be a relatively easy thing to accomplish with zp, but it's turning out to be a bear.
  • Loading an image page requires the appropriate parameters to tell the script what image to load. If you have mod_rewrite set then the URI for an image will look something like:

    `mysite.com/zenphoto/myalbum/myimage.jpg`

    If what you are doing does not create something like that, then it is making the link wrong.
  • Ok, what about approaching this from a different way. I've mad a new file called subalbum.php. This contains much of the same code as album.php but is modeled to look like my image page. What I'm hoping is that I can pass information to this page instead of having subalbum data loop back through album.php. Is this a coding nightmare or is it something that is doable?
  • acrylian Administrator, Developer
    I can't follow what you are actually trying to do... You want to jump to the first image of a album directly without displaying the thumbs as a step inbetween. That sbillard described above.

    If you want to call a separate page in a grey or whatever box js script as a separate page you need to pass some data via $_GET and then probably you have to create a new object to get to the other data. You will have to write some functions to achieve this.
  • Hey acrylian,

    Let me start over as perhaps I haven't explained exactly what I am looking to accomplish. I have an index.php file. This contains links to my top level albums (on my site albums like chests & cases, tables, seating, etc.) When you click on one of these it loads into album.php. This brings up thumbnails from my respective albums. Which is what I want it to do. But, here is the tricky part. It contains a mixture of subalbums and images. When you click on one of these subalbums or images I need it to load into image.php. The straight forward images on the page of course load to image.php. The subalbums on the other hand, load back into album.php. This is a problem as my album.php and image.php do not look like each other, nor do I want a second set of thumbnails associated with the subalbum to display. What I would like to happen is have the first image of the subalbum load into image.php. This would skip the subalbum loading back into album.php and displaying that second set of thumbnails.

    I've tried both of sbilliards suggestions and they did not yield those results. I have tested with and without the greybox (but believe me, greybox works just fine, as before I added subalbums it loaded my images without any problems. But, this is neither here nor there though. Is it possible to have subalbums not load onto album.php and skip right to displaying the first image of the subalbum on image.php?
  • Seems to me that your best solution is to reorganise your gallery. Since you don't really want subalbums, why have them in the first place?
  • I need a way to link certain images together. Some of the images on the site will have additional views (close-ups, various shots, etc.). As far as I know there is no way to group a series of images within an album together unless you use a subalbum. If you know another way to do this, I would greatly appreciate the advice.
  • Yes:

    Search functions and dynamic albums
  • acrylian Administrator, Developer
    You got above the code to jump to the first image within an album to skip the thumbnail view and go directly to image.php. Implement that within the next_album() loop on album.php and that's it. Since toplevelalbums are displayed on index.php there is will also not be any conflict with the next_albums() loop on album.php. If that is not what you want I apparently don't get what you are trying to do...
Sign In or Register to comment.