Skip to content

Instantly share code, notes, and snippets.

View adamfairholm's full-sized avatar

Adam Fairholm adamfairholm

View GitHub Profile
INSERT INTO `default_data_streams` (`stream_name`, `stream_slug`, `stream_namespace`, `stream_prefix`, `about`, `view_options`, `title_column`, `sorting`, `is_hidden`, `permissions`, `menu_path`)
VALUES
('Default', 'def_page_fields', 'pages', NULL, 'A simple page type with a WYSIWYG editor that will get you started adding content.', X'613A323A7B693A303B733A323A226964223B693A313B733A373A2263726561746564223B7D', NULL, 'title', 'no', NULL, NULL);
<?php
class Plugin_Real_estate extends Plugin {
public function listings()
{
$this->load->driver('Streams');
$params = array(
@adamfairholm
adamfairholm / gist:5205164
Created March 20, 2013 14:39
PyroCMS Unix Time Plugin
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Plugin_Time extends Plugin
{
public $version = '1.0.0';
public $name = array(
'en' => 'Time',
);
public $description = array(
'en' => 'Display a unix time stamp.'
In plugin.php, add this around line 215, right before "Stream Data Check".
// -------------------------------------
// Set Namespace
// -------------------------------------
// We can manually set the namespace
// via a namespce="" parameter.
// -------------------------------------
$params['namespace'] = ($params['namespace']) ? $params['namespace'] : $this->core_namespace;
@adamfairholm
adamfairholm / gist:5135154
Last active December 14, 2015 19:18
Using multiple relationship field manually.
$field = $this->field_m->get_field($fieldId);
$attributes = array(
'stream_slug' => 'sample', // The stream of the related stream.
'row_id' => $rowId, // The ID of the current entry row.
);
$entries = $this->type->types->multiple->plugin_override($field, $attributes);
$this->row_m->sql['select'][] = 'DISTINCT ('$this->db->protect_identifiers('my_table.my_col', true).')';
$params = array(
'stream' => 'sample',
'namespace' => 'sample',
'limit' => 5
);
$entries = $this->streams->entries->get_entries($params);
{{ if user:logged_in }}
<h1>Tools currently out</h1>
{{ streams:tool_inventory restrict_user="current" no_results="<p>You currently have no tools out.</p>"}}
<table class="toolInventory">
<thead>
<tr>
<td>Tool Category</td>
{{ streams:cycle stream="tool_inventory" restrict_user="current" }}
if ( ! $pag_base)
{
$segments = array_slice($this->uri->segment_array(), 0, $pag_segment-1);
$pagination_config['base_url'] = site_url(implode('/', $segments).'/');
}
else
{
$pagination_config['base_url'] = site_url($pag_base);
}
Change:
Email: {{ email_user<span style="color: rgb(116, 116, 116); font-family: Helmet, Freesans, sans-serif; font-size: 13px; line-height: 20px; ">:email_address&nbsp;</span>}}</div>
To:
Email: {{ email_user:email_address }}