This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('getPageChooser')) { | |
function getPageChooser($pageLinks=array(), $activeIndexNumber=0, $previousText="Previous", $nextText="Next", $firstVisableNumber=1) { | |
// This function takes an array with links and makes a nice page chooser from it. | |
// The index of the array is 0 based, so is the activeIndexNumber. | |
// Make firstVisableNumber 0 if you want to see pagenumbers start with 0 (Why would you???). | |
$pagermenu = array(); | |
if (!is_array($pageLinks)) return ""; | |
$pageLinksCount = count($pageLinks); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#------------------------------------------------------------------------- | |
# Module: Cart - A simple example frontend form module | |
# Version: 1.0, calguy1000 <[email protected]> | |
# | |
#------------------------------------------------------------------------- | |
# CMS - CMS Made Simple is (c) 2005 by Ted Kulp ([email protected]) | |
# This project's homepage is: http://www.cmsmadesimple.org | |
# The module's homepage is: http://dev.cmsmadesimple.org/projects/skeleton/ | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'lib/silk/silk.api.php'; | |
SilkDatabase::connect('mysql://root:@localhost/cms_innodb', true, true, 'cms_'); | |
$users = orm('user')->find_all(array('order' => "id ASC")); | |
var_dump($users[0]->full_name()); | |
var_dump($users[0]->groups[0]->name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once('lib/silk/silk.api.php'); | |
$config = SilkYaml::load(join_path(ROOT_DIR, 'config', 'setup.yml')); | |
include_once('config/routes.php'); | |
//SilkDatabase::connect($config['database']['dsn'], $config['debug'], true, $config['database']['prefix']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TestController extends SilkControllerBase | |
{ | |
function test_action($params) | |
{ | |
$this->set('test', 'Controller Works!'); | |
} | |
function test_ajax($params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As I've worked on CMSMS 2.0, I've run into a few recurring issues | |
that I didn't quite have an answer or reason for yet... | |
1. I wrote a lot of very generic pieces of code in order to make 2.0 | |
easier to develop in the long run. I think I might've gone overboard | |
a bit. I wasn't ever sure why. | |
2. As a professional developer, I kept running into issues where I wanted | |
to use some of that code for other stuff. And it was too difficult to just | |
pull out the piece I needed and didn't do it. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class LoginController extends SilkControllerBase | |
{ | |
function index($params) | |
{ | |
$user_session = new SilkUserSession($params['login']); | |
if ($user_session->login()) | |
{ | |
//redirect('') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Automatically add some component routes -- see docs for details | |
//SilkRoute::build_default_component_routes(); | |
SilkRoute::register_route("/admin/:controller/:action/:id", array("component" => 'admin')); | |
SilkRoute::register_route("/admin/:controller/:action", array("id" => '', "component" => 'admin')); | |
SilkRoute::register_route("/admin/:controller", array("id" => '', 'action' => 'index', "component" => 'admin')); | |
//Catch-all goes here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Automatically add some component routes -- see docs for details | |
//SilkRoute::build_default_component_routes(); | |
SilkRoute::register_route("/admin/:controller/:action/:id", array("component" => 'admin')); | |
SilkRoute::register_route("/admin/:controller/:action", array("id" => '', "component" => 'admin')); | |
SilkRoute::register_route("/admin/:controller", array("id" => '', 'action' => 'index', "component" => 'admin')); | |
//Catch-all goes here |
OlderNewer