Skip to content

Instantly share code, notes, and snippets.

View betweenbrain's full-sized avatar
🎯
Focusing

Matt Thomas betweenbrain

🎯
Focusing
View GitHub Profile
@betweenbrain
betweenbrain / gist:2645141
Created May 9, 2012 14:59
Get category ID of Joomla article
JModel::addIncludePath(JPATH_SITE.'/components/com_content/models', 'ContentModel');
$model = JModel::getInstance('Article', 'ContentModel');
$article=$model->getItem();
foreach($article as $key => $value) {
if ($key = 'catid') {
echo "catid $value";
}
break;
}
body {
font-size: 76%;
}
#body-container {
width: 96%;
}
#body-container .gutter {
margin: 0 2%;
}
@betweenbrain
betweenbrain / gist:2652727
Created May 10, 2012 12:20
How to add assets to a Joomla template
$doc = JFactory::getDocument();
$doc->addStyleSheet('templates/' . $this->template . '/css/screen.css','text/css','screen');
$doc->addCustomTag('<meta name="author" content="Matt Thomas, matt@betweenbrain.com" />');
$doc->addFavicon('templates/' . $this->template . '/favicon.png','image/png','shortcut icon');
$doc->addScript('https://raw.github.com/LeaVerou/prefixfree/master/prefixfree.min.js');
@betweenbrain
betweenbrain / gist:2652806
Created May 10, 2012 12:39
Example Joomla template head
<?php defined('_JEXEC') or die;
$doc = JFactory::getDocument();
$doc->addStyleSheet('/templates/system/css/screen.css');
$doc->addStyleSheet('/templates/system/css/general.css');
$doc->addStyleSheet('templates/' . $this->template . '/css/default.css');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
@betweenbrain
betweenbrain / gist:2655257
Created May 10, 2012 19:20
DOCman 1.6.4 DOClink tweak to increase modal size
Index: components/com_docman/assets/css/doclink.css
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- components/com_docman/assets/css/doclink.css (revision 2a61a685c476f7a9c5780fa1aad1fae07892c1e5)
+++ components/com_docman/assets/css/doclink.css (revision )
@@ -9,7 +9,7 @@
*/
@betweenbrain
betweenbrain / gist:2769430
Created May 22, 2012 14:32
Various Regexes
Replace <li>(<span>.+?</span>) (<a .+?</a>)</li> with: <li>$2 $1</li> - https://twitter.com/#!/NoNumber_nl/status/204938777389576194
@betweenbrain
betweenbrain / gist:2829644
Created May 29, 2012 17:31
Google Lightbox Background
background: #666;
background-image: -webkit-gradient(radial,center center,125,center center,800,from(white),to(#4C4C4C));
background-image: -moz-radial-gradient(50% 50% 90deg,circle farthest-side,white,#4C4C4C);
position: fixed;
left: 0;
top: 0;
z-index: 999;
@betweenbrain
betweenbrain / gist:2895041
Created June 8, 2012 11:16
JHtml sliders - start in collapsed state
from: https://groups.google.com/forum/#!msg/joomla-dev-general/WfMoTdxf6hg/Mgep5T42i0EJ
<?php echo JHtml::_('sliders.start', 'slider-panel-id', array('useCookie'=>0, 'startOffset'=>-1, 'startTransition'=>1)); ?>
@betweenbrain
betweenbrain / gist:3012422
Created June 28, 2012 16:43
SQL to Update HTML in a Joomla article
update jos_content set introtext = replace(introtext,'<table style=\"width: 800px; height: 304px;\" border=\"0\">','<table border=\"0\">');
@betweenbrain
betweenbrain / cookieRedirect.js
Created June 29, 2012 21:00
Check for cookie support, then check for secret variable in URL to permit access to site, otherwise redirect
// from http://www.quirksmode.org/js/cookies.html
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}