Skip to content

Instantly share code, notes, and snippets.

View sajadtorkamani's full-sized avatar

Sajad Torkamani sajadtorkamani

View GitHub Profile
<?php echo '<h1>'. $this->view->pageTitle.'</h1>' ?>
@sajadtorkamani
sajadtorkamani / gist:77883c2017b76646a308
Created June 10, 2015 14:16
Create select box for different data types
select - display:heading,treatment
@sajadtorkamani
sajadtorkamani / gist:ef2a992bc7054cff2ad0
Created June 10, 2015 16:05
Check if object exists before use
<?php
$item = $this->view;
$casestudy = $item->links("case_studies_featured", array('single'=>true));
if($casestudy)
{
$client = $casestudy->links("clients", array('single'=>true));
$banner_img = $casestudy->images('banner_img');
}
@sajadtorkamani
sajadtorkamani / gist:e8663e1cc71267be240f
Last active August 29, 2015 14:22
Social icons bg colours
// Twitter
background: #20B8FF;
// Facebook
background: #2D4486;
// Google Plus
background: #d61616;
// Instagram
@sajadtorkamani
sajadtorkamani / gist:82ce22c68e98a0a4cd4a
Last active August 29, 2015 14:22
Center uneven number of bootstrap columns
function centerBrands(row, breakpoint) { // ? Modify to allow for any number of cols
var noCols = $(row).children().length;
var oddCols = noCols % 5;
// Shift first column to display (five) cols
if(noCols >= 5) {
@sajadtorkamani
sajadtorkamani / gist:8716b23637a7abb1b2be
Created June 12, 2015 14:55
Display only items from related service
1. Link Item A and Item B with the link param type
2. On the model of Item A, under 'Filter settings', set Item B to {{View.id}}
@sajadtorkamani
sajadtorkamani / gist:7515b0e1f876e7ad4ba6
Last active August 29, 2015 14:23
Choosing which items in a list to display on a particular page
1) Create a param
2) Set "Save in Search Field" to SA Search 1,2 or 3
3) Create new model based on item database
4) Set the filter settings to the appropriate value (e.g. Foo = ?)
5) Go to content type and check the appropriate field
@sajadtorkamani
sajadtorkamani / gist:dff010a8236d114627d4
Created June 19, 2015 08:40
Passing in options to an item call
$opt = array(
'single'=>true,
'vcbdhj' => 'cdsbs',
);
$img = $item->images("slider_bg")->multi($opt);
@sajadtorkamani
sajadtorkamani / gist:e48c1341a92dc36fa538
Created June 20, 2015 20:23
Creating a select dropdown based on a model
1. In Content A create a 'links' param linking to Content B's model.
2. Set the type to be 'Single'
1. Add to assets/libs/
2. Include in config/libs.php
3. Include in Gruntfile.js under the 'concat' task