Smarty to PHP

Hi,

How would I convert this code from Smarty to Actual PHP?

Thanks!
LVL 3
Computer GuyAsked:
Who is Participating?
 
pius_babbunCommented:
Check this code
<?php if($error) { ?>
<a name="e">&nbsp;</a>
<table class="errmsg" <?php if $style != ""} echo "style=".$style."" ?> summary="Errors"><tr><td>
<?php 
foreach($error as e)
	echo $e
?>
</td></tr></table>
<?php } ?>

Open in new window

0
 
Loganathan NatarajanLAMP DeveloperCommented:
where is the code
0
 
Computer GuyAuthor Commented:
Woops!
{if $error}
<a name="e">&nbsp;</a>
<table class="errmsg" {if $style ne ""}style="$style"{/if} summary="Errors"><tr><td>
{foreach from=$error item=e}
{$e}
{/foreach}</td></tr></table>{/if}

Open in new window

0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
pius_babbunCommented:
Update this line


<table class="errmsg" <?php if ($style != "") echo "style=".$style.""; ?> summary="Errors"><tr><td>

Open in new window

0
 
Computer GuyAuthor Commented:
Hi,

Got this error: PHP Parse error: syntax error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM in

On this line: foreach($error as e)
0
 
pius_babbunCommented:
oh Yep!  $ symbol is missing .. check it up now ... change the following line
foreach($error as $e)

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.