coppermine-gallery.com/forum

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: nyltak on May 15, 2004, 04:56:59 AM

Title: [Solved]: custom fields html. I know you answered this but...
Post by: nyltak on May 15, 2004, 04:56:59 AM
I am looking to make one of my custom fields default to a hyperlink. I don't want my visitors to have to type in

<a href="http://www.link.com">link</a>  

just

http://www.link.com  

where the link text  is constant and the url is user input.

If someone could tell me where the code is that prints the table below the picture I would be grateful.


I have done this

QuotePosted: Thu Jul 10, 2003 4:52 pm    Post subject:    

--------------------------------------------------------------------------------

For me bb_decode do not work.
I wantet true HTML in a custom field and find that a Code:
<i>
were translatet to Code:
& lt;i&test&/i& gt;


So I repaced:
Code:
$info[$CONFIG['user_field'.$i.'_name']] = make_clickable($CURRENT_PIC_DATA['user'.$i]);


Code:
$info[$CONFIG['user_field'.$i.'_name']] = $CURRENT_PIC_DATA['user'.$i];
$info[$CONFIG['user_field'.$i.'_name']] = str_replace("& lt;", '<', $info[$CONFIG['user_field'.$i.'_name']]);
$info[$CONFIG['user_field'.$i.'_name']] = str_replace("& gt;", '>', $info[$CONFIG['user_field'.$i.'_name']]);
$info[$CONFIG['user_field'.$i.'_name']] = str_replace("& quot;", '"', $info[$CONFIG['user_field'.$i.'_name']]);



Note: the spaces betwen & and gt (& and lt) (& and quot) are only because this code isn“t shown right without them, remove them.

Now I can add pictures of awards in a custom field
Title: Re: custum fields html. I know you answered this but...
Post by: nyltak on May 15, 2004, 06:38:04 AM
Alright, I figured it out.  but I must say   arrays are a pain in the ass.

for ($i = 1; $i <= 4; $i++) {
        if ($CONFIG['user_field' . $i . '_name']) {
            if ($CURRENT_PIC_DATA['user' . $i] != "") {
$info[$CONFIG['user_field'.$i.'_name']] = '<a href=' .$CURRENT_PIC_DATA['user'.$i].' >'.$CURRENT_PIC_DATA['title'].'</a>';  
$info[$CONFIG['user_field'.$i.'_name']] = str_replace("&lt;", '<', $info[$CONFIG['user_field'.$i.'_name']]);
$info[$CONFIG['user_field'.$i.'_name']] = str_replace("&gt;", '>', $info[$CONFIG['user_field'.$i.'_name']]);
$info[$CONFIG['user_field'.$i.'_name']] = str_replace("&quot;", '"', $info[$CONFIG['user_field'.$i.'_name']]);