This topic is locked

smarty code

10/20/2008 4:19:40 AM
PHPRunner General questions
A
amuro author

Hello,
I want to use smarty code, if else condition code, at visual editor.
for example
{if $accno_value == "1141"}

goods selling

{else}

goods return

{/if}
It works fine at PHPR4.2, but not PHPR5.0.

please tell me how to code at the current version.
thanks a lot

J
Jane 10/20/2008

Hi,
what page do you use this code on?

A
amuro author 10/20/2008

Hi,
On list page.
The smarty variable is $row1.accno_value at PHPR4.2 but $accno_value at PHPR5.0.
Furthermore, the number format does not work at PHPR5.0.

The code, {$booamt_value|number_format}, should shows 2,500 like this format.

But nothing shows on the list page.
Thank you for your reply so soon. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=34181&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

A
amuro author 10/22/2008

Hi,

On list page.
The smarty variable is $row1.accno_value at PHPR4.2 but $accno_value at PHPR5.0.
Furthermore, the number format does not work at PHPR5.0.

The code, {$booamt_value|number_format}, should shows 2,500 like this format.

But nothing shows on the list page.
Thank you for your reply so soon. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=34214&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />


Now, I know that {if} condition of smarty can't be used at version 5.
If the code has to edit at php file, please tell me where to do this.
Thanks

J
Jane 10/23/2008

Hi,
please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages and I'll try to help you.

H
hasslehaas 10/23/2008

I'm trying to just output the value of a field (without the fields edit controls) on an edit page. In the last version just using {$fieldName_value} did the trick, but now it doesn't seem to work. Is there a different way I need to do this?
For example:

{BEGIN modelName_fieldblock}<TR>

<TD class=shade width=204>Model Name</TD>

<TD width=317>{$modelName_editcontrol}<hr>{$modelName_value}</TD>

</TR>{END modelName_fieldblock}
{$modelName_value} doesn't give any output.
I even copied the code from the VIEW page into the EDIT page to make sure I was using the the same syntax.

I'm using PHPRunner 5.0 build 435
Thanks

J
Jane 10/24/2008

Hi,
unfortunately there is no easy way to display field value on the edit page editing HTML code on the Visual Editor tab.

You can do the following:

  • add your code on the Visual Editor tab ({$modelName_value}),
  • add Edit page: Before display event on the Events tab.

    Here is a sample:
    if ($_REQUEST["editid1"])

    {

    $str = "select modelName from TableName where Key=".$_REQUEST["editid1"];

    $rs = db_query($str,$conn);

    $data = db_fetch_array($rs);

    $xt->assign("modelName_value",$data["modelName"]);

    }

H
hasslehaas 10/24/2008

That worked great thanks for the quick response!