Skip to content

Instantly share code, notes, and snippets.

View bjornbjorn's full-sized avatar

Bjørn Børresen bjornbjorn

View GitHub Profile
@bjornbjorn
bjornbjorn / mod.forum.php
Created October 26, 2011 08:22
Adding support for theme='' parameter in {exp:forum} tag
/**
This core hack in mod.forum.php will enable you to load a different forum theme from different templates.
Append in the constructor, just after $this->_load_base() like shown below.
*/
/** -------------------------------------
/** Load Base Forum Variables
/** -------------------------------------*/
============( index.html )=================
{embed="sidebar" location="wiki"} <- In this case EE will treat the conditionals in sidebar.html as simple, and only one of the {exp:class} tags will run
{embed="sidebar"} <- in this case (where embed:location is empty) EE will treat all conditionals as advanced and run every single tag!
============( sidebar.html )=================
@bjornbjorn
bjornbjorn / mod.oktan_web
Created February 17, 2012 12:21
Creating a search_form() tag in an ExpressionEngine module
public function search_form()
{
/** ----------------------------------------
/** Get action ID for redirect_search method
/** ----------------------------------------*/
$hidden['ACT'] = $this->EE->functions->fetch_action_id(get_class($this), 'redirect_search');
/** ----------------------------------------
/** Return the final rendered form
/** ----------------------------------------*/
@bjornbjorn
bjornbjorn / blog_index_entry.html
Created July 24, 2012 12:21
Infinite scroll with #eecms
{exp:channel:entries channel="blog" limit="1" offset="{segment_3}" dynamic="off" category="{segment_4}"}
{sn_blog_index_entry}
{/exp:channel:entries}
@bjornbjorn
bjornbjorn / config.local.php
Created September 28, 2012 18:41
@focuslabllc Master Config file upload directory paths
$env_config['upload_preferences'] = array(
1 => array(
'name' => 'Uploads',
'server_path' => APPPATH."..\\..\\webroot\\uploads\\",
'url' => $env_config['base_url'].'uploads/'
),
);
@bjornbjorn
bjornbjorn / ext.oktan_web.php
Created October 1, 2012 14:00
Norwegian URL titles conversion array
/**
* Make sure url-titles look good for non-english entries also
*/
public function on_foreign_character_conversion_array()
{
return array(
'216' => 'o', // ø
'248' => 'o', // Ø
'198' => 'a', // æ
'230' => 'a', // Æ
<title>{title}{site_name}</title>
<meta name='keywords' content='{meta_keywords}' />
<meta name='description' content='{meta_description}' />
<link rel='canonical' href='{canonical_url}' />
<meta property="og:url" content="{canonical_url}"/>
<meta property="og:title" content="{entry_title}"/>
<meta property="og:description" content="{extra:desc}"/>
<meta property="og:image" content="{extra:image}"/>
@bjornbjorn
bjornbjorn / api.total.php
Created April 10, 2013 16:58
Replacing {filedir_1} in channel_data
$grid_image = str_replace('{filedir_1}', '/uploads/', $grid_image);
/**
This is how the above _should_ be done:
if (preg_match('/^{filedir_(\d+)}/', $src, $matches))
{
$filedir_id = $matches[1];
$this->EE->load->model('file_upload_preferences_model');
@bjornbjorn
bjornbjorn / map.html
Last active November 20, 2017 13:17
Search bar + drag and drop pin to let users specify a geolocation - results saved to lat/long input fields (which can be hidden in the form)
<!DOCTYPE html>
<html lang="nb">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
</head>
<body>
@bjornbjorn
bjornbjorn / structure_views_index.php.diff
Created January 6, 2014 12:26
Hack for enabling Structure (3.3.13) to allow url_title "/" on root node
---
third_party/structure/views/index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/third_party/structure/views/index.php b/third_party/structure/views/index.php
index 2bf7e9d..2db600f 100755
--- a/third_party/structure/views/index.php
+++ b/third_party/structure/views/index.php
@@ -47,7 +47,7 @@ $level_lock_delete = is_numeric(substr($permissions['delete'], -1)) ? (int)subst