Custom Fields in Seperate Table Custom Fields in Seperate Table
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Custom Fields in Seperate Table

Started by pslawinski, November 13, 2005, 02:34:21 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

pslawinski

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

I've also attached a grab from the site.

Ian MacMillan

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
Yeah, I like that!

pslawinski

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.

pslawinski

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

François Keller

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
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

François Keller

Ok, i've found the problem:
in theme.inc.php i've add:
starttable();
    echo $cust_info;
    endtable();

after
echo $votes;
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

pslawinski

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.

François Keller

you are right, i havent copy/paste the full code in theme.php  :-\

Thank's, it works fine
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

pslawinski

No problem, thanks for testing it for me.