Skip to content

Instantly share code, notes, and snippets.

@airways
airways / index.html
Created October 8, 2015 14:16
Basic ProForm 1.65+ Example template -- Example URL: example.com/forms/contact_us -- Place into forms.group template directory
{exp:proform:form form_name="{segment_2}" variable_prefix="pf_" error_delimiters="|"}
{pf_formpref:html_prefix}
{if pf_no_results}
{if pf_pref:invalid_form_message}
{pf_pref:invalid_form_message}
{if:else}
Invalid form name specified!
{/if}
{/if}
<script type="text/javascript" >
// So the JS knows where our files are
var site_url = "{site_url}";
</script>
{!-- The AJAX code should work with the default HTML generated by the simple form tag: --}
{exp:proform:simple form_name="contact_us"}
<script type="text/javascript" src="http://localhost/index.php//assets/js/contact_us.js"></script>
@airways
airways / index.html
Last active October 8, 2015 14:15
Basic ProForm 1.64 Example template -- Example URL: example.com/forms/contact_us -- Place into forms.group template directory
{exp:proform:form form_name="{segment_2}" variable_prefix="pf_"}
{if pf_no_results}
{if pf_pref:invalid_form_message}
{pf_pref:invalid_form_message}
{if:else}
Invalid form name specified!
{/if}
{/if}
{if pf_complete}
{if pf_pref:thank_you_message}
@airways
airways / export_csv.php
Last active December 7, 2015 14:37 — forked from apocratus/export_csv.php
Export MySQL to CSV (php script)
<?php
// database table to be exported
$db_table = 'XXXXXXXXX';
// optional where query
$where = 'WHERE 1 ORDER BY 1';
// filename for export
$csv_filename = 'db_export_'.$db_table.'_'.date('Y-m-d').'.csv';
// database variables
$hostname = "localhost";
@airways
airways / config_SLASH_site.php
Last active August 29, 2015 14:20
FuelCMS "site" module with custom datatypes ("modules") setup
<?php
/*
|--------------------------------------------------------------------------
| FUEL NAVIGATION: An array of navigation items for the left menu in the admin
|--------------------------------------------------------------------------
*/
$config['nav']['site'] = array(
'site/articles' => lang('module_site_articles'),
@airways
airways / gist:888cfea54e19ec2fcde1
Last active August 29, 2015 14:16
Handle manager for ExpressionEngine - returning objects from an add-on
// Field: Returning an array or object as a variable, for instance in a fieldtype
ee()->load->library('handle_manager');
$results = ee()->db->get('table_mapping')->results();
$table_pattern = array(
"table_data" => ee()->handle_manager->register($results) // Returns a handle, e.x.: {&100}
);
ee()->TMPL->parse_variables($tagdata, array($table_pattern));
{!-- Take the array of data in the table_data variable and pass it as a parameter to the plugin --}
{meta_table}
@airways
airways / with_stash.html
Last active August 29, 2015 14:16
Stash comparison
<div class="section sticky_nav">
<div class="filter_nav">
<ul>
{!-- category 2 -- a post type --}
{!-- build url so far --}
{exp:stash:set name="filter_base1"}{site_url}{segment_1}{if router_blog_name != ""}/{router_blog_name}{/if}/{if router_cat1 != ""}{router_cat1}{if:else}all{/if}{/exp:stash:set}
<li class="{if router_cat2_category_url_title == ''}active{/if}"><a href="{exp:stash:filter_base1 random}/all/">All Results</a></li>
{exp:channel:categories category_group="3" style="linear"}
@airways
airways / proform_view.php
Created July 27, 2013 16:48
Fix for pre EE 2.6
<?php
class PF_View extends View {
public function __construct(View $view)
{
if(!isset($this->EE)) $this->EE = &get_instance(); // <-- Add this line
$this->set_cp_theme($view->_theme);
}
public function head_title($title)
{ce:core:recurse in=tree children_field="__children"}
{loop_items}
<li>
<span><a href="{cp_url}publish/edit/{__type}/{__id}">{title}</a></span>
{if __children}
<ul>
{__children}
</ul>
{/if}
</li>
@airways
airways / gist:5882120
Created June 28, 2013 02:49
One day...
{ce:core:foreach in=beans}
<tr>
{ce:core:foreach in=loop_value}
{if loop_key == table_id}
<td>[{table_id}] {loop_key} = <a href="{cp_url}publish/edit/{type}/{loop_value}">{loop_value}</a></td>
{if:else}
{if loop_key == 'title'}
<td>title {loop_key} = <a href="{cp_url}publish/edit/{type}/{bean_id}">{loop_value}</a></td>
{if:else}
{if loop_key != 'loop_key' & loop_key != 'parent_id' & loop_key != 'bean_id'}