1
0
mirror of synced 2024-12-13 22:56:04 +03:00

Fleshing out content and committed some new files.

This commit is contained in:
Jonathan.Wage 2007-09-06 17:42:07 +00:00
parent cdd4cb755c
commit af936d4742
8 changed files with 43 additions and 13 deletions

View File

@ -16,7 +16,9 @@ class blogActions extends sfActions
*/ */
public function executeIndex() public function executeIndex()
{ {
$blogPostTable = Doctrine_Manager::getInstance()->getTable('BlogPost');
$this->latestBlogPosts = $blogPostTable->retrieveLatest(5);
} }
public function executeView() public function executeView()

View File

@ -0,0 +1,10 @@
<?php
class blogComponents extends sfComponents
{
public function executeLatest_blog_posts()
{
$blogPostTable = Doctrine_Manager::getInstance()->getTable('BlogPost');
$this->latestBlogPosts = $blogPostTable->retrieveLatest(5);
}
}

View File

@ -0,0 +1,8 @@
<div id="latest_blog_posts">
<h3>Latest Blog Posts</h3>
<ul>
<?php foreach($latestBlogPosts AS $blogPost): ?>
<li><?php echo link_to($blogPost->getName(), '@blog_post?slug='.$blogPost->getSlug()); ?></li>
<?php endforeach; ?>
</ul>
</div>

View File

@ -0,0 +1,15 @@
<div class="content" id="blog">
<h1>Doctrine Blog</h2>
<?php foreach($latestBlogPosts AS $blogPost): ?>
<div class="blog_post">
<h2><?php echo link_to($blogPost->getName(), '@blog_post?slug='.$blogPost->getSlug()); ?></h2>
<p><?php echo $blogPost->getBody(); ?></p>
</div>
<?php endforeach; ?>
</div>
<?php slot('right'); ?>
<?php echo get_partial('latest_blog_posts', array('latestBlogPosts' => $latestBlogPosts)); ?>
<?php end_slot(); ?>

View File

@ -4,4 +4,8 @@
<?php slot('right'); ?> <?php slot('right'); ?>
<input type="button" name="back_to_blog" value="Back to Blog" onClick="javascript: location.href = '<?php echo url_for('@blog'); ?>';" /> <input type="button" name="back_to_blog" value="Back to Blog" onClick="javascript: location.href = '<?php echo url_for('@blog'); ?>';" />
<?php end_slot(); ?>
<br/><br/>
<?php echo get_component('blog', 'latest_blog_posts'); ?>
<?php end_slot(); ?>

View File

@ -16,9 +16,6 @@ class mainActions extends sfActions
*/ */
public function executeIndex() public function executeIndex()
{ {
$blogPostTable = Doctrine_Manager::getInstance()->getTable('BlogPost');
$this->latestBlogPosts = $blogPostTable->retrieveLatest(5);
} }
public function executeAbout() public function executeAbout()

View File

@ -17,12 +17,5 @@
</ul> </ul>
</div> </div>
<div id="latest_blog_posts"> <?php echo get_component('blog', 'latest_blog_posts'); ?>
<h3>Latest Blog Posts</h3>
<ul>
<?php foreach($latestBlogPosts AS $blogPost): ?>
<li><?php echo link_to($blogPost->getName(), '@blog_post?slug='.$blogPost->getSlug()); ?></li>
<?php endforeach; ?>
</ul>
</div>
<?php end_slot(); ?> <?php end_slot(); ?>

View File

@ -4,5 +4,6 @@
<li><?php echo link_to('download', '@download'); ?></li> <li><?php echo link_to('download', '@download'); ?></li>
<li><?php echo link_to('manual', '@manual'); ?></li> <li><?php echo link_to('manual', '@manual'); ?></li>
<li><?php echo link_to('api docs', '@api_documentation'); ?></li> <li><?php echo link_to('api docs', '@api_documentation'); ?></li>
<li><?php echo link_to('blog', '@blog'); ?></li>
<li id="last"><?php echo link_to('trac', '@trac'); ?></li> <li id="last"><?php echo link_to('trac', '@trac'); ?></li>
</ul> </ul>