Mixed dynamic/static pages

I have a site that I am thinking about updating to Yii that has a section ‘About’ that has around six subheadings. some are static information and some have to attach to a database. static pages go in the ../pages directory, if I understand the framework correctly.

How would I modify site/about from the default webapp to change show the dynamic pages.

example:

About

|- Contact Information => is static telephone numbers / mailing address / etc…

|- Press Releases => information is pulled from a database.

Any help is always appreciated. Thanks

I think you can do something like $model=Content::model()->findByPk($id); from a controller and then in rendered view you can put some static information (Contact information) followed by $model in Press release.

Of course you need a model to store data information.

HTH

Danilo

Are you saying to make a Model/Controller for each item?

I think I may not have explained my question fully.

I am working on a business website, Under the About menu:

About

|- Contact Us <= This is display of phone number, email & street addresses, etc. All

| this is static Information.

|- Advertise <= Basically a sales brouchre, also all static

|- Our Sponsors <= A listing of our spoporters, database fed (i.e. Sponsers model)

|- 2 more databased information pages

|- 2 more static Pages

In the CMenu, for Items/SubItems I was thinking that the links could be something like:

about/page, ‘view’=>‘contact’

about/page, ‘view’=>‘advertise’

about/sponsors,

about/press,

etc.

Thanks in advance.

You can do a page full static, or full db driven or both, my suggestion doesn’t change :)

In any case, for static content, you can put it directly inside the view. So in views/page/contact you can put:




<h1>this is my static content</h1>

<p>Simply put your static content in the view</p>



in the controller you render view without passing argument. Instead you have to pass argument when view needs content taken from a recordset. Example:




$this-render('sponsors',array('model'=>$model));



where $model contains db data. Then you can render $model in the view.

Of course you can mix static and dynamic data in your view:




<h1>this is my static content</h1>

<p>Simply put your static content in the view</p>

<?php print_r($model); // it takes data from $model, so from DB ?>

<p>And of course I can write other static contents here!</p>



Eh, I hope this helps (I’m a noobie too :P )