Permalink
Browse files

A framework i started in 2006 but never finished. Keeping it here for…

… Nostalgia
  • Loading branch information...
joshbenham committed Sep 18, 2012
1 parent ac5906d commit cd7d926f4927628a63505e643790675f745d6218
View
@@ -0,0 +1,17 @@
+<IfModule mod_php5.c>
+
+ php_flag magic_quotes_gpc on
+
+</IfModule>
+
+
+<IfModule mod_rewrite.c>
+
+ RewriteEngine On
+
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+
+ RewriteRule ^(.*)$ index.php?route=$1 [L,QSA]
+
+</IfModule>
View
@@ -0,0 +1,29 @@
+<?php
+
+ /* Include the main class */
+ include( 'lib/Sno.php' );
+
+ /* Set defines */
+ Sno::define( 'BASE_DIR' , dirname( __FILE__ ).'/' );
+ Sno::define( 'LIB_DIR' , BASE_DIR.'lib/' );
+ Sno::define( 'APP_DIR' , BASE_DIR.'app/' );
+
+ /* Catch Exceptions First */
+ Sno::using( 'app.exceptions' );
+
+ /* Include all the library folders */
+ Sno::using( 'lib' );
+ Sno::using( 'lib.mvc' );
+ Sno::using( 'lib.common' );
+
+ /* Include the main app folders */
+ Sno::using( 'app' );
+ Sno::using( 'app.controllers' );
+ Sno::using( 'app.models' );
+ Sno::using( 'app.modules' );
+ Sno::using( 'app.views' );
+
+ /* Overwrite the standard __autoload function */
+ spl_autoload_register( array( 'Sno' , 'autoload' ) );
+
+?>
View
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<map>
+
+ <!-- Forum Section Map -->
+ <forum>
+ <param name="page" />
+ <param name="action" />
+ <param name="subaction" />
+ <param name="thread" />
+ <param name="id" />
+ </forum>
+
+ <!-- Default Map -->
+ <default>
+ <param name="page" />
+ <param name="action" />
+ <param name="id" />
+ </default>
+
+</map>
@@ -0,0 +1,26 @@
+<?php
+
+ class BaseController extends Sno_Controller
+ {
+
+ private
+ $view;
+
+ public function __construct( Sno_Registry $registry )
+ {
+
+ parent::__construct( $registry );
+ $this->view = new NewsView( $this->registry );
+
+ }
+
+ public function index( )
+ {
+
+ $this->view->render();
+
+ }
+
+ }
+
+?>
@@ -0,0 +1,26 @@
+<?php
+
+ class NewsController extends Sno_Controller
+ {
+
+ private
+ $view;
+
+ public function __construct( Sno_Registry $registry )
+ {
+
+ parent::__construct( $registry );
+ $this->view = new NewsView( $this->registry );
+
+ }
+
+ public function index( )
+ {
+
+ $this->view->render();
+
+ }
+
+ }
+
+?>
@@ -0,0 +1,15 @@
+<?php
+
+ class FrontControllerException extends Exception
+ {
+
+ public function __construct( $message , $code = 0 )
+ {
+
+ parent::__construct( $message , $code );
+
+ }
+
+ }
+
+?>
@@ -0,0 +1,15 @@
+<?php
+
+ class MapperException extends Exception
+ {
+
+ public function __construct( $message , $code = 0 )
+ {
+
+ parent::__construct( $message , $code );
+
+ }
+
+ }
+
+?>
@@ -0,0 +1,15 @@
+<?php
+
+ class ModuleException extends Exception
+ {
+
+ public function __construct( $message , $code = 0 )
+ {
+
+ parent::__construct( $message , $code );
+
+ }
+
+ }
+
+?>
@@ -0,0 +1,15 @@
+<?php
+
+ class SNOException extends Exception
+ {
+
+ public function __construct( $message , $code = 0 )
+ {
+
+ parent::__construct( $message , $code );
+
+ }
+
+ }
+
+?>
@@ -0,0 +1,15 @@
+<?php
+
+ class ViewException extends Exception
+ {
+
+ public function __construct( $message , $code = 0 )
+ {
+
+ parent::__construct( $message , $code );
+
+ }
+
+ }
+
+?>
View
@@ -0,0 +1,45 @@
+body {
+ font-weight: bold;
+ margin: 20px;
+ padding: 0px;
+}
+
+#body-container {
+ border: 1px solid #93263b;
+}
+
+#header h1 {
+ margin: 0px;
+ line-height: 100px;
+ background: #93263b;
+ text-align: center;
+ color: white;
+}
+#footer {
+ clear: both;
+ line-height: 30px;
+ background: #93263b;
+ text-align: center;
+ color: white;
+}
+#menu {
+ width: 20%;
+ float: left;
+}
+#crumbs {
+ line-height: 25px;
+ padding-left: 10px;
+ border-bottom: 1px solid #93263b;
+}
+#crumbs a {
+ text-decoration: none;
+ color: #93263b;
+}
+#crumbs a:hover {
+ border-bottom: 2px solid #93263b;
+}
+#container {
+ float: left;
+ width: 80%;
+}
+
View
@@ -0,0 +1,21 @@
+<?php
+
+ class NewsModel extends Sno_Model
+ {
+
+ public function getCrumbs()
+ {
+
+ if ( Sno_Module::exists( 'Breadcrumbs') )
+ {
+ $crumbs = Sno_Module::load( 'Breadcrumbs' , array( $this->registry ) );
+ $crumbs->dispatch();
+ }
+ else
+ echo 'Breadcrumbs is not supported';
+
+ }
+
+ }
+
+?>
@@ -0,0 +1,47 @@
+<?php
+
+ class Breadcrumbs
+ {
+
+ private
+ $registry,
+ $args;
+
+ public function __construct( Sno_Registry $registry )
+ {
+
+ $this->registry = $registry;
+
+ $mapper = new Sno_Mapper( $this->registry );
+ $this->args = $mapper->getURI( );
+
+ }
+
+ public function dispatch( $char = '/' )
+ {
+
+ $trail = "";
+ $crumbs = '<a href="/">home</a> :: ';
+
+ if ( isset( $this->args ) )
+ {
+
+ foreach( $this->args as $args )
+ {
+
+ $trail .= $args.'/';
+ $crumbs .= $char.' <a href="/'.$trail.'">'.$args.'</a> ';
+
+ }
+
+ }
+ else
+ $crumbs .= '/';
+
+ echo $crumbs;
+
+ }
+
+ }
+
+?>
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html>
+
+ <head>
+
+ <title> My FW Implementation - NewsView </title>
+
+ <link rel="stylesheet" type="text/css" media="all" href="/app/media/css/layout.css" />
+
+ </head>
+
+ <body>
+
+ <div id="body-container">
+
+ <?php $this->addInclude( 'header.stpl.php' ); ?>
+
+ <div id="crumbs">
+ <?php echo $this->model->getCrumbs(); ?>
+ </div>
+
+ <div id="menu">
+ <p>testing</p>
+ </div>
+
+ <div id="container">
+ <h2> IM A VIEW </h2>
+ <p>
+ This is were i add all the information into the webpage
+ </p>
+ </div>
+
+ <div id="footer">
+ schnoodles
+ </div>
+
+ </div>
+
+ </body>
+
+</html>
@@ -0,0 +1,3 @@
+<div id="header">
+ <h1>HEADER</h1>
+</div>
View
@@ -0,0 +1,19 @@
+<?php
+
+ class NewsView extends Sno_View
+ {
+
+ protected
+ $registry;
+
+ public function __construct( Sno_Registry $registry )
+ {
+ parent::__construct( 'NewsView.stpl.php' );
+
+ $this->registry = $registry;
+ $this->model = new NewsModel( $this->registry );
+ }
+
+ }
+
+?>
Oops, something went wrong.

0 comments on commit cd7d926

Please sign in to comment.