Skip to content

Instantly share code, notes, and snippets.

@iaindooley
iaindooley / curl_request.class.php
Created April 26, 2011 04:43
A PHP class for making requests via cURL
<?php
class CurlRequest
{
private $curl;
private $url;
private $method;
private $get_fields;
private $post_fields;
private $sending_file;
const POST = 1;
@iaindooley
iaindooley / step1.php
Created April 26, 2011 05:31
Example Decal API request for Step 1 of the API docs
<?php
require_once('curl_request.class.php');
//update this to point to your install
$url = 'http://www.decalcms.com/index.php?h=DecalApi';
$api_key = '597990c64261faa854805f6366f9dcc4f505ed0e';
//formulate the post fields for the request
//we'll look at the options in detail below
$fields = array('api_key' => $api_key,
't' => 'Home',//fetch pages that use the Home
@iaindooley
iaindooley / step1.php
Created April 26, 2011 05:31
Example Decal API request for Step 1 of the API docs
<?php
require 'curl_request.class.php';
//update this to point to your install
$url = 'http://www.decalcms.com/index.php?h=DecalApi';
$api_key = '597990c64261faa854805f6366f9dcc4f505ed0e';
//formulate the post fields for the request
//we'll look at the options in detail below
$fields = array('api_key' => $api_key,
't' => 'Home',//fetch pages that use the Home
@iaindooley
iaindooley / step2.php
Created April 26, 2011 06:06
Example Decal API request to fetch a list of pages
<?php
require_once('curl_request.class.php');
//update this to point to your install
$url = 'http://www.decalcms.com/index.php?h=DecalApi';
$api_key = '597990c64261faa854805f6366f9dcc4f505ed0e';
//formulate the post fields for the request
//we'll look at the options in detail below
$fields = array('api_key' => $api_key,
'list' => '1', //get the first list of pages
@iaindooley
iaindooley / step2_ex2.php
Created April 26, 2011 06:19
Example Decal API request to build a list of Decal plan costs
<?php
require_once('curl_request.class.php');
//update this to point to your install
$url = 'http://www.decalcms.com/index.php?h=DecalApi';
$api_key = '597990c64261faa854805f6366f9dcc4f505ed0e';
//formulate the post fields for the request
//we'll look at the options in detail below
$fields = array('api_key' => $api_key,
't' => 'Home',
@iaindooley
iaindooley / step3_ex1.php
Created April 26, 2011 06:24
Example Decal API search query
<?php
require_once('curl_request.class.php');
//update this to point to your install
$url = 'http://www.decalcms.com/index.php?h=DecalApi';
$api_key = '597990c64261faa854805f6366f9dcc4f505ed0e';
//formulate the post fields for the request
//we'll look at the options in detail below
$fields = array('api_key' => $api_key,
'search' => 'true',
@iaindooley
iaindooley / step3_ex2.php
Created April 26, 2011 06:26
Example Decal API search more query
<?php
require_once('curl_request.class.php');
//update this to point to your install
$url = 'http://www.decalcms.com/index.php?h=DecalApi';
$api_key = '597990c64261faa854805f6366f9dcc4f505ed0e';
//formulate the post fields for the request
//we'll look at the options in detail below
$fields = array('api_key' => $api_key,
'search_more' => 'true',//returns more results than "search"
@iaindooley
iaindooley / step4.php
Created April 26, 2011 06:45
Example news.php
<?php
require 'curl_request.class.php';
//update this to point to your install
$base = 'http://iain-workingsoftware-com-au.mockups.decalcms.com';
$url = $base.'/index.php?h=DecalApi';
$api_key = 'qZnSiN).yH4cw(gkhPTEKx>[vsg|&mf199Y5Vi]!e5oOalKp0nW0>=&Yt3>i$=+*';
//formulate the post fields for the request
//we'll look at the options in detail below
$fields = array('api_key' => $api_key,
@iaindooley
iaindooley / decal_html_structure.html
Created April 27, 2011 22:41
An example of deploying a structured HTML component with Decal
<div area="Homepage items">
<div class="homepageItem" component="Home page item">
<a href="" editable="true">
<img editable="true" width="100" name="Homepage item graphic" />
</a>
<h6 editable="true" tags="none">Your heading here</h6>
<p editable="true" tags="inline">Short description here</p>
<a class="learnMore" editable="true">Learn more</a>
</div>
</div>
@iaindooley
iaindooley / css_styles.css
Created April 27, 2011 22:54
Example of how to add custom styles and colours to Decal
#home p.didYouKnow /* decal: Lightbulb graphic */
{
background-image:url('lightbulb.png');
}
#home p.important /* decal: #ff0000 */
{
colour:red;
}