Search the Community
Showing results for tags 'maintain'.
-
Hi there just a first little piece of code for a simple maintainmode. Other CMS needs a setting or something else complicated.....and with PW you've simple tools to do that easy. Using 2.4 but with template setup from the actual dev with /templates/ _func.php /functions and navigation (with MarkupsimpleNavigation.... _init.php /init _main.php /template basic-page.php home.php ... so i wanna simple build up a page or later set it in to maintainmode without loosing access for bots.... so at now i'm setting up my first pw project i've the following code running perfect for building up the page: _init.php //setting the maintainpage $maintain = <<<EOT <html><head> <title>what you wanna show</title> <meta content="text/html; charset=utf-8" http-equiv="content-type"> <style> body { some basic style } </style></head> <body> <table align="center" border="0" cellpadding="0" cellspacing="0" width="400"> <tbody><tr> <td style="padding-top: 50px;" align="center" valign="top"><img src="my-fancy-logo"></td> </tr> <tr><td style="padding-top: 50px; text-align: center"> <p>Some text on the maintain thingi</p> </td> </tr> </tbody></table> </body></html> EOT; //headline or title $headline = $page->get("headline|title"); //maincontentblock $bodycopy = $page->body; // if the current page has a populated 'sidebar' field, then print it, // otherwise print the sidebar from the homepage $homepage = $pages->get("/"); if($page->sidebar) $sidebar = $page->sidebar; else $sidebar = $homepage->sidebar; // Include shared functions include_once("./_func.php"); and in my templates that shows the different pages (aren't to much in this project) basic-page.php // default settings and fuctions include("./_init.php"); if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT'])) { // main template for building the page include("./_main.php"); }; if ($user->isGuest()) { echo $maintain; } else { // main template for building the page include("./_main.php"); }; This is just quik and dirty so if i've the time i would make a simple function within the _func.php and get the _main.php include a little bit smarter, especial with much more template files this shouldn't be redundant/repeated... Further improvments could be a checkbox on a backend page /settings/ maybe.....to check on/off maintain mode.....so it would be a simple switch in the Backend even a client could do.Next step could be a maintain template to get the text and content editable in the backend for everyone....should be not that hard and would made it complete!Hope this is interesting for someone... have fun mr-fan - use PW is having fun every second for me since i've not the huge times for coding stuff -