<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: drupal code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 29 Aug 2008 21:24:16 GMT</pubDate>
    <description>DZone Snippets: drupal code</description>
    <item>
      <title>Getting Results for Paged Display</title>
      <link>http://snippets.dzone.com/posts/show/4807</link>
      <description>We can present these blog entries a better way: as a page of formatted results with links to more&lt;br /&gt;results. We can do that using Drupal&#8217;s pager. Let&#8217;s grab all of the blog entries again, only this&lt;br /&gt;time we&#8217;ll display them as a paged result, with links to additional pages of results and &#8220;first and&lt;br /&gt;last&#8221; links at the bottom of the page.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$sql = "SELECT * FROM {node} n WHERE type = 'blog' AND status = 1 ORDER BY&lt;br /&gt;n.created DESC"&lt;br /&gt;$result = pager_query(db_rewrite_sql($sql), 0, 10);&lt;br /&gt;while ($data = db_fetch_object($result)) {&lt;br /&gt;$node = node_load($data-&gt;nid);&lt;br /&gt;print node_view($node, TRUE);&lt;br /&gt;}&lt;br /&gt;// Add links to remaining pages of results.&lt;br /&gt;print theme('pager', NULL, 10);&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 21 Nov 2007 12:57:46 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4807</guid>
      <author>bifurcafe (Alex)</author>
    </item>
    <item>
      <title>[drupal] Show all nodes of current type</title>
      <link>http://snippets.dzone.com/posts/show/4796</link>
      <description>&lt;code&gt;&lt;br /&gt;$result = db_query('SELECT n.nid FROM {node} n WHERE n.type = '."'node_type'".' and n.status = 1');&lt;br /&gt;    $output = '';&lt;br /&gt;    while ($node = db_fetch_object($result))&lt;br /&gt;    {&lt;br /&gt;        $output .= node_view(node_load($node-&gt;nid), true);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    print $output;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 19 Nov 2007 10:15:57 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4796</guid>
      <author>bifurcafe (Alex)</author>
    </item>
  </channel>
</rss>
