This topic is locked

Master detail on Add page

1/29/2007 7:03:04 AM
PHPRunner General questions
S
smaris author

Is there an easy way to display the Master Detail information also on the Add / Edit page of a record?

Just copying the block from the list page to the add page gives a runtime error on Smarty (resource "" not found).

I'm using PHPRunner 3.1
Tnx

J
Jane 1/29/2007

Stefan,
you can do the following:

  1. copy and paste this line to the Add and Edit page on the Visual Editor tab:

    {include file="$showmasterfile"}


  2. build your project


  3. open generated ..._add.php file, find following line:

    $smarty->display("order_details_add.htm");





and add this code snippet just before:

$mastertable=postvalue("mastertable");

if($mastertable!="")

{

$_SESSION[$strTableName."_mastertable"]=$mastertable;

// copy keys to session

$i=1;

while(isset($_REQUEST["masterkey".$i]))

{

$_SESSION[$strTableName."_masterkey".$i]=$_REQUEST["masterkey".$i];

$i++;

}

}

else

$mastertable=$_SESSION[$strTableName."_mastertable"];
// display master table info

$masterkeys=array();

$smarty->assign("showmasterfile","empty.htm");

if($mastertable=="TableName1")

{

// include proper masterlist.php code

include("include/TableName1_masterlist.php");

$masterkeys[]=@$_SESSION[$strTableName."_masterkey1"];

DisplayMasterTableInfo("TableName2", $masterkeys);

$smarty->assign("showmasterfile","TableName1_masterlist.htm");

}



where TableName1 is your master tabel, TableName2 is your detail table.

S
smaris author 1/29/2007

Great! Tnx....
But as I understand PHPRunner uptill now, each time I modify something in my project, and do a rebuild, I have to make these manual changes again... (and again... and again...).

J
Jane 1/29/2007

Yes, all changes will be moved when you rebuild your pages.

I recommend you to edit generated files after you complete the project.

N
nanohex 1/29/2007

Hopefully we will have more event code then PHPRunner will maintain the custom code.

I like Code Charge for this as it has events for everything and custom events.
Need more template designs though, all these generators have 1 or so templates.

What would be nice is project templates like simple forums, faq, etc..
So far I have tried allmost every genreator out there and
Phprunner is first in simplecity and CodeCharge in functionality.

All the others are a waste of time.