//This is a demostration of CloudView. Keep in mind this is
//pre-alpha software: bugs and glitches are to be expected.
require_once ('CloudView/CView.php');
require_once ('CloudView/CContainer.php');
require_once ('CloudView/CURL.php');
require_once ('CloudView/CImage.php');
require_once ('CloudView/CHeader.php');
require_once ('CloudView/CMessageBox.php');
require_once ('CloudView/CSplit.php');
/**
* This is the only configuration necesary: just tell
* CView the path to your public folder (or wherever your
* css, img and js folders are located).
*
* CView will look for css files like CContainer.css or
* CURL.css automatically. This allows you, the developer,
* to design your pages in small controlled sections.
*/
CView::$ROOT = '/home/groups/c/cl/cloudview/htdocs/public/';
CView::$URL_ROOT = 'http://cloudview.sourceforge.net/public/';
//first, create a header for our page. And create an image while we're at it.
$header = new CHeader();
$header->get_header()->contents = new CImage(CView::$URL_ROOT.'img/cloudview_medium_white.png', 'CloudView');
//then also create some urls for our navigation bar.
$home = new CURL('index.php', "Home");
$forge = new CURL('https://sourceforge.net/projects/cloudview/', "SourceForge");
$code = new CURL('http://cloudview.svn.sourceforge.net/viewvc/cloudview/', "Get Source");
$demo = new CURL('demo.php', "View Demo");
//Add the urls to the navigation bar.
$nav = $header->get_navigation_bar();
$nav->add_component($home);
$nav->add_component($forge);
$nav->add_component($code);
$nav->add_component($demo);
//Lets set home as the current page
$nav->current_item = $demo;
//... then create a few posts
$post1 = new CMessageBox();
$post1->title = "Hello, world!";
$post1->sub_title = "By me";
$post1->contents = "Welcome to CloudView! See how all CSS and JS dependencies are automatically sorted out!";
$post2 = new CMessageBox();
$post2->title = "CSplit is as easy as it gets!";
$post2->sub_title = "By me";
$post2->contents = "
CSplit arranges objects horizontally in whatever ammount or proportion you want!
";
//now to arrange our posts horizontally...
$split_screen = new CSplit();
$split_screen->add_component($post1, 30);
$split_screen->add_component($post2, 30);
//Now let's put it all together!
$page = new CContainer();
$page->add_component($header);
$page->add_component($split_screen);
//I want to put a blue background, so lets make this one white:
$page->css_options['background'] = "#fff";
//Post the source by the side, but first, lets get the source first.
$source_code = file_get_contents("source.txt");
$page2 = new CMessageBox();
$page2->title = "Here's the source, 99% PHP";
$page2->sub_title = "Hassle free! fully reusable! easily extendable!";
$page2->contents = $source_code;
//Code is best displayed monospaced, quick-fixes like these can
//easily be done by altering the css a little.
$page2->css_options['font-family']= "monospace";
//One last CSplit
$final_page = new CSplit();
$final_page->title = "Welcome to CloudView";
$final_page->add_component($page, 40);
$final_page->add_component($page2, 50);
$final_page->css_options['min-width'] = "1200px";
//Lastly, lets inject some css to make the body a nice blue:
$final_page->add_stylesheet("body{background: #686fff;}", false);
//Time to show it to the world!
echo $final_page->htmldoc();