This topic is locked

Hyperlink on picture

6/10/2008 6:22:24 AM
PHPRunner General questions
M
mmponline author

I have a table with following fields:
ID

Picture

Hyperlink
I need to setup the list page in such a way that when the picture is clicked, it will open the link setup in the hyperlink field. How do I do this?

J
Jane 6/10/2008

Stephan,
use custom format on the "View as" settings dialog on the Visual Editor tab.

Here is just a sample:

global $data;

$value = "<a href=\"".$data["Hyperlink"]."\"><img src=\"TableName_imager.php?field=Picture&key1=".$data["ID"]."\"></a>";

M
mmponline author 6/10/2008

My image source is in the /files folder. How do I change the code.

Do I need to change TableName to my table's name?
Also, I'd like the link to open in a _blank page. How?

J
Jane 6/11/2008

Stephan,
yes, you need to change TableName with your actual table name.

To construct correct URL build your project, open in the browser, right click on the image and select Properties. Then copy and paste correct URL to your code.

To open window in the new page add target parameter to the <A> tag:

http://www.w3schools.com/html/html_links.asp

M
mmponline author 6/17/2008

Can't get this to work. Her is my code:

global $data;

$value = "<a href=\"".$data["Hyperlink"]."\"><img src=\"HousesToLetAdsUser_imager.php?field=RentAdPic&key1=".$data["RentAdID"]."\"></a>";


Hyperlink = Where the website address is stored.

HousesToLetAdsUser= Tablename (View of table HousesToLetAds)

RentAdPic = Where the picture is stored.

RentAdID= The ID of this specific table.
Result of the Picture's hyperlink (That does not display) when I check the properties in Internet Explorer:
http://finditmp.co.za.dedi50a.your-server....dPic&key1=1
Although my pictures should be in the images subfolder under finditmpdb, I also copied it to the finditmpdb folder without any success.
Please assist!

J
Jane 6/18/2008

Stephan,
please read my tips more carefully:

To construct correct URL build your project, open in the browser, right click on the image and select Properties. Then copy and paste correct URL to your code.

G
gparchuc 7/11/2008

Hi, i've the same issue and it's not working please some help.
the fields are

ID

Foto 1

Link 1
the images are saved in ../thumbnails
this is the custom code I'm inserting in the view as tab of the properties of the image field (Foto 1)
global $data;

$value = "<a href=\"".$data["Link 1"]."\"><img src=\"_Publicidades_imager.php?field=Foto 1&key1=".$data["ID"]."\"></a>";
the link works but the picture wont show.

J
Jane 7/14/2008

Hi,
if your images are stored on in the directory on the server use direct link to your images on the server:

global $data;

$value = "<a href=\"".$data["Link 1"]."\"><img src=\"thumbnails/".$data["Foto 1"]."\"></a>";


If it doesn't help publish your application to Demo Account (last tab in PHPRunner) and send me the URL where I can see and troubleshoot this issue.

M
mmponline author 7/14/2008

This works 100%
Thanks Jane! PHPRUnner is the best!!!