Page 1 of 1

Image Title showing with thumbnails possible ?

Posted: 18 Sep 2008, 11:43
by w3design
Ive been trying to do this myself with my limited skills but cannot get it to work, its probably not possible but no harm in asking.

In the HTML front end, when viewing a folder and the thumbnails display. Is there anyway to show the custom image title above each thumbnail ?

I tried myself by editing the template index_html.phtml and inserting the following code from the index_image.phtml file where necessary
Code
$fileAttributes = $this->file->getAttributes();
and
Code
 echo $fileAttributes['title']; 
but it gives me errors, probably because its not defined in the same php script that loads the folder/thumbnails info.

I tried to look at the ivFile.class.php & ivFolder.class.php but theres no way im going to understand exactly whats going on there :P


BTW I am using the flash version to great success, just wanted to do something else with the HTML version.

Thanks for an excellent gallery script !

Posted: 19 Sep 2008, 06:29
by Nick
Well it's already there, if you look below after div id=thumbnails:

title="<?php echo $item->getAttribute('title') ?>"

This is what you need.

Posted: 19 Sep 2008, 08:36
by w3design
Excellent thank you very much pain !! :D

Can do a lot of different things now with it, so happy.

Would teach me to go through the entire template/script :P


EDIT:

Im going to look if it is possible to include the {custom} tag in the thumbnail and image page, if you know off hand how to do it please post. Thanks :wink:

Posted: 19 Sep 2008, 15:14
by w3design
Figured out how to include any custom text/attributes if anyone ever wants to use it as well.

All the extra attributes that you define in

Admin > Config > Attributes > Image

must also be declared (not sure whats the correct programming lingo :P ) in include/ivFile.class.php under "Attributes @var array"

For example I added custom & price :
Code
	/**
	 * Attributes
	 * @var array
	 */
	var $_attributes = array(
		'title' => null,
		'description' => null,
		'custom' => null,
		'price' => null
Now you can use those extra attributes in the HTML template files.

If there is no other way of including custom attributes, wouldn't it be better to add the code in feature releases to automatically include all custom attributes as defined in Admin>Config. Would just give people so much more extra features they can add themselves without hacking the core files ?

Posted: 11 Oct 2008, 13:03
by Nick
This is already built-in, we made it this time with expansion in mind. But world domination never been easy...

Well, anyway, no need to hax0r classes, all you need to do is to use in phtml:

$this->file->getUserAttribute( 'attributeName' )

or

$this->file->getUserAttributes() to get list of them

There is some discussion on similar topic:

viewtopic.php?t=3768&highlight=getattribute