<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: textpattern code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 21:36:43 GMT</pubDate>
    <description>DZone Snippets: textpattern code</description>
    <item>
      <title>Append to Article Body</title>
      <link>http://snippets.dzone.com/posts/show/2983</link>
      <description>Here's the code to insert some bit of text to the end of your article body. For the &lt;a href="http://forum.textpattern.com/viewtopic.php?id=19647"&gt;Textpattern plugin&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var obj = document.getElementById('body');&lt;br /&gt;obj.value = obj.value+"SOME TEXT";&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 10 Nov 2006 06:02:03 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2983</guid>
      <author>tmcw ()</author>
    </item>
    <item>
      <title>Set a Field Equal to Something</title>
      <link>http://snippets.dzone.com/posts/show/2982</link>
      <description>A basic code sample for tcm_write_macros. It sets a custom field to a value&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* also - custom-1, custom-2, custom-3, custom-4, custom-5, etc for custom fields. */&lt;br /&gt;var obj = document.getElementById('custom-3');&lt;br /&gt;obj.value = "VALUE";&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 10 Nov 2006 05:55:58 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2982</guid>
      <author>tmcw ()</author>
    </item>
    <item>
      <title>Textpattern - display log by hostname</title>
      <link>http://snippets.dzone.com/posts/show/1886</link>
      <description>&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;link href="/textpattern/textpattern.css" rel="Stylesheet" type="text/css" /&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;require_once("textpattern/config.php");&lt;br /&gt;mysql_connect($txpcfg['host'], $txpcfg['user'], $txpcfg['pass']) or die(mysql_error());&lt;br /&gt;mysql_select_db($txpcfg['db']) or die(mysql_error());&lt;br /&gt;&lt;br /&gt;// Quote variable to make safe&lt;br /&gt;function quote_smart($value)&lt;br /&gt;{&lt;br /&gt;   // Stripslashes&lt;br /&gt;   if (get_magic_quotes_gpc()) {&lt;br /&gt;       $value = stripslashes($value);&lt;br /&gt;   }&lt;br /&gt;   // Quote if not a number or a numeric string&lt;br /&gt;   if (!is_numeric($value)) {&lt;br /&gt;       $value = mysql_real_escape_string($value);&lt;br /&gt;   }&lt;br /&gt;   return $value;&lt;br /&gt;}&lt;br /&gt;$sql = "SELECT * FROM " .$txpcfg['table_prefix'] ."txp_log WHERE host LIKE '%" .quote_smart($_GET['host']) ."%' ORDER BY 'time' DESC LIMIT 0, 30 ";&lt;br /&gt;$result = mysql_query($sql) or die(mysql_error());&lt;br /&gt;echo "&lt;table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" id=\"list\" align=\"center\"&gt;";&lt;br /&gt;echo "&lt;tr&gt;&lt;td&gt;&lt;b&gt;Time&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;host&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;page&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;";&lt;br /&gt;while($row = mysql_fetch_array($result))&lt;br /&gt;{&lt;br /&gt; echo "&lt;tr&gt;&lt;td&gt;".$row['time']."&lt;/td&gt;&lt;td&gt;".$row['host']."&lt;/td&gt;&lt;td&gt;".$row['page']."&lt;/td&gt;&lt;/tr&gt;";&lt;br /&gt;}&lt;br /&gt;echo "&lt;/table&gt;";&lt;br /&gt;?&gt;&lt;br /&gt;&lt;/body&gt;&lt;/html&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;</description>
      <pubDate>Tue, 11 Apr 2006 20:05:11 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1886</guid>
      <author>lordrich ()</author>
    </item>
  </channel>
</rss>
