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 |
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
{validation_errors for='template'} | |
{render_partial template='editform.tpl'} |
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
#!/usr/bin/env ruby | |
#Creates projects from approved estimates in Freshbooks | |
#(c)2010 Ted Kulp ted@tedkulp.com | |
#Requires the tedkulp-freshbooks.rb gem | |
#To install: | |
# sudo gem install tedkulp-freshbooks.rb | |
# | |
#Create a ~/.freshbooks file (yaml format) with 'url' and 'key' keys | |
#to set the URL and API keys for freshbooks |
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
#!/usr/bin/env ruby | |
#Script to import a large set of users from a CSV | |
#into CMSMS's FrontEndUsers module. Assumes the | |
#'cms_' database prefix. | |
require 'rubygems' | |
require 'faster_csv' | |
require 'pp' | |
require 'mysql' |
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
class TestDataMapperTable extends CmsDataMapper | |
{ | |
var $counter = 0; | |
static public $static_counter = 0; | |
var $_fields = array( | |
'id' => array( | |
'type' => 'int', | |
'primary' => true, | |
'serial' => true, |