This topic is locked

Use Item as a View Link

2/5/2009 2:10:51 PM
PHPRunner General questions
M
mrphp author

I'm using PHPrunner 5.0. I have a list view that has colomns for "Edit", "Copy" and "View". Rather than have a "View" column, I would rather have one of the fields in the row be a link to view the record. For instance, I have a list view of equipment purchases. On one of the columns in the list view is the name of each item of equipment. I would like to click in the name to go to the actual record.

Can this be done?
Thanks.

J
Jane 2/6/2009

Hi,
yes, it's possible.

Set up this field as custom on the "View as" settingsdialog on theVisual Editortab.

Here is a sample code:

global $data;

$value = "<a href=\"tablename_view.php?editid1=".$data["RecordID"]."\">".$value."</a>";



where RecordID is your actual field name where ID is stored, tablename is your actual table name.

M
mrphp author 2/6/2009

Hi,

yes, it's possible.

Set up this field as custom on the "View as" settingsdialog on theVisual Editortab.

Here is a sample code:
where RecordID is your actual field name where ID is stored, tablename is your actual table name.


Thank you!

hichem 2/7/2009

Hi,

yes, it's possible.

Set up this field as custom on the "View as" settingsdialog on theVisual Editortab.

Here is a sample code:
where RecordID is your actual field name where ID is stored, tablename is your actual table name.


I tried this and worked fine. However when opening the view page the header of the view table containing showkey1 (in my case I have showkey1 and showkey2) displays the entire url as define above in $value. Is there a way to mask this url and only display the key number in showkey1 instead of this entire url? displaying the entire url stretches the table size too much.

I tried also to add 'target=_blank' as below for my field in teh visual editor but it didn't open it in a separate window?

{BEGIN ApplicationTypeId_fieldcolumn}<TD class=borderbody vAlign=middle align=middle {$ApplicationTypeId_style} target=_blank>{$ApplicationTypeId_value}

</TD>{END ApplicationTypeId_fieldcolumn}
many thanks Jane for your great support

J
Jepsen 2/8/2009

I am doing it this way.
I have a field holsing link to uploaded photo: link_photo

I have a field holding the title: title

I have a field kolding a url: link
Then I do the following. In SQL query I do this:

concat('<img src="', link_picture, '" width="150" onclick="java script:window.open(', "'", link, "', '_blank');", '">') AS Logo


On my application i display the "Logo" as htms and the Link as URl displaying title.
It looks like this: http://www.vaabenhistoriskselskab.dk/links..._links_list.php
In another application i use the following SQL Query:

concat('<img src="', "http://the address to a photo", forside_img, '" width="200" onclick="javascipt:window.open(', "'_AD_blankvaben_view.php?editid1=", id, "', '_self');", '" onmouseover="', "java script:this.style.cursor='hand';", '" onmouseout="', "java script:this.style.cursor='pointer';", '">') AS link_til_db


forside_img: field holding name of photo

id : database field holding the key
Then i display the link_til_db as html.
That looks like this: http://www.vaabenhistoriskselskab.dk/arma-...kvaben_list.php

M
mrphp author 2/19/2009

Hi,

yes, it's possible.

Set up this field as custom on the "View as" settingsdialog on theVisual Editortab.

Here is a sample code:
where RecordID is your actual field name where ID is stored, tablename is your actual table name.


Now that I am able to view an item by clicking on a a field in the List View, how do I get rid of the "View" column?

J
Jane 2/20/2009

Hi,
here is a sample:

global $data;

if (!$_REQUEST["editid1"])

$value = "<a href=\"tablename_view.php?editid1=".$data["RecordID"]."\">".$value."</a>";

hichem 2/22/2009

Hi,

yes, it's possible.

Set up this field as custom on the "View as" settingsdialog on theVisual Editortab.

Here is a sample code:
where RecordID is your actual field name where ID is stored, tablename is your actual table name.


Can this work if I have a table with 2 Primary Keys? So would want to show the record details if it fulfills 2 conditions, RecordID and RecordType for example.