This topic is locked

Attaching a hyperlink to a database image

11/2/2006 4:26:34 AM
PHPRunner General questions
R
runey author

I've had a look around the forum, but haven't found a solution to this one yet... If one is available...
Basically I want to attach a hyperlink to a database image (Organiser Logo)... So when the user clicks on the image it will open a website (Organiser Website) in a seperate page...
I have been able to do this with text (Organiser Name) but when I select organiser_logo instead of organiser_name, all I get is gibberish... I'm doing this in the 'View As' Hyperlink setting by the way...
Any help will be appreciated <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=3742&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />

J
Jane 11/2/2006

Jason,
try to do the following:

  1. select nothing for the OrganiserWebsite field on the "View as" settings dialog on the Visual Editor tab.
  2. select Database image for the OrganiserLogo field on the "View as" settings dialog.

    Then highlight this field on the Visual editor tab, switch to HTML mode and replace highlighted text with something like this:
    <A href="http://{$row.1OrganiserWebsite_value}">;{$row.1OrganiserLogo_value}</A>

R
runey author 11/2/2006

Thanks for that lightning response Jane <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=12438&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />
Worked a treat with a slight change...

<A href="{$row.1OrganiserWebsite_value}">{$row.1OrganiserLogo_value}</A>


Basically just removed the http:// as it showed up twice...
If it's not pushing it I have one more related question... Is it possible to have that hyperlink open in a new window rather than the existing one?
Thanks again

J
Jane 11/2/2006

Sure.

Add target=_blank to your code:

<A href="{$row.1OrganiserWebsite_value}" target=_blank>{$row.1OrganiserLogo_value}</A>

R
runey author 11/2/2006

Answered my own question <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=12440&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
The following code will open the hyperlink in a new window...

<A href="{$row.1OrganiserWebsite_value}"> onclick="window.open(this.href,'newwin'); return false;">{$row.1OrganiserLogo_value}</A>


Thanks again Jane
EDIT: <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=12440&image=2&table=forumreplies' class='bbc_emoticon' alt=':lol:' /> Came up with a different answer while you must have been typing... Both work just great <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=12440&image=3&table=forumreplies' class='bbc_emoticon' alt=':)' />

R
runey author 11/3/2006

Me again <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=12463&image=1&table=forumreplies' class='bbc_emoticon' alt=':blink:' /> Rather than start a new topic I'll just add this question to this one, since it's related...
Basically I changed a bit of code to add an image to the hyperlink that links to the list in a master/detail relationship...

<A href="_event_themes_list.php?{$row.1_event_themes_masterkeys}"><IMG alt="Add Theme" src="images/add_theme.gif"></A>


Changes the text hyperlink to an image one <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=12463&image=2&table=forumreplies' class='bbc_emoticon' alt='B)' /> However there is an odd side effect... The image is now surrounded by a purple border <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=12463&image=3&table=forumreplies' class='bbc_emoticon' alt=':huh:' />
I can't find anything in the HTML code or CSS stylesheet that would account for it... Anybody got any ideas what it is and how to get rid of it?
Thanks again
EDIT: All sorted... Changed the code to this...

<A href="_event_guests_list.php?{$row.1_event_guests_masterkeys}"><IMG alt="Add Guest" src="images/add_guest.gif" border=0></A>


I'm not sure where it was getting the instruction to have a border, but this gets rid of it <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=12463&image=4&table=forumreplies' class='bbc_emoticon' alt=':)' />

J
Jane 11/3/2006

Jason,
I'm glad you were able to resolve it!