Skip to content

Instantly share code, notes, and snippets.

@modxws
modxws / modxws-74-2.html
Last active August 29, 2015 14:04
modxws-74-2
<a href="[[~[[+id]]]]">[[+pagetitle]]</a></li>
@modxws
modxws / csvtotable.php
Created May 29, 2014 06:19
Урок 28. csvtotable
<?php
$a = explode("\n", $input);
foreach ($a as $key => $line)
{
$a[$key] = explode(",", $line);
};
foreach ($a as $element)
{ $output .="
<tr>
@modxws
modxws / csvfiletotable.php
Created May 29, 2014 06:15
Урок 28. csvfiletotable
<?php
function getArrayFromCsv($file,$delimiter) {
if (($handle = fopen($file, "r")) !== FALSE) {
$i = 0;
while (($lineArray = fgetcsv($handle, 4000, $delimiter)) !== FALSE) {
for ($j=0; $j<count($lineArray); $j++) {
$data2DArray[$i][$j] = $lineArray[$j];
}
$i++;
}
@modxws
modxws / tags.html
Created August 9, 2013 23:19
Tags with toLinks Snippet MODX
[[*blogtags:notempty=`[[!tolinks? &items=`[[*blogtags]]` &tagKey=`blogtags` &tpl=`tolinks.tpl` &outputDelim=`` &target=`28`]]`]]
<?php
// Отвечаем ТОЛЬКО на ajax запросы
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {return;}
// данный код можно расширить добавив другие действия и указать их в case
$action = filter_input(INPUT_POST,'action');
// Если в массиве POST нет действия - выход
if (empty($action)) {return;}
@modxws
modxws / metadata.html
Last active December 20, 2015 18:59
metadata
<meta property="og:image" content="[[++site_url]][[*title_post_image:phpthumbof=`w=200&h=200&rc=1`]]"/>
<meta property="og:site_name" content="[[++site_name:htmlent]]"/>
<meta property="og:title" content="[[*pagetitle]]"/>
<meta property="og:url" content="[[~[[*id]]? &scheme=`full`]]"/>
<meta property="og:type" content="article"/>
@modxws
modxws / metadata.html
Created August 7, 2013 23:48
metadata
<meta property="og:image" content="[[++site_url]][[*title_post_image:phpthumbof=`w=90&h=90&q=80&zc=T`]]"/>
<meta property="og:site_name" content="[[++site_name:htmlent]]"/>
<meta property="og:title" content="[[*pagetitle]]"/>
<meta property="og:url" content="[[~[[*id]]? &scheme=`full`]]"/>
<meta property="og:type" content="article"/>
function throttle( fn, time ) {
var t = 0;
return function() {
var args = arguments, ctx = this;
clearTimeout(t);
t = setTimeout( function() {
fn.apply( ctx, args );
}, time );
};
@modxws
modxws / test.php
Created August 7, 2013 18:25
test
<html>
<body>
<h2 style="padding:5px; color:black">Custom Tpl, edit to suit your needs<br />
<a href="http://modx.ws/notify.html">Notify</a>
MODX Webschool.
</h2>
<a href="http://modx.ws/notify.html">Check it out</a>
Ext.onReady(function() {
var myDiv1 = Ext.get('div1');
myDiv1.insertFirst({
tag : 'div',
html : 'Дочерний элемент вставленный перед контейнером div1',
});
});