Custom Fields -- Creating dynamic URL Custom Fields -- Creating dynamic URL
 

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]

Main Menu

Custom Fields -- Creating dynamic URL

Started by cowgirlexpressions, February 16, 2005, 05:29:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cowgirlexpressions

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! :)

kegobeer

$caption .= "<br><span class=\"thumb_user2\"><a href='" . $rowset[key]['user2'] . "'>" . $rowset[$key]['user2'] . "</a></span>";
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

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

kegobeer

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


kegobeer

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

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

Casper

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;

$caption .= "<br><span class=\"thumb_user2\"><a href=" . $rowset[key]['user2'] . ">" . $rowset[$key]['user2'] . "</a></span>";
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

There should be quotes around the href

$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?
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

If Kegobeers code does not work, try this;

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

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

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.

cowgirlexpressions

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:) $caption = "<span class=\"head-blue\">";
$caption .= ($rowset[$key]['title']||$rowset[$key]['hits']) ? $rowset[$key]['title'] : '';

add this:
$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

Joachim Müller

Thanks for coming back and posting your solution.

Joachim