Skip to content

Instantly share code, notes, and snippets.

View nicolechung's full-sized avatar

nicole chung nicolechung

View GitHub Profile
@nicolechung
nicolechung / gist:2710728
Created May 16, 2012 14:24
Concrete5: prefilling a form field
<script type="text/javascript">
$(function() {
var obj = <?php echo json_encode(array(
'QuestionNumber' => $special_thing)); ?>;
$('input[name="QuestionNumber"]').val(obj.QuestionNumber);
});
</script>
@nicolechung
nicolechung / controller-attributes-sample.php
Created May 16, 2012 14:17
Concrete5: Get User Attributes - Controller
<?php
defined('C5_EXECUTE') or die("Access Denied.");
class SampleController extends Controller {
public function __construct() {
if (!ENABLE_REGISTRATION) {
$this->render('/page_not_found');
}
parent::__construct();
@nicolechung
nicolechung / controller.php
Created May 16, 2012 12:30
Concrete5: Controller Template
<?php
defined('C5_EXECUTE') or die("Access Denied.");
/*
* Folder structure determines name
* controllers/my/controller/name ==> MyControllerNameController
*/
class MyControllerNameController extends Controller {
}
@nicolechung
nicolechung / main-stylesheet.php
Created May 16, 2012 12:27
Concrete5: link to main stylesheet
$this->getStyleSheet('main.css');
@nicolechung
nicolechung / InnerContent.php
Created May 16, 2012 12:26
Display content from a single page view inside of a template page
<?php
// this grabs the view from single_pages/name-of-page
print $innerContent;
?>
@nicolechung
nicolechung / GlobalArea.php
Created May 16, 2012 12:25
Concrete5: Global Area with a block limit of 1
<?php
$a = new GlobalArea('Area Name');
$a->setBlockLimit(1);
$a->display($c);
?>
@nicolechung
nicolechung / Area.php
Created May 16, 2012 12:25
Concrete5: create Area with a block limit of 1
<?php
$a = new Area('Area Name');
$a->setBlockLimit(1);
$a->display($c);
?>
@nicolechung
nicolechung / menu-admin.php
Created April 21, 2012 19:07
Wordpress: hide menu items
// remove menus for users who aren't administrators
function remove_menus () {
global $menu;
if( (current_user_can('install_themes')) ) {
$restricted = array(); } // check if admin and hide nothing
else { // for all other users
// Remove Tools, Appearance, Links, Plugins, Comments,
@nicolechung
nicolechung / permissions.php
Created April 18, 2012 15:30
Concrete5: Set permissions to advanced
define('PERMISSIONS_MODEL', 'advanced');
@nicolechung
nicolechung / template.js
Created April 5, 2012 18:04
Javascript: separating javascript for pages
jQuery(document).ready(function() {
var site = {
home: {
init: function() {
console.log('home init');
}
},
about: {
init: function() {
console.log('about init');