Friday, July 27, 2012

Make underconstruction page in yiiframework

When you building a website you should have to think sometime when you are maintaining your website you should have to make your website off from the public.

And now to make that you can make a simple way to create under construction page

Here codes you can use in config main /protected/config/main.php. This trick does when you create empty file called underconstruction.txt in your root website.


return array(
  'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
  'name'=>'Your Site',
  'sourceLanguage'    =>'en_US',
  'language'          =>'en_US',
                'catchAllRequest' => (file_exists(dirname(__FILE__).'/../../underconstruction.txt')) ? 
die('<div style="text-align:center;line-height:300px;font-size:100px;>Under 
Construction</div>'): null,

That's code check all request to your yii site whether the file underconstruction.txt is exist or not in your root web directory. If it exist and then your website is under construction and view the message you have supply

2 comments:

  1. Thanks for sharing information about yii framework. if you want to know more about it please view this
    Yii framework Features and benefits

    ReplyDelete
  2. I Found this whole article useful. I hope this will help a thousands of people to make underconstruction page in html.
    Also see: Mobile App Development Company

    ReplyDelete