Skip to content

Instantly share code, notes, and snippets.

View dannevang's full-sized avatar

Mathias Dannevang dannevang

View GitHub Profile
@dannevang
dannevang / new-products.xml
Created June 6, 2012 09:18 — forked from zeljkoprsa/new-products.xml
List New Products with toolbar (Grid/List, pagiantion the whole shebang )
<reference name="content">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<action method="setCategoryId"><category_id>8</category_id></action>
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</reference>
@dannevang
dannevang / gist:2923188
Created June 13, 2012 10:01
MODX: Disable TinyMCE for user
Security -> Manage Users -> "Specific user" -> Settings (tab)
Key:
use_editor
Type:
Textfield
Descr:
setting_use_editor_desc
<?php
/*
simplx.dompdf
*/
$filename = isset($filename) ? $filename : false;
$outputto = isset($outputto) ? $outputto : 'file';
[[[[*page-image:notempty=`$wrapImgThumb? &src=`*page-image` &alt=`[[*pagetitle]]` &thumbOpts=`w=480&h=320``]]]]
@dannevang
dannevang / trackGaMailto.js
Last active April 14, 2021 07:30
Track mailto events in Google Analytics with jQuery. Normal ga.js and jQuery is required.
$(document).ready(function() {
$('a[href^="mailto"]').click(function(){
_gaq.push(['_trackEvent', 'email', 'send', this.href.replace(/^mailto:/i,'') + ' /Page = ' + location.href,,true]);
});
});
@dannevang
dannevang / gist:5806597
Created June 18, 2013 16:00
Magento. Get categories by ID and display subcategories if any. Will work directly from top.phtml
<?php $_helper = Mage::helper('catalog/category');
$children = Mage::getModel('catalog/category')->getCategories(CATETGORY_ID_HERE);
foreach ($children as $category):
$category = Mage::getModel('catalog/category')->load($category->getId());
echo '<li class="level1"><a href="' . $category->getUrl() . '">' . $category->getName() . '</a>';
$category = Mage::getModel('catalog/category')->load($category->getId());
$_subcategories = $category->getChildrenCategories();
if (count($_subcategories) > 0): ?>
<ul>
<?php foreach($_subcategories as $_subcategory): ?>
@dannevang
dannevang / remote_file_check
Created June 26, 2013 13:40
PHP. Check if a file exists in another server.
<?php
function fileExists($path){
return (@fopen($path,"r")==true);
}
?>
@dannevang
dannevang / Full Height
Last active December 21, 2015 22:42 — forked from joanhard/index
Full height sidebar
<div class="row">
<div class="large-8 column">
My Content
</div>
<div class="large-4 column full-height">
<aside class="sidebar">
My Sidebar
</aside>
</div>
</div>
@dannevang
dannevang / fullHeight.js
Created March 10, 2014 10:20
jQuery Full height columns
//CALL THIS IN THE FOOTER, AFTER THE DOM HAS BEEN LOADED AND ANY OTHER DOM MANIPULATING JS HAS BEEN EXECUTED
function updateSidebar() {
var $width = document.documentElement.clientWidth,
$height = document.documentElement.clientHeight,
$main = jQuery('#main').height();
$sidebar = jQuery('#sidebar').height();
if($width > 755) {
if($main > $sidebar) {
jQuery('#sidebar').css({'min-height': $main});
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php