Skip to content

Instantly share code, notes, and snippets.

View objectivehtml's full-sized avatar

Justin Kimbrell objectivehtml

  • Woodland Park, CO
View GitHub Profile
//Primary syntax
$this->EE->channel_data->get_channel_entries($channel_id = 1, array(
'where' => array(
'channel_titles.entry_id !=' => array(
1,
2,
3,
4
)
{exp:channel:entries
channel="producers"
disable="member_data|categories|category_fields|pagination"
dynamic="no"
url_title="{segment_3}"
}
{exp:stash:set no_results_prefix="nested_"}
{stash:page_title}{title}{/stash:page_title}
@objectivehtml
objectivehtml / gist:3784945
Created September 25, 2012 22:51
Get filename from URL
/(((.|\n)*)[\/$])|(\.(.|\n)*)/g
<?php
$channels = $this->EE->channel_data->get_channels(array(
'where' => array(
'site_id' => 1
)
));
@objectivehtml
objectivehtml / gist:3776820
Created September 24, 2012 16:23
Get author_id using polymorphic parameters with Channel Data
public function author_id()
{
$params = array(
'username',
'screen_name',
'email'
);
$where = array();
@objectivehtml
objectivehtml / gist:3761912
Created September 21, 2012 14:48
Manipulate the no_results tag
// Add this to your module tag
if($no_results_prefix = $this->EE->TMPL->fetch_param('no_results_prefix'))
{
if(preg_match('/\\'.LD.'if '.$no_results_prefix.'no_results\\'.RD.'.*\\'.LD.'\\/if\\'.RD.'/us', $this->EE->TMPL->tagdata, $matches))
{
$this->EE->TMPL->no_results = $this->EE->TMPL->parse_variables_row($matches[0], array(
$no_results_prefix.'no_results' => 1
));
}
Using just an extension...
{exp:channel:entries
channel="events"
showtimes="yes"
}
{title}
{/exp:channel:entries}
@objectivehtml
objectivehtml / gist:3666017
Created September 7, 2012 12:52
Channel Entries API with Channel Data
<?php
$entry = array(
'title' => $this->post('title'),
'status' => 'Unpaid',
'allow_comments' => 'y',
'entry_description' => $this->post('entry_description'),
'entry_client_name' => $this->post('entry_client_name'),
'entry_delivery_method' => $this->post('entry_delivery_method'),
'entry_url' => $this->post('entry_url'),
$channel_fields = $this->EE->channel_data->get_channel_fields($channel_id = 1)->result();
$channel_fields = $this->EE->channel_data->utility->reindex($channel_fields, 'field_name');
$channel_fields['your_field_name']->field_id; // Would out put the field's id
<?php
$var = array(
array(
'name' => 'Some Name 1',
'value' => 'Some Value 1'
),
array(
'name' => 'Some Name 2',
'value' => 'Some Value 2'