Member
Member
vincent3569   2013-04-07, 09:14
#1

hi,

is there a function to print a link to a specific album ?
I found printAlbumLink on documentation (http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintAlbumLink) but it's only for current album.

Administrator
Administrator
acrylian   2013-04-07, 09:24
#2

Yes, via the object model you can do everything. See the album class.

Member
Member
vincent3569   2013-04-07, 19:02
#3

maybe, I have something before my eyes, but I can't see anything about my request.
I have an album name (or the directory for an album), is there a function ti print a link to this album, anywhere in my theme (footer, header,...)

Administrator
Administrator
acrylian   2013-04-07, 19:18
#4

Create an object of the album and use the album class method
http://www.zenphoto.org/news/zenphotos-object-model-framework#creating-a-new-object
http://www.zenphoto.org/documentation/classes/Album.html#methodgetAlbumLink

Of course the gallery object is available already in $_zp_gallery.

Member
Member
vincent3569   2013-04-08, 09:00
#5

thanks acrylian
in other words, there is no other way to print an album link, without creating album object?

The link will be in my header, or my footer, so it will be present on all pages of my site: I have to create object at each page reload?
I'm not sure that this solution has the best performance on the server side, don't you think ?

Is there no static method which allows to not create an object every times ?
something like
Album::printAlbumLink('root_to_album)

Administrator
Administrator
acrylian   2013-04-08, 12:06
#6

No, we don't have such a function. But - I forgot the obvious way myself - album links are quite simple so you can alway create a link manually like echo WEBPATH.'/' (modrewrite). That is what we do on our main nav. A function would be a bit overload.

So if you don't need anything else of the album like title or tags or else to display, that is the way.

For Zenpage items there are such links because of the keyword "news","news/category" and "pages" and also the custom pages "page/" so they update automatically in case the url structure changes.

Member
Member
vincent3569   2013-04-08, 17:24
#7

of course, I can write something like that in the code
Album Name
but with such a function is supposed to know if there is mode rewrite, or what is the albums structure.
so it would be more simple to have a function to avoid to rewrite some code if something changes somewhere else.

Member
Member
sbillard   2013-04-08, 17:33
#8

There is a mod rewrite function: rewrite_path('[i]album name[/i]', 'index.php?album=[i]album name[/i]')

Static album methods could not work anyway. A static object has no unique content, so would not have the album name. The only way to get that kind of information is to instantiate the album.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.