[geeklog-cvs] journal functions.inc,1.6,1.7

geeklog-cvs-admin at lists.geeklog.net geeklog-cvs-admin at lists.geeklog.net
Wed Aug 6 16:10:34 EDT 2003


Update of /usr/cvs/geeklog/journal
In directory geeklog_prod:/tmp/cvs-serv6690

Modified Files:
	functions.inc 
Log Message:
Implemented plugin_getheadercode_journal() so that each journal with an RSS feed will have a <link> to that feed in the site's header.


Index: functions.inc
===================================================================
RCS file: /usr/cvs/geeklog/journal/functions.inc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** functions.inc	31 Jul 2003 17:58:40 -0000	1.6
--- functions.inc	6 Aug 2003 20:10:32 -0000	1.7
***************
*** 1046,1049 ****
--- 1046,1087 ----
  
  /**
+ * For any journal with an RSS feed, add an RSS link to the site's header.
+ *
+ * Note: Requires Geeklog 1.3.8 and a theme that has {plg_headercode} in its
+ *       <head> section in header.thtml.
+ *
+ * @return   string   link tags for each journal with an RSS feed
+ *
+ */
+ function plugin_getheadercode_journal ()
+ {
+     global $_TABLES, $_CONF;
+ 
+     $retval = '';
+ 
+     $feedpath = $_CONF['rdf_file'];
+     $pos = strrpos ($feedpath, '/');
+     $feed = substr ($feedpath, 0, $pos + 1);
+     $feedpath = substr_replace ($feed, $_CONF['site_url'], 0,
+                                 strlen ($_CONF['path_html']) - 1);
+ 
+     $result = DB_query ("SELECT jrn_id,jrn_name FROM {$_TABLES['journal']} WHERE jrn_public = 1 AND jrn_feed = 1");
+     $num = DB_numRows ($result);
+     for ($i = 0; $i < $num; $i++) {
+         $A = DB_fetchArray ($result);
+         $title = $A['jrn_name'];
+         if (strlen ($title) > 20) {
+             $title = substr ($title, 0, 17) . '...';
+         }
+         $title = htmlspecialchars ($title);
+         $retval .= '<link rel="alternate" type="application/rss+xml" href="'
+                 . $feedpath . sprintf ('journal%d.rss', $A['jrn_id'])
+                 . '" title="RSS: ' . $title . '">' . LB;
+     }
+ 
+     return $retval;
+ }
+ 
+ /**
  * Removes the datastructures for this plugin from the Geeklog database
  *





More information about the geeklog-cvs mailing list