This topic is locked

Using Different Views

4/28/2009 4:52:18 AM
PHPRunner General questions
M
marke author

I have a master-details link from the list page. I want the link to go to a different details view (of the same table) based on the value of one column in the master table. I can generate the new view pages OK - but how do I modify the list page on the master table to allow it to select the right view depending on the value of the column 'extractionType'
thanks
Mark

J
Jane 4/28/2009

Mark,
use List page: After record processed event on the Events tab for this purpose.

Here is a sample:

global $record;

$masterquery="mastertable=orders";

$masterquery.="&masterkey1=".rawurlencode($data["FieldName"]);

if ($data["AnotherFieldName"]=="some value")

{

$record["DetailTableName_dtablelink_attrs"]="href=\"DetailTableName_list.php?".$masterquery."\" ";

$record["DetailTableName_dtablelink_attrs"].=" onmouseover=\"RollDetailsLink.showPopup(this,'DetailTableName_detailspreview.php'+this.href.substr(this.href.indexOf('?')));\" onmouseout=\"RollDetailsLink.hidePopup();\"";

}

M
marke author 4/28/2009

Thanks Jane
that's great that it can be done in an event rather than mucking about in the visual editor. Will give it a go.

M
marke author 5/13/2009

Jane
Got this working - had to make a couple of small changes

global $record;

$masterquery="mastertable=orders";

$masterquery.="&masterkey1=".rawurlencode($data["FieldName"]);

if ($data["AnotherFieldName"]=="some value")

{

$record["DetailTableName_dtablelink_attrs"]="href=\"DetailTableName_list.php?".$masterquery."\" ";

$record["DetailTableName_dtablelink_attrs"].=" onmouseover=\"RollDetailsLink.showPopup(this,'DetailTableName[color=#8B0000]ALTERNATEVIEW_detailspreview.php'+this.href.substr(this.href.indexOf('?')));\" onmouseout=\"RollDetailsLink.hidePopup();\"";

}


thanks for the help
Mark