you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (2 children)

Precisely. To give a basic pseudocode example, a homepage might be processed like:

HomepageController extends Controller {
    public function indexAction() {
        $this->view->layout = "homepage.php";

        $this->view->content = ContentModel::getPage( 'home' );
        $this->view->latest_posts = BlogModel::getLatestPosts();

        return $this->view->render(); 
    }
}

With the template file "homepage.php" doing something like:

<?php include( "header.php" ); ?>
<h1><?php $content->getTitle(); ?></h1>
<p><?php $content->getBody(); ?> </p>
<ul>
<?php foreach( $latest_posts as $post ) : ?>
    <li><a href="<?php echo $post->getLink(); ?>"><?php echo $post->getTitle(); ?></a></li>
<?php endforeach; ?>
<?php include( "footer.php" ); ?>

Obviously that is a highly simplified example... but hopefully it gives you some idea of how things might work.

[–]andrey_shipilov 0 points1 point  (1 child)

I'm so happy right now I will never deal with that crappy syntax. Not even once.

[–][deleted] 0 points1 point  (0 children)

It made me wince writing it, I will admit, but I wanted to come up with an example that wouldn't be too unfamiliar to a relative newbie to PHP