Adding specific link under images Adding specific link under images
 

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

Adding specific link under images

Started by panatan, November 04, 2007, 01:50:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

panatan

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

Stramm

#1
use bbcode in the file description
eg. [url=http://www.somelink.com/Paris]Paris[/url]

Joachim Müller


panatan

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 ?

just_some_guy

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,
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

panatan

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

just_some_guy

#6
My bad, ignore this post to avoid confusion. I made a very basic error.

Stramm has corrected the error below.
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

Stramm

{$CONFIG['TABLE_CATEGORIES]} should read {$CONFIG['TABLE_CATEGORIES']}

panatan

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

panatan

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