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: Custom Fields -- Creating dynamic URL  (Read 4973 times)

0 Members and 1 Guest are viewing this topic.

cowgirlexpressions

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 27
  • Cowgirl Expressions
    • Cowgirl Expressions
Custom Fields -- Creating dynamic URL
« on: February 16, 2005, 05:29:01 pm »

I'm using the custom fields Mod/Hack and have displayed my User2 field on my thumbs page.  I am using that field as a URL.  The only thing I type in the field is the http://domain.com name and it shows up just as that.  I've tried hacking the line in the includes file, but keep getting errors.  As I am no PHP coder, I know this can't be too hard.

Here's what I have...

$caption .= "<br><span class=\"thumb_user2\"><a href='$rowset[key]['user2']'>" . $rowset[$key]['user2'] . "</a></span>";

Why is this not working?

Thanks!

EDITED TO ADD:  SOLUTION FOUND -- SEE FINAL POST! :)
« Last Edit: April 21, 2005, 10:33:51 am by GauGau »
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: Custom Fields -- Creating dynamic URL
« Reply #1 on: February 16, 2005, 06:21:39 pm »

Code: [Select]
$caption .= "<br><span class=\"thumb_user2\"><a href='" . $rowset[key]['user2'] . "'>" . $rowset[$key]['user2'] . "</a></span>";
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

cowgirlexpressions

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 27
  • Cowgirl Expressions
    • Cowgirl Expressions
Re: Custom Fields -- Creating dynamic URL
« Reply #2 on: February 16, 2005, 07:55:34 pm »

This code makes it link back to the album the particular image is in....  ???
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: Custom Fields -- Creating dynamic URL
« Reply #3 on: February 17, 2005, 02:04:15 am »

Link to your site please. 
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

cowgirlexpressions

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 27
  • Cowgirl Expressions
    • Cowgirl Expressions
« Last Edit: April 20, 2005, 12:56:58 am by cowgirlexpressions »
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: Custom Fields -- Creating dynamic URL
« Reply #5 on: February 17, 2005, 12:43:06 pm »

All I see is two albums, one with one image and the other is empty.  The intermediate image displays just the picture with no other information shown.  I've attached a screenshot to show what I see.

Basically, it looks like you've edited your theme so much, there isn't anything for the viewers to see except your picture.
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

cowgirlexpressions

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 27
  • Cowgirl Expressions
    • Cowgirl Expressions
Re: Custom Fields -- Creating dynamic URL
« Reply #6 on: February 17, 2005, 03:14:29 pm »

keg,

I'm so sorry about that.  I was having problems with having duplicate albums and was trying to get that fixed at the same time and in the process deleted some of the files and when they were re-added the descriptions weren't.  However, I have that issue fixed, and have re-added everything to show up as I want.  You can now go to that first album and see where the link in question is.  It shows up fine, but if you look at the URL it points to the album instead of the actual URL that has been entered into the user2 box.

Thanks,
Ramsey
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Custom Fields -- Creating dynamic URL
« Reply #7 on: February 17, 2005, 05:19:47 pm »

Your source code is showing this;

Quote
<a href=''>http://www.runninghorses.net/</a>

As you can see the actual a href is empty, so it links to the site it is in.

Try changing the code to this;

Code: [Select]
$caption .= "<br><span class=\"thumb_user2\"><a href=" . $rowset[key]['user2'] . ">" . $rowset[$key]['user2'] . "</a></span>";
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: Custom Fields -- Creating dynamic URL
« Reply #8 on: February 17, 2005, 05:48:02 pm »

There should be quotes around the href

Code: [Select]
$caption .= "<br><span class=\"thumb_user2\"><a href='" . $rowset[key]['user2'] . "'>" . $rowset[$key]['user2'] . "</a></span>";
I posted this earlier in this thread.  Did you make this change to your code when I posted it?
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Custom Fields -- Creating dynamic URL
« Reply #9 on: February 17, 2005, 06:09:11 pm »

If Kegobeers code does not work, try this;

Code: [Select]
$caption .= "<br><span class=\"thumb_user2\"><a href=\"'{$CONFIG['user_field2_name']}'\">" . $rowset[$key]['user2'] . "</a></span>";
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

cowgirlexpressions

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 27
  • Cowgirl Expressions
    • Cowgirl Expressions
Re: Custom Fields -- Creating dynamic URL
« Reply #10 on: February 18, 2005, 03:35:35 pm »

Hmm... Neither of those worked.... and I tried a few different variations too, but couldn't get anything to work either.  Here's what I wanna know tho -- if you click on the actual image, in the next page, there is the link just like I want it.  But I checked my files and couldn't seem to find where that link is created.
Logged

cowgirlexpressions

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 27
  • Cowgirl Expressions
    • Cowgirl Expressions
Re: Custom Fields -- Creating dynamic URL
« Reply #11 on: April 20, 2005, 12:54:52 am »

Just to follow up with this for those who might come across it in a search -- I *finally* figured this out on my own (and feeling SO proud because I am NO coder by any means).  The correct way to make a link clickable to the proper URL in your thumbnail view is to set one of your custom fields to be the url box, and whatever field you use (I used #2 in this example), do the following:

In the functions.inc.php file, look for:
// Retrieve the data for a picture or a set of picture
function get_pic_data

And then find
// Set picture caption

After the first two $caption lines (they'll look something like:)
Code: [Select]
$caption = "<span class=\"head-blue\">";
$caption .= ($rowset[$key]['title']||$rowset[$key]['hits']) ? $rowset[$key]['title'] : '';
add this:
Code: [Select]
$caption .= make_clickable($rowset[$key]['user2']);  (note: change the user2 variable to be whatever field you used for your custom fields for the url)

This will make a very easy URL clickable link displayed in your thumbnail view!

Hope that was easy to follow...  ;) ;D
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Custom Fields -- Creating dynamic URL
« Reply #12 on: April 21, 2005, 10:34:15 am »

Thanks for coming back and posting your solution.

Joachim
Logged
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 15 queries.