Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Custom Field used on other pages  (Read 4223 times)

0 Members and 1 Guest are viewing this topic.

Marcus Lovejoy

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Custom Field used on other pages
« on: April 06, 2004, 03:14:26 am »

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?
Logged

Nibbler

  • Guest
Custom Field used on other pages
« Reply #1 on: April 06, 2004, 04:17:43 am »

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

Code: [Select]

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


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

Code: [Select]

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


and add something like:

Code: [Select]

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


prior to :

Code: [Select]

$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.
Logged

ganast

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Custom Field used on other pages
« Reply #2 on: August 03, 2004, 07:39:33 am »

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
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Custom Field used on other pages
« Reply #3 on: August 03, 2004, 10:50:45 am »

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.
Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Custom Field used on other pages
« Reply #4 on: August 03, 2004, 08:12:26 pm »

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.
« Last Edit: August 03, 2004, 08:20:20 pm by ganast »
Logged

Nibbler

  • Guest
Re: Custom Field used on other pages
« Reply #5 on: August 03, 2004, 09:43:39 pm »

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.
Logged

ganast

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Custom Field used on other pages
« Reply #6 on: August 04, 2004, 12:16:45 am »

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
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 20 queries.