Permalink
Browse files

added base styling

  • Loading branch information...
1 parent d74c434 commit c47efc5c2493fe2bbdb7d629c90f3a5ac73c1d6e @beezee committed Apr 7, 2012
View
@@ -12,6 +12,8 @@
$app->baseurl = $baseurl;
+$app->app_name = $appname;
+
R::setup("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpw);
//discover and register models
View
@@ -1,6 +1,6 @@
<?php
- $dbhost = 'localhost';
+$dbhost = 'localhost';
$dbname = '';
$dbuser = '';
$dbpw = '';
View
@@ -109,16 +109,15 @@ public function renderItem($id)
$props = '';
foreach($this->properties as $prop => $val)
{
- $props .= $tpl->copy('property')->replace('propName', $prop)->replace('propVal', $model->$prop);
+ $props .= $tpl->copy('property')->replace('propname', $prop)->replace('propval', $model->$prop);
}
return $output
->replace('new_link', '')
->replace('id', $model->id)
- ->replace('property', '')
- ->replace('propVal', $model->{$this->toString})
+ ->replace('property', $props)
+ ->replace('propval', $model->{$this->toString})
->replace('plural', $this->plural)
->replace('toString', $model->{$this->toString})
- ->replace('property', $props)
->replace('base_url', $this->app->baseurl);
}
}
View
@@ -39,4 +39,13 @@ public function setRoutes(array $routes)
{
$this->routes = array_merge($this->routes, $routes);
}
+
+ public function render($content)
+ {
+ $output = new Stamp(Stamp::load(dirname(__FILE__).'/../views/appLayout.tpl'));
+ return $output
+ ->replace('app_name', $this->app_name)
+ ->replace('base_url', $this->baseurl)
+ ->replace('yield', $content);
+ }
}
View
@@ -24,15 +24,16 @@ class mpMVCRouter
public function home()
{
- echo 'Welcome to mpMVC';
+ $app = F3::get('app');
+ echo $app->render('Welcome to mpMVC');
}
public function modelAdd()
{
$app = F3::get('app');
$model = $app->model(F3::get('PARAMS["model"]'), 'single');
if (!$model->scaffold()) F3::error(404);
- echo $model->renderToForm('add');
+ echo $app->render($model->renderToForm('add'));
}
public function modelCreate()
@@ -56,7 +57,7 @@ public function modelEdit()
$model = $app->model(F3::get('PARAMS["model"]'), 'plural');
if (!$model->scaffold()) F3::error(404);
$instance = $model->load($id);
- echo $model->renderToForm('edit', $instance);
+ echo $app->render($model->renderToForm('edit', $instance));
}
public function modelUpdate()
@@ -80,15 +81,15 @@ public function modelView()
$model = $app->model(F3::get('PARAMS["model"]'), 'plural');
$id = F3::get('PARAMS["id"]');
if (!$model->scaffold()) F3::error(404);
- echo $model->renderItem($id);
+ echo $app->render($model->renderItem($id));
}
public function modelList()
{
$app = F3::get('app');
$model = $app->model(F3::get('PARAMS["model"]'), 'plural');
if (!$model->scaffold()) F3::error(404);
- echo $model->renderList();
+ echo $app->render($model->renderList());
}
}
View
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
+<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
+<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
+<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
+<head>
+
+ <!-- Basic Page Needs
+ ================================================== -->
+ <meta charset="utf-8">
+ <title>Your Page Title Here :)</title>
+ <meta name="description" content="">
+ <meta name="author" content="">
+ <!--[if lt IE 9]>
+ <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+
+ <!-- Mobile Specific Metas
+ ================================================== -->
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+
+ <!-- CSS
+ ================================================== -->
+ <link rel="stylesheet" href="stylesheets/base.css">
+ <link rel="stylesheet" href="stylesheets/skeleton.css">
+ <link rel="stylesheet" href="stylesheets/layout.css">
+
+ <!-- Favicons
+ ================================================== -->
+ <link rel="shortcut icon" href="images/favicon.ico">
+ <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
+ <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
+ <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
+
+</head>
+<body>
+
+ <!-- Primary Page Layout
+ ================================================== -->
+ <div class="container">
+ <h1 style="margin-top: 100px; text-align:center">Sorry. Couldn't Find That Page!</h1>
+ </div>
+
+<!-- End Document
+================================================== -->
+</body>
+</html>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Binary file not shown.
Oops, something went wrong.

0 comments on commit c47efc5

Please sign in to comment.