This topic is locked
[SOLVED]

 How to modify the path of the Edit/View/Add link in a list page?

7/31/2008 6:54:02 AM
PHPRunner General questions
L
laurent author

My objective is to have different fields visible in the Edit/View/Add page depending on the value of a status field of the record in _MyTable
So I would like to custom assign the path of the Edit/View/Add link in my list page of _MyTable_View_1 to point to the Edit/View/Add page of _MyTable_View_2.

I have tried to replace by a smarty {editpath} the static link of the Edit href in the HTML code of the list page of _MyTable_View_1:

Initial Code:

<TD class=borderbody vAlign=middle align=middle><A class=tablelinks

href="_MyTable_View_1_edit.php?{$row.1editlink}">Edit</A></TD>{/if}{if $allow_add}
Modified Code:

<TD class=borderbody vAlign=middle align=middle><A class=tablelinks

href="{editpath}{$row.1editlink}">Edit</A></TD>{/if}{if $allow_add}



Note that the smarty is well define in the before display event

$myeditpath= "_MyTable_View_2_edit.php?";

echo "myeditpath= " .$myeditpath;

$smarty->assign("editpath",$myeditpath);
But I have the following error when displaying the list page of _MyTable_View_1:

Error type: 256

Error description: Smarty error: [in _MyTable_View_1_list.htm line 517]: syntax error: unrecognized tag 'editpath' (Smarty_Compiler.class5.php, line 580)
How to construct this kind of dynamic path for the href of the Edit/View/Add link of the list page?
Thanks.

J
Jane 7/31/2008

Please see my changes in Bold:

<TD class=borderbody vAlign=middle align=middle><A class=tablelinks

href="{$editpath}{$row.1editlink}">Edit</A></TD>