Admun's NUDN

admun

  • San Francisco, CA

Navigation

Navigation

Categories

The Way to Show the Item

I saw some code from NP_Print the other day about how it parses and display an item. I thought I will distill it and document a snippet of code hope other plugin developer found useful.

Here's a example how to display an item:

...
show code to get access to $blog object

  echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
\"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>";
  echo "<title>Show an item</title>\n";
  echo "</head>\n";
  echo "<body>\n";

  $plugin =& $manager->getPlugin('NP_SomePlugin');
  $template = $plugin->getOption('templatename'); 
  $query = $b->getSqlBlog(' and inumber=' . intval($itemid)); 
  $b->showUsingQuery($template, $query, '', 0, 0);

  echo "</body>\n</html>\n";

...

This code snippet required $itemid, and a template name (stored in plugin option) to work. $itemid is usually passed in from HTTP and initialized in config.php.

For a full functional example, please see NP_ShowDraft

17:53:45 on 11/04/04 by Admun - Category: Developer Notes - tags: none - print

Comments

No comments yet

Add Comments