Search.php
play.php
{% *Copyright: Lorenzo D. Alipio* %} {% *file: web/themes/default/play.tpl* %} {% extends file="web/themes/default/main.tpl" %} {% block name=title %}Playing {% $content.title %}{% /block %} {% block name=meta %}{% /block %} {% block name=metad %}{% /block %} {% block name=general %} <div class="span8"> <h4>Playing {% $content.title %}</h4> <iframe id="youtube" width="100%" height="480" src="//www.youtube.com/embed/{% $content.v_id %}" frameborder="0" allowfullscreen></iframe> <br/> <!-- Related Videos --> <div id="related"> <h3 class="title">Related Videos</h3> <ul> {% section name=item loop=$content.related %} <li> <a href="javascript:loadThisVideo('youtube','http://www.youtube.com/embed/{% $content.related[item].v_id %}?rel=0&hd=1')"><img src="{% $content.related[item].thumb %}" title="{% $content.related[item].title %}"/></a> </li> {% /section %} </ul> </div> <!-- end of related --> </div> <div class="span4"> <h5 class="title">Recommended Videos</h5> <div id = "thumb3"> <ul> {% section name=item loop=$content.video %} <li> <a href="javascript:loadThisVideo('youtube','http://www.youtube.com/embed/{% $content.video[item].v_id %}?rel=0&hd=1')"><img src="{% $content.video[item].thumb %}"/></a> <br/> {% $content.video[item].title %} <br/> </li> {% /section %} </ul> </div> </div> {% /block %}
{% *Copyright: Lorenzo D. Alipio* %} {% extends file="web/themes/default/main.tpl" %} {% block name=title %}About Us{% /block %} {% block name=meta %}{% /block %} {% block name=metad %}{% /block %} {% block name=general %} {% $content.about %} {% $content.name %} {% $content.email %} {% /block %}
{% extends file="web/themes/green/main.tpl" %} {% block name=title %}Music Video Categories{% /block %} {% block name=meta %}{% /block %} {% block name=metad %}{% /block %} {% block name=general %} <h1 class="title" >{% $content.categoryHeader %}</h1>{% /block %}{% foreach from=$content.cat item=cat %}
- {% $cat|strip %}
{% /foreach %}
{% *2013 Copyright Lorenzo D. Alipio <ldalipio@msn.com>* %} {% extends file="web/themes/default/main.tpl" %} {% block name=title %}About Us{% /block %} {% block name=meta %}{% /block %} {% block name=metad %}{% /block %} {% block name=general %} <div class="span8"> <h4 class="title" >About this Demo Script</h1> {% $content.content['first_p'] %} <ul> {% foreach $content.content['lists'] as $item %} <li>{% $item %}</li> {% /foreach %} </ul> <h5 class="title">Additional Information</h5> <br/> {% $content.content['more_info'] %} <br/> </div> <div class="span4"> <h4 class="title">Demo Map</h5> <ul> <li><a href="categories.php"><h5 class="title">Categories</h5></a></li> <li><a href="toprated.php"><h5 class="title">Top Rated</h5></a></li> <li><a href="mostviewed.php"><h5 class="title">Most Viewed</h5></a></li> <li><a href="latest.php"><h5 class="title">Latest Video</h5></a></li> </ul> </div> {% /block %}
{% extends file="web/themes/green/main.tpl" %} {% block name=title %}{% /block %} {% block name=meta %}{% /block %} {% block name=metad %}{% /block %} {% block name=title %}{% /block %} {% block name=thumb %} <h3 class="title">Video Count {% $content.count %}</h3> <div id = "thumb2"> <ul> {% section name=item loop=$content.video %} <li> <a href="play.php?vid={% $content.video[item].v_id %}&title={% $content.video[item].title|escape:'htmlall' %}&cat={% $content.cat %}"><img src="{% $content.video[item].thumb %}"/></a> <br/> {% $content.video[item].title %} <br/> {% $content.video[item].desc %} <br/> </li> {% /section %} </ul> </div> {% /block %} {% block name=paginate %}{% $content.pagination %}{% /block %}
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <!-- page title block --> <title>{% block name=title %}{% /block %}</title> <!-- /end of page title block --> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /> <!-- robots block --> {% block name=robots %}{% /block %} <!-- /end of robots block --> <meta name="keywords" content="{% block name=meta %}{% /block %}"> <meta name="robots" content="all"> <meta name="revisit" content="1 day"> <!-- additional css block --> {% block name=style %} <style> #player { margin:0 auto; float:none; } </style> {% /block %} <!-- end of additional css block --> <!-- Optional javascript block --> {% block name=jscript %}{% /block %} <!-- /end of optional javascript block --> <link href="http://{% $content.sitepath %}themes/default/css/bootstrap.css" rel="stylesheet"> <link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"> <link href="http://{% $content.sitepath %}themes/default/css/bootstrap-responsive.css" rel="stylesheet"> <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src="../assets/js/html5shiv.js"></script> <![endif]--> <!-- Fav and touch icons --> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="http://{% $content.sitepath %}themes/default/ico/apple-touch-icon-144-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://{% $content.sitepath %}themes/default/ico/apple-touch-icon-114-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://{% $content.sitepath %}themes/default/ico/apple-touch-icon-72-precomposed.png"> <link rel="apple-touch-icon-precomposed" href="http://{% $content.sitepath %}themes/default/ico/apple-touch-icon-57-precomposed.png"> <link rel="shortcut icon" href="http://{% $content.sitepath %}themes/default/ico/favicon.png"> <!-- /end of Fav and touch icons --> <!-- link to the theme style css file --> <link href="http://{% $content.sitepath %}themes/default/css/green.css" rel="stylesheet"> <!-- /end of theme style css file --> <!--[if gte IE 9]> <style type="text/css"> .gradient { filter: none; } </style> <![endif]--> {% block name=style %}{% /block %} <!-- jquery code block --> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <!-- /end of jquery code block --> <script> $(function() { $( "#videos" ).tabs(); }); </script> <script> function resizeCaller(){var a=new Array;for(i=0;i<iframeids.length;i++){if(document.getElementById)resizeIframe(iframeids[i]);if((document.all||document.getElementById)&&iframehide=="no"){var b=document.all?document.all[iframeids[i]]:document.getElementById(iframeids[i]);b.style.display="block"}}}function resizeIframe(a){var b=document.getElementById(a);if(b&&!window.opera){b.style.display="block";if(b.contentDocument&&b.contentDocument.body.offsetHeight)b.height=b.contentDocument.body.offsetHeight+FFextraHeight;else if(b.Document&&b.Document.body.scrollHeight)b.height=b.Document.body.scrollHeight;if(b.addEventListener)b.addEventListener("load",readjustIframe,false);else if(b.attachEvent){b.detachEvent("onload",readjustIframe);b.attachEvent("onload",readjustIframe)}}}function readjustIframe(a){var b=window.event?event:a;var c=b.currentTarget?b.currentTarget:b.srcElement;if(c)resizeIframe(c.id)}function loadThisVideo(a,b){if(document.getElementById)document.getElementById(a).src=b}var iframeids=["myframe"];var iframehide="yes";var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];var FFextraHeight=parseFloat(getFFVersion)>=.1?16:0;if(window.addEventListener)window.addEventListener("load",resizeCaller,false);else if(window.attachEvent)window.attachEvent("onload",resizeCaller);else window.onload=resizeCaller </script> </head> <body> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner-green"> <div class="container"> <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="brand" href="#">Lorenzo Alipio Demo Script</a> <div class="nav-collapse collapse"> <ul class="nav"> <li class="active"><a href="index.php"><i class="icon-home icon-large" ></i> Main</a></li> <li><a href="#about">About</a></li> <li><a href="#contact">Contact</a></li> <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Media<b class="caret"></b></a> <ul class="dropdown-menu"> <li class="dropdown-submenu"> <a tabindex="-1" href="#">Video</a> <ul class="dropdown-menu"> <li><a href="latest.php">Latest</a></li> <li><a href="toprated.php">Top Rated</a></li> <li><a href="mostviewed.php">Most Viewed</a></li> <li><a href="categories.php">Categories</a></li> </ul> </li> <li class="dropdown-submenu"> <a tabindex="-1" href="#">Audio</a> <ul class="dropdown-menu"> <li><a href="#">Latest</a></li> </ul> </li> <li class="dropdown-submenu"> <a tabindex="-1" href="#">Photos</a> <ul class="dropdown-menu"> <li><a href="#">Latest Photos</a></li> </ul> </li> <li class="dropdown-submenu"> <a tabindex="-1" href="#">Blog</a> <ul class="dropdown-menu"> <li><a href="#">Latest Entries</a></li> </ul> </li> </ul> </li> {% block name=accountmenu %}{% /block %} </ul> <form class="navbar-search pull-right" method="get" action="video.php"> <input type="text" name="q" class="search-query span2" placeholder="Search"> </form> </div><!--/.nav-collapse --> </div> </div> </div> <div class="container"> {% block name=mtitle %}{% /block %} <div class="row"> <div id="videos"> {% block name=page_tabmenu %} <!-- page tab menu block --> {% /block %} <!-- featured begins --> <div id="featured" class="span12 row-fluid"> {% block name=featured %}{% /block %} </div> <!-- latest begins --> <div id="latest" class="span12 row-fluid"> {% block name=latest %}{% /block %} </div> <!-- mostviewed begins --> <div id="mostviewed" class="span12 row-fluid"> {% block name=mostviewed %}{% /block %} </div> </div> </div> <!-- /end of tab content blocks --> <!-- content blocks of all types --> <div class="span12 row-fluid"> {% block name=thumb %}{% /block %} </div> <div class="span12 row-fluid"> {% block name=login %}{% /block %} </div> <div class="span12 row-fluid"> {% block name=general %}{% /block %} </div> <!-- show pagination here if needed --> <div class="row"> <div class="span12 row-fluid"> <table width = "100%" ALIGN="center"> <tr> <td align="center" ><div class='paginate'> {% block name=paginate %}{% /block %} </div> </td></tr></table> <!-- EOF pagination section --> </div> </div> <div id="push"></div> </div> <div id="footer"> <div class="container"> <div class="row"> <div class="span12 row-fluid pagination-centered"> <div class="span6"><div class="bottombox text-left"><h1 class="footer">Lorenzo D. Alipio</h1> © All rights reserved. Powered by Lorenzo D. Alipio Framework. </div></div> <div class="span3"><div class="bottombox"><h5 class="footer">Archives</h5></div></div> <div class="span3"><div class="bottombox"><h5 class="footer">Social</h5> <div class="social_icons"> <ul> <li><a href="#"><img src="http://{% $content.sitepath %}themes/default/social/blogger.png"></a></li> <li><a href="#"><img src="http://{% $content.sitepath %}themes/default/social/facebook.png"></a></li> <li><a href="#"><img src="http://{% $content.sitepath %}themes/default/social/youtube.png"></a></li> <li><a href="#"><img src="http://{% $content.sitepath %}themes/default/social/twitter.png"></a></li> <li><a href="#"><img src="http://{% $content.sitepath %}themes/default/social/digg.png"></a></li> <li><a href="#"><img src="http://{% $content.sitepath %}themes/default/social/stumbleupon.png"></a></li> <li><a href="#"><img src="http://{% $content.sitepath %}themes/default/social/vimeo.png"></a></li> <li><a href="#"><img src="http://{% $content.sitepath %}themes/default/social/rss.png"></a></li> </ul></div> </div></div> <div class="spane12 row fluid"> <footer> <!-- display copyright --> {% block name=copyright %}{% /block %} </footer> </div> </div> </div> </div> </div> </div> <!-- can use this block for much needed javascript on page --> {% block name=jscript1 %}{% /block %} <script src="http://{% $content.sitepath %}themes/default/js/bootstrap-transition.js"></script> <script src="http://{% $content.sitepath %}themes/default/js/bootstrap-alert.js"></script> <script src="http://{% $content.sitepath %}themes/default/js/bootstrap-modal.js"></script> <script src="http://{% $content.sitepath %}themes/default/js/bootstrap-dropdown.js"></script> <script src="http://{% $content.sitepath %}themes/default/js/bootstrap-scrollspy.js"></script> <script src="http://{% $content.sitepath %}themes/default/js/bootstrap-tab.js"></script> <script src="http://{% $content.sitepath %}themes/default/js/bootstrap-tooltip.js"></script> <script src="http://{% $content.sitepath %}themes/default/js/bootstrap-popover.js"></script> <script src="http://{% $content.sitepath %}themes/default/js/bootstrap-button.js"></script> <script src="http://{% $content.sitepath %}themes/default/js/bootstrap-collapse.js"></script> <script src="http://{% $content.sitepath %}themes/default/js/bootstrap-carousel.js"></script> <script src="http://{% $content.sitepath %}themes/default/js/bootstrap-typeahead.js"></script> <!-- 2nd javascript block for javascript that needs to be written on the page --> {% block name=jscript2 %}{% /block %} </body> </html>
<?php /* * * Copyright Lorenzo D. Alipio* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * * MostviewedController.php */ class MostviewedController extends Controller { public $q = "funnies"; public $index = '1'; public $orderby = "published"; public $i = 48; public $count =''; function __construct() { parent::__construct(); Use_Class::autoload(YOUTUBE); } public function index(){ if(isset($_GET['q'])){ $q = $_GET['q']; $q = preg_replace('/[[:space:]]+/', '/', trim($q)); $q = str_replace('/', '+', $q); $index = $_GET['start-index']; $orderby = $_GET['orderby']; $i = 25; } else{ $q = "Metallica"; $index = "1"; $orderby = "published"; $i = 25; } $object = new YoutubeVideo($q,$index,$orderby,$i); $video = array( 'count'=> $object->getCount(), 'video'=> $object->getVideo(), 'sitepath'=>SITEPATH, 'cat' => $q, 'pagination'=>$object->pagenate('mostviewed.php') ); return $this->view->set_content($video,'latest.tpl'); } }
<?php /* * * Copyright Lorenzo D. Alipio* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * * PlayController.php */ class PlayController extends Controller { public $v_id; public $title; public $description ; public $q = "funnies"; public $index = '1'; public $orderby = "viewCount"; public $i = 10; public $count =''; public function __construct() { parent::__construct(); Use_Class::autoload(YOUTUBE); if(isset($_GET['vid'])){ $this->v_id = filter_var($_GET['vid'], FILTER_SANITIZE_STRIPPED); $this->title = filter_var($_GET['title'], FILTER_SANITIZE_STRIPPED); $this->category = filter_var($_GET['cat'], FILTER_SANITIZE_STRIPPED); $this->q = $this->category; // set video data feed URL } } public function index(){ $object = new YoutubeVideo($this->q,$this->index,$this->orderby,$this->i); $relatedObject = new YoutubeVideo($this->q, 2 ,$this->orderby,15); $video = array( 'v_id' => $this->v_id, 'title' => $this->title, 'video'=> $object->getVideo(), 'related'=>$relatedObject->getVideo(), 'sitepath' => SITEPATH, 'cat' =>$this->category ); return $this->view->set_content($video,'play.tpl'); } }
<?php /* * Copyright Lorenzo D. Alipio* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * File: application/controller/TopratedController.php */ class TopratedController extends Controller { public $q = "toprated"; public $index = '1'; public $orderby = "published"; public $i = 48; public $count =''; function __construct() { parent::__construct(); Use_Class::autoload(YOUTUBE); } public function index(){ //$object = Ini_object::instance('YoutubeVideo'); if(isset($_GET['q'])){ $q = $_GET['q']; $q = preg_replace('/[[:space:]]+/', '/', trim($q)); $q = str_replace('/', '+', $q); $index = $_GET['start-index']; $orderby = $_GET['orderby']; $i = 25; } else{ $q = "Aerosmith"; $index = "1"; $orderby = "published"; $i = 25; } $object = new YoutubeVideo($q,$index,$orderby,$i); $video = array( 'count'=> $object->getCount(), 'video'=> $object->getVideo(), 'sitepath'=>SITEPATH, 'cat' => $q, 'pagination'=>$object->pagenate('toprated.php') ); return $this->view->set_content($video,'latest.tpl'); } }
<?php /* * Copyright Lorenzo D. AlipioNotice, how the ViewClass.php was coded, we are setting our own delimiters for our smarty template engine. We will be using {% and %} because I am trying to build this framework to be able to use twig template engine. This conclude the Part 6B. Next time we will be writing the parent template file, the child template files. Hopefully, we can test our simple MVC implementing youtube API v2.* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * File: application/view/ViewClass.php */ Class View{ public function __construct(){ if(TPL === 'Smarty'){ Ini_object::instance('Smarty'); $this->tpl = Ini_object::instance('Smarty'); $this->tpl->left_delimiter = '{% '; $this->tpl->right_delimiter = ' %}'; $this->tpl->template_dir = ( THEME_DIR ); $this->tpl->compile_dir = ( THEME_COMPILE ); $this->tpl->caching = 0; $this->tpl->setCompileCheck(true); $this->tpl->cache_dir = ( THEME_CACHE ); $this->tpl->config_dir = ( THEME_CONFIG ); } else if(TPL ==='Twig'){ Use_Class::useFile(TWIG_LOADER); Twig_Autoloader::register(); ## define our template directory location $loader = new Twig_Loader_Filesystem('templates'); ## initialize Twig environment with cache enabled $twig = new Twig_Environment($loader, array( 'cache' => TWIG_CACHE, 'auto_reload' => true )); } } /* * TO DO integrate TWIG * */ public function set_content($content=array(),$templateName = null){ $this->tpl->assign('content', $content); return $this->tpl->display(THEME .$templateName); } }
<?php /* * Copyright Lorenzo D. Alipio* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * AboutController.php */ class AboutController extends Controller{ public function __construct(){ parent::__construct(); } private function aboutContent(){ return array( 'about'=> 'Created with L.D.Alipio light MVC, twitter bootstrap, smarty template engine.', 'email' => 'YourEmail@domain.com', 'name' => 'Lorenzo Alipio', 'motto' => 'You can do it (not like the Nike though.)', 'sitepath'=>SITEPATH ); } public function index(){ return $this->view->set_content(self::aboutContent(),'about.tpl'); } }
class AboutController extends Controller{
public function __construct(){
parent::__construct();
}
public function __construct(){ $this->model = Ini_object::instance('ModelClass'); $this->view = Ini_object::instance('View'); }
<?php /* * Copyright Lorenzo D. Alipio* This file is for demonstration purposes only and NOT authorize for distribution. * NO License will be granted for any purposes NON-profit or for profit. * However, the instance of smarty within the constructor of which this class instantiated is covered * by GNU license. * * filename: application/ViewClass.php * Update Date: 8-20-2013 * Previous Version: 1.4 * CategoriesController.php */ class CategoriesController extends Controller{ public function __construct(){ parent::__construct(); } public function index(){ $cat = array( 'Charice','The Beatles','Elvis Presley', 'Nora Jones', 'James Brown','Rolling Stones','Bob Dylan','Chuck Berry','The Who','Led Zeppelin','Stevie Wonder','Jimi Hendrix','Ray Charles','The Beach Boys','Pink Floyd','Aretha Franklin','Little Richard','Marvin Gaye','Bruce Springsteen','David Bowie','Fats Domino','Black Sabbath','Queen','Buddy Holly','Bob Marley','Sam Cooke','Elton John','Neil Young','U2','Run-D.M.C.','Bo Diddley','Jerry Lee Lewis','B.B. King','Sly & The Family Stone','The Clash','Prince','The Grateful Dead','The Velvet Underground','Nirvana','Michael Jackson','The Supremes','The Temptations','Madonna','Public Enemy','The Kinks','Otis Redding','The Everly Brothers','Van Halen','Elvis Costello','Simon & Garfunkel','Cream','Frank Zappa','Roy Orbison','Eric Clapton','George Clinton & Parliament/Funkadelic','The Allman Brothers Band','Janis Joplin','The Ramones','Crosby, Stills, & Nash & Young','Fleetwood Mac','AC+DC','The Byrds','Joni Mitchell','The Eagles','Smokey Robinson & The Miracles','R.E.M.','Creedence Clearwater Revival','Johnny Cash','Van Morrison','Aerosmith','Curtis Mayfield & The Impressions','The Drifters','The Police','Metallica','Pearl Jam','Deep Purple','Bill Haley & His Comets','The Band','Santana','Yes','Jefferson Airplane','King Crimson','Al Green','The Isley Brothers','The Moody Blues','The Sex Pistols','N.W.A','Talking Heads','Tom Petty & The Heartbreakers','Billy Joel','The Bee Gees','The Yardbirds','The Four Tops','Radiohead','Patti Smith','Guns N Roses','Chicago','Rush','Bob Seger & The Silver Bullet Band','Rick Nelson','Earth Wind & Fire' ); sort($cat); $content = array( 'sitepath'=>SITEPATH, 'categoryHeader' => 'Music Video Categories', 'cat' => $cat ); return $this->view->set_content($content,'categories.tpl'); } }
<?php /* * * Copyright Lorenzo D. Alipio* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * * IndexController.php */ class IndexController extends Controller{ public function __construct(){ parent::__construct(); } public function index(){ $content = array( 'sitepath'=>SITEPATH, 'content' =>self::article() ); ## this model content is for database //return $this->view->set_content($this->model->Content(),'index.tpl'); return $this->view->set_content($content,((TPL === 'Smarty')? 'index.tpl' : 'index.html')); } private function article(){ $article =array( 'first_p'=> 'This demo application script demonstrate the power of MVC methodologies in web development. This demo application also demonstrate the implementation of the capabilities of the following:', 'lists' => array('Smarty templating engine','Twitter Bootstrap Front-end framework,Smarty template inheritance','Youtube API version 2,Clean extensible PHP script,Pure OOP as written in Model View Controller design Pattern','Request routing to web or public directory only','Auto redirect to the index, if the page request does not exist','Pages have their own controller to better manage the content delivery','No HTML tags in the business logic pages','Written in PHP 5.5.1 > standards'), 'more_info'=>'This template may appear to be simple in its form, but it demonstrated the advance implementation of Object Oriented PHP.', 'copyright'=> 'Property of Lorenzo D. Alipio'); return $article; } }
<?php /* * * Copyright Lorenzo D. Alipio* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * * LatestController.php */ class LatestController extends Controller { public $q = "most_recent"; public $index = '1'; public $orderby = "published"; public $i = 48; public $count =''; function __construct() { parent::__construct(); Use_Class::autoload(YOUTUBE); } public function index(){ //$object = Ini_object::instance('YoutubeVideo'); if(isset($_GET['q'])){ $q = $_GET['q']; $q = preg_replace('/[[:space:]]+/', '/', trim($q)); $q = str_replace('/', '+', $q); $index = $_GET['start-index']; $orderby = $_GET['orderby']; $i = 25; } else{ $q = "AC+DC"; $index = "1"; $orderby = "published"; $i = 25; } $object = new YoutubeVideo($q,$index,$orderby,$i); $video = array( 'count'=> $object->getCount(), 'video'=> $object->getVideo(), 'sitepath'=>SITEPATH, 'cat' => $q, 'pagination'=>$object->pagenate('latest.php') ); return $this->view->set_content($video,'latest.tpl'); } }