Webmastersite.net
Register Log In

Adding a URL link custom field?
how to

Comments on Adding a URL link custom field?

lex
Member

Usergroup: Member
Joined: May 26, 2005

Total Topics: 6
Total Comments: 16
lex
Posted Oct 13, 2005 - 12:12 PM:

I want to be able to add a custom field in which the user inputs a URL to be linked with the photo.

How do I do that.

If it makes more sense. Its for a client that has stock plans (house) in PDF format and we want to have it so when you go to the gallery you see a main JPG of the stock plan and the ability to add a link to the PDF file for download.

Any ideas will be well appreciated.

Thanks
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Oct 15, 2005 - 11:25 PM:

Use HTML to create links. <a href="{TEMPLATEVAR}">link</a>. Use the template variable which it tells you when you add the field.
lex
Member

Usergroup: Member
Joined: May 26, 2005

Total Topics: 6
Total Comments: 16
lex
Posted Oct 16, 2005 - 2:38 PM:

Thanks WORKED!!!!!
ryanmw2002
Member

Usergroup: Customer
Joined: Mar 31, 2008

Total Topics: 4
Total Comments: 12
Posted Sep 07, 2008 - 7:46 PM:

Would you be able to expound on how you do this exactly? Where would you put this html code at?

For example, I figured out how to add the field when submitting an image. However, I want it to be where I click on an image in the gallery, it goes to the enlarged image as normal. And then when I click on it again it should go to the linked site (from link field).


Thanks!
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Sep 09, 2008 - 6:59 AM:

Not sure which level of enlargement you mean. When you view a category you click a thumbnail to see a larger image, and then you can click another time to see the full-size image by itself. If you mean after step 2, the image details (aka details and comments, depending on switches selected) template can be edited to link to the URL. If you mean after step 3, that's just a download of the image itself so you'll want to edit the image details page to link to a custom template which includes the full size image linked to the external site. If you name the template fullsize.tpl, then in the image details template you would replace
<IF {SHOWREDUCED} is yes>
<a href="download.php?attachid={ATTACHID}&id={IMAGEID}"><img src="download.php?<IF not {EDIT}>width={PROPERWIDTH}&height={PROPERHEIGHT}&</IF>attachid={ATTACHID}&id={IMAGEID}&edit={EDIT}&action={ACTION}&useedit={USEEDIT}" alt="{IMAGEBOOKMARKTITLE}" border="0"></a>
<OTHERWISE>
<img src="download.php?attachid={ATTACHID}&id={IMAGEID}&edit={EDIT}&action={ACTION}&useedit={USEEDIT}" alt="{IMAGEBOOKMARKTITLE}">
</IF>
with
<IF {SHOWREDUCED} is yes>
<a href="link.php?action=detail&id={IMAGEID}&custom=yes&TID=fullsize"><img src="download.php?<IF not {EDIT}>width={PROPERWIDTH}&height={PROPERHEIGHT}&</IF>attachid={ATTACHID}&id={IMAGEID}&edit={EDIT}&action={ACTION}&useedit={USEEDIT}" alt="{IMAGEBOOKMARKTITLE}" border="0"></a>
<OTHERWISE>
<a href="link.php?action=detail&id={IMAGEID}&custom=yes&TID=fullsize"><img src="download.php?attachid={ATTACHID}&id={IMAGEID}&edit={EDIT}&action={ACTION}&useedit={USEEDIT}" alt="{IMAGEBOOKMARKTITLE}"></a>
</IF>


and fullsize.tpl would be
<a href="{IMAGEURLFIELD}"><img src="{IMAGEDOWNLOADURL}"></a>

ryanmw2002
Member

Usergroup: Customer
Joined: Mar 31, 2008

Total Topics: 4
Total Comments: 12
Posted Sep 10, 2008 - 7:14 PM:

Here is an example of what I want to happen.

Step 1: Someone attaches an image and then types WWW.GOOGLE.COM in the new custom link field (IMAGEURLFIELD), then submits.
Step 2: They go to the gallery, click on the thumbnail of their image, see their image in the details and comments page.
Step 3: They then click on the image in the details and comments page, and are then transferred to www.google.com. (preferably in a new window if possible)


I have reverted my templates back to default and started over. I did as you posted above but maybe I am not insterting the new (IMAGEURLFIELD) correctly. This goes into the Suggest Image template correct? I just kind of plopped it in there randomly.

<IF {IMAGENUMATTACHMENTS}>
<br />Current Attachments:<br />
<!-- BEGIN LINK ATTACHMENTS -->
<input type="checkbox" name="attachdelete[]" value="{ATTACHID}" /> {ATTACHFILETITLE} ({ATTACHKB} KB)<br />
<!-- END LINK ATTACHMENTS -->
<input type="submit" name="attachdeletion" value="Delete Selected" class="button" />
</IF>
</td>
</tr>
</IF>

<tr>
<td class="labelscolumn"><span class="labels">Insert Link:</span></td>
<td class="optionscolumn"><input type="text" name="addtags" size="{STANDARDSIZE}" value="{IMAGEURLFIELD}" /></td>
</tr>

<IF {SWITCH_TAGS}>
<tr>
<td class="labelscolumn"><span class="labels">Add Tags:</span></td>
<td class="optionscolumn"><input type="text" name="addtags" size="{STANDARDSIZE}" value="{IMAGEADDTAGS}" /></td>
</tr>
</IF>

Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Sep 11, 2008 - 4:42 PM:

You want the link at step 2, then. Go to the image details template as described above and change <a href="download.php?attachid={ATTACHID}&id={IMAGEID}"> to <a href="{IMAGEURLFIELD}">

Remove the changes you made to the suggest image template. When you add a field, it automatically places the code in the 'custom image fields' template. If you want to change where it displays, copy and paste it out of there to the desired location in the suggest image and edit image templates.
ryanmw2002
Member

Usergroup: Customer
Joined: Mar 31, 2008

Total Topics: 4
Total Comments: 12
Posted Sep 11, 2008 - 7:34 PM:

That's exactly what I was looking for!!!!! Thanks!
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.