| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #2 (permalink) | ||||
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Code: {foreach from=$comments item=comment}
<div class="comment">
Name: {$comment.name|strip_tags|replace:'\\'':''}<br />
Message: {$comment.message|strip_tags|replace:'\\'':''}<br />
<small>Posted on: {$comment.date_added|strip_tags|replace:'\\'':''}</small>
</div>
{/foreach} PHP Code: | ||||
| |
| | THREAD STARTER #3 (permalink) | ||||
| NamePros Regular Join Date: Jan 2006 Location: San Diego, CA
Posts: 735
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
First one returns this error: Fatal error: Smarty error: [in item.tpl line 83]: syntax error: unrecognized tag: $comment.name|strip_tags|replace:'\\'':'' (Smarty_Compiler.class.php, line 415) in Smarty.class.php on line 1084 Second one (I'd prefer to do it this way) returns the letter 'A' for all of the results for some reason. Also, is there anything anyone recommends as far as inserting the data?
Last edited by DylanButler; 05-21-2007 at 02:17 PM.
| ||||
| |
| | #4 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Ok, try this then PHP Code: |
| |
| | #6 (permalink) |
| Buy my domains. Join Date: Feb 2006
Posts: 2,796
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | I've never used SMARTY or whatever it is, and so that seems kind of pointless to me. It looks like all it's doing is kind of putting code into an HTML file without using PHP. You might as well just use a PHP file and run the code, so it's more flexible. (I'm probably way off on that, but that's how it looks to me.) I've tried using Django (Python) which uses template files. It seems like a cool idea, but it's easier for me in PHP to just use the dynamic code throughout the template. |
| |
| | #7 (permalink) | ||||
| NamePros Regular Join Date: Jul 2006 Location: Karachi
Posts: 791
![]() ![]() ![]() ![]() ![]() |
The other advantage is that it allows you to separate the programming logic from the presentation. If you're using PHP for your templates you're allowing each and every designer access to your core code. The disadvantage, as you pointed out, is that it is harder for the programmer to integrate smarty into his script.
Last edited by abdussamad; 05-24-2007 at 03:55 PM.
| ||||
| |