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
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.
`
<?php while (next_album()): ?>
<?php printAlbumTitle(); ?>
<?php endwhile; ?>
`
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
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.
`mysite.com/zenphoto/myalbum/myimage.jpg`
If what you are doing does not create something like that, then it is making the link wrong.
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.
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?
Search functions and dynamic albums