Move Custom field text upward on the page under Image view (single image view) Move Custom field text upward on the page under Image view (single image view)
 

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

Move Custom field text upward on the page under Image view (single image view)

Started by ironlady, February 18, 2010, 06:36:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ironlady

YES I have read the docs and searched the board.

My gallery can be seen at http://www.timesignaturesart.com/gallery

This is a new install (yesterday) and has not been modded (not even a logo, yet). I'm using the Classic theme for simplicity.

Currently, when a single image is viewed, the proper display is coming up (meaning that on the page, it is the image, the title underneath it, then the Filmstrip section, the Ratings, and underneath that the File Information section. This is fine.

I would like to move the fields for Price (and Artist, but that is the same question, essentially) up on the page, so that they display directly beneath the Title of the image, above the Filmstrip section.

I understand basic php and am fairly good with HTML, but I have not been able to locate the place I need to change the code to do this, despite searches of the forums. I suspect it is because the Custom fields are probably stored in arrays, which is admittedly a weak point of mine.

What line of code would I add to have the Price field appear below the Title? It is Custom Field #1 for the image.


Joe Carver

Everything you need to start with is outlined in your Docs and Sample theme directory.

http://www.timesignaturesart.com/gallery/docs/index.htm#creating

In this very topic you can see  Making a brand new theme, where to start?

If you really do know html and a little php once you start reading those instructions and open/edit the files you will do just fine

ironlady

Quote from: Joe Carver on February 18, 2010, 07:58:30 PM
Everything you need to start with is outlined in your Docs and Sample theme directory.

http://www.timesignaturesart.com/gallery/docs/index.htm#creating

In this very topic you can see  Making a brand new theme, where to start?

If you really do know html and a little php once you start reading those instructions and open/edit the files you will do just fine

Thank you for your kind response, Joe. But I'm afraid that afte reading those instructions several times and opening the files and reading them several times, I am not doing "just fine".

I have read the instructions. I know a little php and fairly good HTML, as I have stated. I understand how to pull a value from a database, for example, and display it on a Web page using php and mySQL commands. But so far, I have failed to find the information I need to perform the change I want to make. That's why I'm posting to the forum, respectfully asking for a little bit of help. I cannot find the correspondence between the Custom fields and the way they are handled in the code. This is not a simple script, and I am not a professional php coder; I'm a Chinese interpreter trying to put this up as a favor to my 80 year old mother. If someone can point me to the code that puts the Custom values into the array in the first place, for instance, at least I will know what I'm looking for. Right now I'm flying blind as I can't figure out where those values are coming from. The themes.php file seems like it only places an array. It does not address the Custom fields individually -- as far as I can figure out. If it does, please show me where and I'll gladly admit I missed it.

This is not the first time this question has been asked here. Perhaps the instructions need some rewriting, so that those of us who are not coding wizards can do these things?  Or at a minimum, perhaps it would be worthwhile to post a single answer to this question (which has been asked before and never answered) so as to stop us annoying people from asking it again?

I was asked to supply a link to my installation and all the relevant information. I have done so to the best of my knowledge and ability. I would truly appreciate someone taking the time to answer.


Jeff Bailey

Your Gallery is 1.4.25 did you install it from your host or here? The latest version is 1.4.26.

I don't see "Price" or "Artist" on http://www.timesignaturesart.com/gallery/displayimage.php?album=8&pos=0.
Can you post a link to a picture that does?
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

Joe Carver

Good observation Jeff - any new installation should be at the latest stable (and safest!) revision.

ironlady, It seems like you are trying to take an easy change - adding a custom field - and trying to make it an easy change to "move it up". The easiest thing to do would be to add the prices to the Image caption/description field.

However if you want to undertake the task of customizing the theme to put that custom field under the image you will find it to be a bit more involved than just a couple lines of code. Since I do not have the time and wherewithal to make and successfully test such a modification the best that I can do is try to point you closer to the right direction and wish you success.

In sample/theme.php:

The image info array is pulled and returned here:  function theme_html_picinfo(&$info)

The picture page is created with:
                              // HTML template for intermediate image display  
                             AND
                             // Displays a picture
                             function theme_html_picture()

Look at/near the end of that function

ironlady

Hello again,

Thanks for the responses. At least I feel like I'm not nuts -- this isn't a quick and easy fix that can be accomplished by simply reading the existing instructions. Thanks for pointing me to the locations that need to be dealt with, that really helps.

Here's a screen shot with the Price and Artist fields displaying correctly in the File Info block. (I think my mother is inputting the information into her other files, but it's taking her awhile, so perhaps the page you saw did not yet have that information added.)

