This topic is locked

add button control

11/11/2008 6:34:48 AM
PHPRunner General questions
G
garethp authorDevClub member

Hi
Think this is my last question on enabling me to change my current site to 5.0 - for now!
I have list page: before display event in 4.2...

if ($_SESSION["bom_masterkey1"]<>"")

{

$smarty->assign("addnew",1);

}

else

{

$smarty->assign("addnew",0);


This is to control whether the add button is visible.
I have also ammened the code in the visual editor by adding {if $addnew} to ...

<SPAN

class=buttonborder>{if $addnew}<INPUT class=button onclick="window.location.href='bom_add.php'" type=button value="Add new" disptype="control1">{/if}</SPAN>


Again, I just can't find how to do this in 5.0.

<SPAN

class=buttonborder><INPUT class=button type=button value="Add new" {$addlink_attrs}></SPAN>


I have not had these problems before on upgraded - is it because of changing to DIV?
Many thanks

Sergey Kornilov admin 11/11/2008

Excerpt from http://www.xlinesoft.com/phprunner/docs/smarty_templates.htm

view.htm

{BEGIN Model_fieldblock}
<tr><td class=shade width=150>Model</td><td width=250>
{$Model_value}&nbsp;
</td></tr>
{END Model_fieldblock}
In view.php file use the following:
$xt->assign("Model_fieldblock",true);- code snippet between {BEGIN ...} and {END ...} appears in the output.
$xt->assign("Model_fieldblock",false); - code snippet goes away.

G
garethp authorDevClub member 11/11/2008

Great - getting a bit better with the new language.
For anyone having problems this is what I have done...
if($_SESSION["sor_details_masterkey1"]=="")

{

$xt->assign("add_link",false);

}

else

{

$xt->assign("add_link",true);

}
in the list page: before display event. No need to make any changes in visual editor as the {BEGIN add_link} and {END add_link} are already in place around the add button.
Thanks again
Gareth

A
amuro 11/12/2008

vesion5.0 (build 587), try this
global $record;

if() {

$record["add_link"]=true;

} else {

$record["add_link"]=false;

}

G
garethp authorDevClub member 11/13/2008

Thanks Amura