Learning PHP and MySQL
Wednesday, September 27, 2006
Example 16-13 view_post.tpl
{section name=mysec loop=$posts}
<h2>{$posts[mysec].title}</h2>
{$posts[mysec].body}
<br />
Posted by <b>{$posts[mysec].first_name} {$posts[mysec].last_name}</b>
from the <b>{$posts[mysec].category}</b> category at
<b>{$posts[mysec].posted}</b>.<br />
{if $posts[mysec].user_id == $owner_id}
<a href="modify_post.php?post_id={$posts[mysec].post_id}&action=edit">Edit</a> ||
<a href="modify_post.php?post_id={$posts[mysec].post_id}&action=delete">Delete</a> ||
<a href="modify_comment.php?post_id={$posts[mysec].post_id}&action=add"
>Add a comment</a>
<br />
{/if}
{/section}
{if $comment_count != "0"}
<h3>Comments</h3>
{section name=mysec2 loop=$comments}
<hr />
<b>{$comments[mysec2].title}</b>
<br />
{$comments[mysec2].body}
<br />
Posted by <b>{$comments[mysec2].first_name} {$comments[mysec2].last_name}</b>
at <b>{$comments[mysec2].posted}</b>.<br />
{if $comments[mysec2].user_id == $owner_id}
<a href="modify_comment.php?comment_id={$comments[mysec2].comment_id}&action=edit"
>Edit</a> ||
<a href="modify_comment.php?comment_id={$comments[mysec2].comment_id}&action=delete"
>Delete</a>
<br />
{/if}
{/section}
{/if}
Posted by krautgrrl on 09/27 at 11:51 AM
Chapter 16 Code • (7) Comments • (226) Trackbacks • Permalink
Chapter 16 Code • (7) Comments • (226) Trackbacks • Permalink
Statistics
This page has been viewed 279811 times
Page rendered in 0.1395 seconds
Total Entries: 224
Total Comments: 16
Total Trackbacks: 307338
Most Recent Entry: 09/27/2006 12:39 pm
Most Recent Comment on: 10/26/2007 10:00 am
Total Members: 2
Total Logged in members: 0
Total guests: 10
Total anonymous users: 0
Most Recent Visitor on: 09/09/2010 03:36 pm
The most visitors ever was 1103 on 11/20/2007 12:50 pm
