Prev | Current Page 238 | Next

Hasin Hayder

"Object-Oriented Programming with PHP5"

php
foreach ($posts as $post)
{
echo "
";
echo "
{$post['title']}

";
echo "

".nl2br($post['content'])."

";
echo "Number of comments: ".(count($post['comments']));
echo "
";
}
?>
app/views/blog/post.php
echo "
";
echo "
{$post['title']}

";
echo "

".nl2br($post['content'])."

";
echo "Number of comments: ".(count($post['comments']));
echo "
";
foreach ($post['comments'] as $comment)
{
echo "
";
$time = date("Y-m-d",$comment['date']);
echo "Posted by {$comment['author']} at {$time}:
";
echo "{$comment['content']}";
echo "
";
}
?>

Post a new comment





Name:



Comment:





Building Better with MVC
[ 248 ]
app/views/blog/write.php

Write a new blog post





Title:



Content:





This will display the following form:
And last but not the least here comes the config file.


Pages:
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242