Custom Field used on other pages Custom Field used on other pages
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Custom Field used on other pages

Started by Marcus Lovejoy, April 06, 2004, 03:14:26 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Marcus Lovejoy

I have added the four custom fields available to me and they show up great in the Picture information section of the Display Image page.  I would like to use the custom field information on other sections of the site.  For example one of my fields is a part number field and I would like to have that show up under the thumbnails in the thumbnails.php page along with the name and discription of the image.  How do I go about accessing the custom fields on other pages?

Nibbler

Thumbnail captions are generated in includes/functions.inc.php. You will need to find:


if($select_columns != '*') $select_columns .= ', title, caption,hits';


and add the custom fields you want into the end, eg.


if($select_columns != '*') $select_columns .= ', title, caption,hits,user1';


and add something like:


$caption .= "<span class=\"thumb_caption\">" . $rowset[$key]['user1'] . "</span>";


prior to :


$rowset[$key]['caption_text'] = $caption;


- depending on where exactly you want the extra info.

If you have any probs, i'll try it myself and give you an exact answer.

ganast

OK, I just uploaded 1.3.1 and am testing this software for a website I am working on. I added names in two of the Custom Fields... and they never come up in the whole gallery... like anywhere... I never see the user1 or user2 data.

I checked config, and:

-- "Display file caption (in addition to title) below the thumbnail" is checked 'yes' (and the caption does indeed display)
-- "File information is visible by default" is checked 'yes'

and I edited functions.inc.php file according to the parent:

here's a clip...

                if($select_columns != '*') $select_columns .= ', title, caption,hits,owner_id,owner_name,user1,user2';

...and another...

                if ($set_caption) foreach ($rowset as $key => $row){

                        $caption = "<span class=\"thumb_title\">";
                        $caption .= ($rowset[$key]['title']||$rowset[$key]['hits']) ? $rowset[$key]['title'] : '';

                        if ($CONFIG['views_in_thumbview']){
                                if ($rowset[$key]['title']){$caption .= "&nbsp;&ndash;&nbsp;";}
                                $caption .= sprintf($lang_get_pic_data['n_views'], $rowset[$key]['hits']);
                        }
                        $caption .= "</span>";

                        $caption .= "<span class=\"thumb_size\">";
                        $caption .= $rowset[$key]['user1']."</span>";
...

if you want to see the debug output, it is turned on for everyone and can be seen here:

http://clintcearley.com/cpg/displayimage.php?album=lastup&cat=0&pos=1

...'user1' never comes up in any of the queries...

Thanks,

--gabe

Casper

These fields only show up on the image display if they actually contain some input.

The fields should show on the upload and edit pages, so you can add this info, then they will show.

If that does not work, please give a test user account(non-admin), with upload permissions and an album the test user can upload to.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

ganast

#4
Oh yeah, sorry about that... I only added info to the fields of like six or eight of those photos at the end of the gallery... now they all have user1 ("user1 - foo") and user2 ("user2 - bar") data, and there is now a test user account called 'barlow' with password of 'barlow2'

Thanks for the quick reply!

--gabe

PS: the terms 'user1' and 'user2' (and presumably 3 and 4) should still show up in the queries in the debug output regardless of whether they have data.

Nibbler

They do, and it seems to display fine.

Quote[10] => SELECT pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid, title, caption,hits,owner_id,owner_name,user1,user2 from cpg131_pictures WHERE aid='6'  AND approved='YES'  ORDER BY pid ASC  LIMIT 0 ,3

I'm not sure what you are getting at here.

ganast

I really have no idea what just happened... sorry for the posts...

the only difference between my setup when I originally posted and now is that I did not have all the fields 'title', 'caption', 'user1', and 'user2' populated for every image before... I'll try to mess with this to see if I can produce the error again.

Thanks

--gabe