How Do I Construct Home Page With Various Dynamic Functions?

I have a home page layout which contains header, footer with dynamic sections like News & Events, Upcoming events, Latest Newsletter display, Priest profile with name, photo etc.,

Each dynamic section has admin part to manage (CRUD) … Now, I want to show the public for their access. How do I construct these sections?

Do I need to have helper functions like (components/widgets) and call them in the home page? What is the best approach to do?

Usually, I write some methods and call them in the home page sections.

Please advise

I’m guessing that your site controller can just call some Models or Model’s methods to get each of what you need, then pass them over to the view and print whatever data you want.


public function actionIndex(){




$this->render('index', array(






Then you just use them in your view however you see fit. For example, some JQuery slider.

<section class="news slider">

<?php foreach($news as $new): ?>

<div class="new">

<h2><?php echo $new->title; ?></h2>

<p><?php echo $new->contentExcerpt; ?></p>


<?php endforeach; ?>


Thanks, I can do that way also… I am thinking to do some common functions and call them specially for home page.