Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Adding specific link under images  (Read 5180 times)

0 Members and 1 Guest are viewing this topic.

panatan

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 92
Adding specific link under images
« 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...
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Adding specific link under images
« Reply #1 on: November 04, 2007, 03:12:39 pm »

use bbcode in the file description
eg.
Code: [Select]
[url=http://www.somelink.com/Paris]Paris[/url]
« Last Edit: November 05, 2007, 07:54:51 am by Stramm »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Logged

panatan

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 92
Re: Adding specific link under images
« Reply #3 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://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fimg340.imageshack.us%2Fimg340%2F4731%2Fnewfielddd5.jpg&hash=cb40a60e03843ac8f209af55c2a992e99289d9ec)

Step 2 :
Insertion is done in database !

(https://forum.coppermine-gallery.net/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://forum.coppermine-gallery.net/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 ?
Logged

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Adding specific link under images
« Reply #4 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 -

Code: [Select]
$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 -

Code: [Select]
echo '< a href="  .$cat_link. "> Paris </a>';
just_some_guy,
Logged
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

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 92
Re: Adding specific link under images
« Reply #5 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   :-\
Logged

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Adding specific link under images
« Reply #6 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.
« Last Edit: November 05, 2007, 07:33:15 pm by just_some_guy »
Logged
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

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Adding specific link under images
« Reply #7 on: November 05, 2007, 06:44:17 pm »

Code: [Select]
{$CONFIG['TABLE_CATEGORIES]} should read
Code: [Select]
{$CONFIG['TABLE_CATEGORIES']}

panatan

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 92
Re: Adding specific link under images
« Reply #8 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
Logged

panatan

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 92
Re: Adding specific link under images
« Reply #9 on: November 05, 2007, 08:57:50 pm »

When i'm replacing
Code: [Select]
WHERE cid = $cid";with
Code: [Select]
WHERE cid = '$cid'";
following html code appear on the top of the page
 
Code: [Select]
< a href=" .$cat_link. "> Paris Something else is missing, but it's better than yesterday...
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 16 queries.