how to integrate a static site (made on procedural method) with yii?

Hi guys,

I have a site made in procedure html/php, and I need create a system to manager news and articles, how can I integrate my actual website with the new system?

Actually, the site dont’t have any server-side system, only some complex views.



I’m not sure if this is the best solution for it, but I’d create a controller/action pair and copy the “static HTML” into the view part ie:

// OldsiteController.php


public function actionContact()


  $this -> render( 'contact' );



public function actionAbout()


  $this -> render( 'about' );



if you have more than 10 pages though …


This cookbook page probably fits your needs better.

Hi guys, now I understand how make this.


If you want to tidy up the way the urls look, then this might help.

Hi folks,

I’m implementing this changes in my app and I have one question:

How can I share a partial for all views?


I have a bit complex box partial view stored as views/_box.php, which can be called as follows:




Hope this helps.

Egads! The docs for CContentDecorator are cyptic. After some trial and error, is the intended way to use it like this?

In a view file:

Decorate me.

<?php $this->beginContent('_decorate');

<p>Some stuff.

<p>More stuff.


Where _decorate is another view file, say:

I am the decorator.

<?php print $content;

Is that the idea?

Hi Pestaa,

I think that in my case is diferrent, I intend to create some partials and put on a directory called share (like in rails), and call this partials when necessary in my views.

It’s possible?


Seems to be possible. This worked for me within a views/message view file

<? $this->beginContent('/site/pages/about');?>

<? $this->endContent('/site/pages/about'); ?>

The docs for beginContent() appear to be incorrect, since they claim that the view script is resolved via getViewFile(), but that resolves to a path.


Yes, just put them right in views dir and call renderPartial(’…/[…]’) in your view files.


Since content decorator is used as a widget, your endContent() call should omit its parameter. (It calls endWidget internally.)

beginContent() does resolve view file with getViewFile() which accepts paths as well. If I remember well.

Thanks guys,

the problem was resolved.