Skip to content

Instantly share code, notes, and snippets.

# create partial file list for checksums.txt
cd textpattern/vendors/Textpattern && find .. -type f -name \*.php|cut -b 3-|sed "s/.*/\\0: .123456789.123456789.123456789.1/"
# do copy & paste
# later... create checksums
php -f ../../textpattern-toolbelt/release/checksums.php . > checksums.new.txt && mv checksums.new.txt checksums.txt
@media tty {
foo {bar: baz;}
foo {bar: baz;}
foo {bar: baz;}
foo {bar: baz;}
foo {bar: baz;}
foo {bar: baz;}
foo {bar: baz;}
foo {bar: baz;}
foo {bar: baz;}
@rwetzlmayr
rwetzlmayr / tagpattern-tags-from-php.php
Last active December 10, 2015 13:48
HOWTO: Call a Textpattern tag from PHP. Employs <txp:category1 /> for demonstration purposes, but this technique will work with any other tag. Note the use of attributes and their values passed into the tag handler function as an array.
<txp:php>
echo category1(
array(
'title' => '1',
'link' => '1',
'section' => 'articles'
)
);
</txp:php>
@rwetzlmayr
rwetzlmayr / gist:3832080
Created October 4, 2012 08:01
fork diffed
git clone https://github.com/gocom/textpattern.git textpattern && cd textpattern && git checkout master && git diff master..4x-doc-up
@rwetzlmayr
rwetzlmayr / Textpattern meta description
Created December 27, 2011 07:16
meta element 'description' for Textpattern sites w/ one page equaling one section
<txp:if_section name="default"><txp:variable name="s" value="home" /><txp:else /><txp:variable name="s" value='<txp:section />' /></txp:if_section>
<txp:article_custom section='<txp:variable name="s" />' limit="1">
<meta name="description" content="<txp:title />: <txp:rss_auto_excerpt words="30" striptags="1" showlinkwithexcerpt="0" stripbreakstabs="1" excerptwraptag="" ending="&#8230;" />" />
</txp:article_custom>
@rwetzlmayr
rwetzlmayr / gist:727971
Created December 4, 2010 06:09
wet_if_comment_submitted conditional Textpattern tag
<!-- somewhere in your template, forms, -->
<txp:php>
function wet_if_comment_submitted($attr, $thing)
{
return parse(EvalElse($thing, isset($_GET['commented'])));
}
</txp:php>
<!-- in your comment form: -->
<txp:wet_if_comment_submitted>
@rwetzlmayr
rwetzlmayr / gist:630852
Created October 17, 2010 13:26
TXP 4.3.0 w/o i18n in css
Index: textpattern/publish.php
===================================================================
--- textpattern/publish.php (revision 3429)
+++ textpattern/publish.php (working copy)
@@ -109,7 +109,7 @@
$txp_user = NULL;
//i18n: $textarray = load_lang('en-gb');
- $textarray = load_lang(LANG);
+ $textarray = (txpinterface == 'css') ? array() : load_lang(LANG);
<txp:php>global $sh_title, $sh_url, $sh_sitename, $sh_summary, $sitename;
$nil = array();
$sh_title = rawurlencode(title(array('nowidow' => false)));
$sh_url = rawurlencode(permlink($nil));
$sh_sitename = rawurlencode($sitename);
$sh_summary = rawurlencode(preg_replace('/^(.{0,120}).*$/su','$1', strip_tags(body($nil)))).'…';
</txp:php>
<ul class="share-this" id="share-this">
<li class="xing"><a rel="nofollow" href="https://www.xing.com/app/user?op=share;url=<txp:php>global $sh_url;