coppermine-gallery.com/forum

No Support => Modifications/Add-Ons/Hacks => Mods: Miscellaneous => Topic started by: pslawinski on November 13, 2005, 02:34:21 AM

Title: Custom Fields in Seperate Table
Post by: pslawinski on November 13, 2005, 02:34:21 AM
This mod displays custom fields in a seperate table.  It is best if you have several fields so that the file information field does not get cluttered up.

displayimage.php

Find:

// Display picture information
function html_picinfo()


Replace With:

function html_custinfo()
{
    global $CONFIG, $CURRENT_PIC_DATA;

    for($i = 1; $i <= 4; $i++)
{
        if ($CONFIG['user_field' . $i . '_name'])
{
            if ($CURRENT_PIC_DATA['user' . $i] != "")
{
$tester = true;
                $info[$CONFIG['user_field' . $i . '_name']] = make_clickable($CURRENT_PIC_DATA['user' . $i]);
            }
        }
    }
if(!isset($tester))
{
return 0;
}
else
{
return theme_html_picinfo($info);
}
}

// Display picture information
function html_picinfo()


If you install my other mod (http://forum.coppermine-gallery.net/index.php?topic=23695.0) replace with:

function html_custinfo()
{
    global $CONFIG, $CURRENT_PIC_DATA;

    for($i = 1; $i <= $CONFIG['user_field_num']; $i++)
{
        if ($CONFIG['user_field' . $i . '_name'])
{
            if ($CURRENT_PIC_DATA['user' . $i] != "")
{
$tester = true;
                $info[$CONFIG['user_field' . $i . '_name']] = make_clickable($CURRENT_PIC_DATA['user' . $i]);
            }
        }
    }
if(!isset($tester))
{
return 0;
}
else
{
return theme_html_picinfo($info);
}
}

// Display picture information
function html_picinfo()


Find and comment out:

/*   
    for ($i = 1; $i <= 4; $i++) {
        if ($CONFIG['user_field' . $i . '_name']) {
            if ($CURRENT_PIC_DATA['user' . $i] != "") {
                $info[$CONFIG['user_field' . $i . '_name']] = make_clickable($CURRENT_PIC_DATA['user' . $i]);
            }
        }
    }

*/


Find:

$pic_info = html_picinfo();


Replace With:

$pic_info = html_picinfo();
$cust_info = html_custinfo();


Find:

theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip);


Replace With:

theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip, $cust_info);





theme.php

Add:

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

    $width = $CONFIG['picture_table_width'];

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

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


    echo $votes;

if($cust_info != "none")
{
$custinfo = "block";
}
else
{
$custinfo = "none";
}
echo "<div id=\"custinfo\" style=\"display: $custinfo;\">\n";
starttable("100%","Custom Information");
echo $cust_info;
endtable();
echo "</div>\n";

    $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";

}


See the mod in action here (http://www.lighting-gallery.net/gallery/displayimage.php?pos=-2161)

I've also attached a grab from the site.
Title: Re: Custom Fields in Seperate Table
Post by: Ian MacMillan on February 08, 2006, 07:57:00 PM
I am not able to get the fields to display... It creates the bar for where they should be, but nada.

http://www.portsmouthbranch.com/gallery/displayimage.php?album=1&pos=0
Title: Re: Custom Fields in Seperate Table
Post by: pslawinski on February 08, 2006, 08:52:25 PM
Turn on debug mode and see if there are any errors.  I need more information to help you.  I can't just guess what the error might be.
Title: Re: Custom Fields in Seperate Table
Post by: pslawinski on July 06, 2006, 04:40:45 AM
I'm not sure if anyone cares at this point but I located the problem with the mod as posted.  I neglected to post the last bit of code that goes on displayimage.php  I've tested the code as posted and it does work with CPG 1.4.8
Title: Re: Custom Fields in Seperate Table
Post by: François Keller on July 09, 2006, 10:54:21 AM
Hi,

I'm trying to install the mod on my cpg148 install, but i can't see any files info (same issue that Ian MacMillan)

Quote from: pslawinski on July 06, 2006, 04:40:45 AM
I'm not sure if anyone cares at this point but I located the problem with the mod as posted.  I neglected to post the last bit of code that goes on displayimage.php  I've tested the code as posted and it does work with CPG 1.4.8

can you post the last bit of code ? please  :D
Title: Re: Custom Fields in Seperate Table
Post by: François Keller on July 09, 2006, 11:26:33 AM
Ok, i've found the problem:
in theme.inc.php i've add:
starttable();
    echo $cust_info;
    endtable();

after
echo $votes;
Title: Re: Custom Fields in Seperate Table
Post by: pslawinski on July 09, 2006, 05:18:12 PM
I have this code in the code that I provided for themes.php

If I remember correctly it is nested within an If block that checks to make sure that at least one of the fields is filled out.
Title: Re: Custom Fields in Seperate Table
Post by: François Keller on July 09, 2006, 06:03:18 PM
you are right, i havent copy/paste the full code in theme.php  :-\

Thank's, it works fine
Title: Re: Custom Fields in Seperate Table
Post by: pslawinski on July 09, 2006, 06:38:59 PM
No problem, thanks for testing it for me.