coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: panatan on November 04, 2007, 01:50:53 PM

Title: Adding specific link under images
Post by: panatan on November 04, 2007, 01:50:53 PM
Hi all !

I would like to show a specific link for a specific categorie, under images (on displayimages.php only)
Specific link will be entered only by admin when categorie will be created

For example :
When admin create "Paris" categorie, he enter in text field "More info for <a href="http://www.paris.fr>Paris</a>"  (must have a "insert into")

When images of Paris categories are shown, link appears under images.

Do you know if a mod or a post is talking about that ?
Sorry for my bad english...
Title: Re: Adding specific link under images
Post by: Stramm on November 04, 2007, 03:12:39 PM
use bbcode in the file description
eg. [url=http://www.somelink.com/Paris]Paris[/url]
Title: Re: Adding specific link under images
Post by: Joachim Müller on November 05, 2007, 07:50:54 AM
http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#bbcode
Title: Re: Adding specific link under images
Post by: panatan on November 05, 2007, 10:45:32 AM
Thank you but i'm not sure that i'll have the right result.

In fact i would like to have for all pictures of a categorie, the same link with only one insert (it's hard to explain for me   :-[

I'll try to be better with images ...

Step 1 :
In "catmgr.php" i've added a new field

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fimg340.imageshack.us%2Fimg340%2F4731%2Fnewfielddd5.jpg&hash=cb40a60e03843ac8f209af55c2a992e99289d9ec)

Step 2 :
Insertion is done in database !

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fimg441.imageshack.us%2Fimg441%2F1921%2Fnewinsertiongq4.jpg&hash=ebca2f0d143de899ab4765269051435f605012fd)

Step 3 :
Here is my problem   :(

Instead of album/userpics... i would like to display my new insertion but nothing works !!!

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fimg213.imageshack.us%2Fimg213%2F982%2Fresultatph4.jpg&hash=0cd2c3dbf4717d752c72e01210bfb6b3b555dd0d)


I've modified bbcode but i'm a newbee with php and sql
How can i call and display my new insertion  ?

Could you give some clues ?
Title: Re: Adding specific link under images
Post by: just_some_guy on November 05, 2007, 05:35:38 PM
You have done most of the hard work. So you want the link below the picture to be the link in your Database?
Very easily done actually. All you need is a php/mysql statement link this -


$sql = "SELECT link FROM {$CONFIG['TABLE_CATEGORIES]} WHERE cid = $cid";
$result =cpg_db_query($sql);
while ($row = mysql_fetch_row($result));
$cat_link = $row['link'];


If you look throgh some of the code then you will find that coppermine already gets the category and adds it to the variable $cid. So the above code is selecting the value in the column "link" for the category the picture is in.

Usage -
echo out the value wherever you want. 

example -

echo '< a href="  .$cat_link. "> Paris </a>';

just_some_guy,
Title: Re: Adding specific link under images
Post by: panatan on November 05, 2007, 06:27:48 PM
Thank you very much !!!

Actually i've parse error   :'(
Parse error: syntax error, unexpected T_STRING, expecting ']'

I've paste your code in displayimage.php
I try to find what is wrong   :-\
Title: Re: Adding specific link under images
Post by: just_some_guy on November 05, 2007, 06:41:06 PM
My bad, ignore this post to avoid confusion. I made a very basic error.

Stramm has corrected the error below.
Title: Re: Adding specific link under images
Post by: Stramm on November 05, 2007, 06:44:17 PM
{$CONFIG['TABLE_CATEGORIES]} should read {$CONFIG['TABLE_CATEGORIES']}
Title: Re: Adding specific link under images
Post by: panatan on November 05, 2007, 08:24:50 PM
I'm always on error

French message from coppermine "Il y eu une erreur lors de l'exécution de la requête"

In lang/french.php
line 100 'database_query' => 'Il y eu une erreur lors de l\'exécution de la requête', //cpg1.4

Must be in english
line 100 'database_query' => 'There was an error while processing a database query', //cpg1.4

I don't know why.

Code has been placed in displayimage.php
Title: Re: Adding specific link under images
Post by: panatan on November 05, 2007, 08:57:50 PM
When i'm replacing
WHERE cid = $cid";
with
WHERE cid = '$cid'";

following html code appear on the top of the page

< a href=" .$cat_link. "> Paris
Something else is missing, but it's better than yesterday...