Skip to content

Instantly share code, notes, and snippets.

View tedkulp's full-sized avatar

Ted Kulp tedkulp

View GitHub Profile
{validation_errors for='template'}
{render_partial template='editform.tpl'}
We couldn’t find that file to show.
<?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
<?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
<?php
class LoginController extends SilkControllerBase
{
function index($params)
{
$user_session = new SilkUserSession($params['login']);
if ($user_session->login())
{
//redirect('')
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.
<?php
class TestController extends SilkControllerBase
{
function test_action($params)
{
$this->set('test', 'Controller Works!');
}
function test_ajax($params)
We couldn’t find that file to show.
<?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']);
<?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);