You're right, I installed through my host (HostGator) using Fantastico...yes, kind of lazy I admit. Maybe I should update to the next version, but it would be easier (given that my mother has quite a lot of data input already) to just wait and/or poke my hosting provider to update their Fantastico installation version. I know how to install .php scripts but I really wouldn't want to mess up the connection to the database and have to worry about that. (This seemed like such an easy solution for her needs.  Sigh!) But even if I had the latest version, I think I would still be facing the same challenge to move a field.

This seems like (sorry to say it) a coding issue (user friendliness), based on the user interface..."custom" fields should be more directly manipulable than this, since the script is billed as being easily customizable (and generally is). How about writing a separate .inc file to place those custom fields, so that users can easily move them around? I don't even want to display technical file information, but I *do* want pricing to be separate and changeable without interfering with information that will never change, like titles.

Jeff Bailey

We don't support auto installers and you should still upgrade.

[tested] paste this into "themes/yourtheme/theme.php before the ?>  

function theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip)
{
    global $CONFIG;

    $width = $CONFIG['picture_table_width'];

    starttable();
    echo $nav_menu;
    endtable();

    starttable();
    echo $picture;
    endtable();

// new placement
    $picinfo = isset($_COOKIE['picinfo']) ? $_COOKIE['picinfo'] : ($CONFIG['display_pic_info'] ? 'block' : 'none');
    echo "<div id=\"picinfo\" style=\"display: $picinfo;\">\n";
    starttable();
    echo $pic_info;
    endtable();
    echo "</div>\n";

    if ($CONFIG['display_film_strip'] == 1) {
        echo $film_strip;
    }


    echo $votes;



//comment out old placement
/*   $picinfo = isset($_COOKIE['picinfo']) ? $_COOKIE['picinfo'] : ($CONFIG['display_pic_info'] ? 'block' : 'none');
    echo "<div id=\"picinfo\" style=\"display: $picinfo;\">\n";
    starttable();
    echo $pic_info;
    endtable();
    echo "</div>\n";*/

    echo "<div id=\"comments\">\n";
        echo $comments;
        echo "</div>\n";

}


[not tested] Then use this plugin -> http://forum.coppermine-gallery.net/index.php/topic,27407.html
to remove the data you don't want displayed

Hope that is what you are looking for
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

ironlady

Hi,

Just to make sure I understand, basically you're just moving the entire File Info block upward into position (by inserting a copy in the new position and commenting out the old code in the former position), and then the plugin should take care of getting rid of the unwanted information displayed in the block, leavinv behind the custom fields that I do want to display?

Sounds like that would work for me. I really don't care about displaying all the file information anyway -- what I'm doing isn't a photography site.  I just wish I knew enough to access the array directly and simply comment out or suppress the retrieval of the elements of the file info array that I don't want to display. It really should be very simple that way.

Anyway, it seems like that solution will work if the plugin does. I'll give it a try and report back when I do either to confirm that it worked and close the thread or to ask again. Thanks again!!

Jeff Bailey

The plugin is better then editing core files. $picinfo is compiled in displayimage.php which is a core file. You will lose your edits when you upgrade unless ofcourse you document them.
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

Jeff Bailey

sorry, forgot to answer your question.  ::)

Yes, all I did was move the whole file info box and hopefully the plugin will take care of the rest.

Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

ironlady

Unfortunately the plug-in does not seem to address Custom fields, as far as I can see, so it will not work for this purpose (although it seemed a very elegant solution to my particular problem, and would be, if it did address the Custom fields.)

Any other fixes??

ironlady

Beautiful! The plug-in gets rid of the undesirable fields like magic, leaving only what I want to display anyway. Brilliant!  Thanks all.