coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 ecards & email => Topic started by: rob1111 on April 14, 2007, 06:34:14 AM

Title: Add album title to the ecards table
Post by: rob1111 on April 14, 2007, 06:34:14 AM
Does someone know how to set it so that the album title is also added to the
ecards table [along with all the other info] when a user creates an e-card?

I tried figuring this out for myself, believe me -- I installed phpmyadmin on my
server so that I could access the database in the first place, but I don't know
how to code it and not entirely sure which file(s) would need to be modified.

Thanks... :)
Title: Re: Add album title to the ecards table
Post by: Stramm on April 14, 2007, 09:27:44 AM
the query in ecard.php... change it to
$result = cpg_db_query("SELECT *, a.title AS alb_title from {$CONFIG['TABLE_PICTURES']} as p LEFT JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE pid='$pid' $ALBUM_SET");

few lines below after
$pic_title = $row['title'];
add
$alb_title = $row['alb_title'];

now you have the album title stored in the var $alb_title
use it wherever you want in the ecard (as you see you may need to add placeholders for the album title in the template and and some code in ecard.php to replace it)
Title: Re: Add album title to the ecards table
Post by: rob1111 on April 14, 2007, 07:45:24 PM
Thanks, I added the code, but I don't see an album title column in the
ecards table or the 'Display E-cards' page in the Admin section.

I guess what I'm asking is how to set it up so the album title shows up
in those two places, or just the database really. Or would it be easier to
somehow instruct the ecards table to add an album title column to its
table that pulls the album title from the picture it has.

Thanks again
Title: Re: Add album title to the ecards table
Post by: Stramm on April 14, 2007, 08:08:48 PM
hmm, I misunderstood you... thought you wanted to add the album title to the ecard itself.
But check the changes I posted. Thats the way to get the album title... join the albums table with the pictures table. That way you do not need the 'album title column' again in the ecards table
Title: Re: Add album title to the ecards table
Post by: rob1111 on April 15, 2007, 12:50:29 AM
How do you do that?