[geeklog-cvs] geeklog: Added meta description and meta keywords to topics.

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Mon Aug 24 11:51:50 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/6230420fef6d
changeset: 7254:6230420fef6d
user:      Tom <websitemaster at cogeco.net>
date:      Mon Aug 24 09:42:00 2009 -0400
description:
Added meta description and meta keywords to topics.

diffstat:

 plugins/polls/functions.inc                                   |   4 ++--
 public_html/admin/topic.php                                   |  15 ++++++++++++---
 public_html/docs/english/config.html                          |   2 +-
 public_html/index.php                                         |  12 ++++++++++++
 public_html/layout/professional/admin/topic/topiceditor.thtml |   8 ++++++++
 sql/mssql_tableanddata.php                                    |   6 ++++--
 sql/mysql_tableanddata.php                                    |   6 ++++--
 sql/updates/mssql_1.6.0_to_1.6.1.php                          |   5 ++++-
 sql/updates/mysql_1.6.0_to_1.6.1.php                          |   4 ++++
 9 files changed, 51 insertions(+), 11 deletions(-)

diffs (201 lines):

diff -r e6b9b651bbce -r 6230420fef6d plugins/polls/functions.inc
--- a/plugins/polls/functions.inc	Sun Aug 16 17:55:44 2009 +0200
+++ b/plugins/polls/functions.inc	Mon Aug 24 09:42:00 2009 -0400
@@ -1383,8 +1383,8 @@
 /**
 * Poll Autotags
 * [poll: pid] - Displays a link to a poll using the Poll Topic as the title. A alternate title may be specified. 
-* [poll-vote: pid pid class:poll-autotag showall:1] - Width and showall not required. Class specifies the css class and Showall if set to 1, shows all questions
-* [poll-result: pid class:poll-autotag] - Width and showall not required. Class specifies the css class
+* [poll_vote: pid pid class:poll-autotag showall:1] - Class and showall not required. Class specifies the css class and Showall if set to 1, shows all questions
+* [poll_result: pid class:poll-autotag] - Class not required. Class specifies the css class
 *
 */
 function plugin_autotags_polls($op, $content = '', $autotag = '')
diff -r e6b9b651bbce -r 6230420fef6d public_html/admin/topic.php
--- a/public_html/admin/topic.php	Sun Aug 16 17:55:44 2009 +0200
+++ b/public_html/admin/topic.php	Mon Aug 24 09:42:00 2009 -0400
@@ -174,6 +174,11 @@
     $topic_templates->set_var('max_url_length', 255);
     $topic_templates->set_var('image_url', $A['imageurl']);
 
+    $topic_templates->set_var('lang_metadescription', $LANG_ADMIN['meta_description']);
+    $topic_templates->set_var('meta_description', stripslashes($A['meta_description']));
+    $topic_templates->set_var('lang_metakeywords', $LANG_ADMIN['meta_keywords']);
+    $topic_templates->set_var('meta_keywords', stripslashes($A['meta_keywords']));
+
     $topic_templates->set_var ('lang_defaulttopic', $LANG27[22]);
     $topic_templates->set_var ('lang_defaulttext', $LANG27[23]);
     if ($A['is_default'] == 1) {
@@ -209,6 +214,8 @@
 * @param    string  $tid            Topic ID
 * @param    string  $topic          Name of topic (what the user sees)
 * @param    string  $imageurl       (partial) URL to topic image
+* @param    string  $meta_description    Topic meta description
+* @param    string  $meta_keywords       Topic meta keywords
 * @param    int     $sortnum        number for sort order in "Topics" block
 * @param    int     $limitnews      number of stories per page for this topic
 * @param    int     $owner_id       ID of owner
@@ -221,7 +228,7 @@
 * @param    string  $is_archive     'on' if this is the archive topic
 * @return   string                  HTML redirect or error message
 */
-function savetopic($tid,$topic,$imageurl,$sortnum,$limitnews,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$is_default,$is_archive)
+function savetopic($tid,$topic,$imageurl,$meta_description, $meta_keywords,$sortnum,$limitnews,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$is_default,$is_archive)
 {
     global $_CONF, $_TABLES, $LANG27, $MESSAGE;
 
@@ -253,6 +260,8 @@
             $imageurl = '';
         }
         $topic = addslashes ($topic);
+        $meta_description = addslashes ($meta_description);
+        $meta_keywords = addslashes ($meta_keywords);
 
         if ($is_default == 'on') {
             $is_default = 1;
@@ -280,7 +289,7 @@
             }
         }
 
-        DB_save($_TABLES['topics'],'tid, topic, imageurl, sortnum, limitnews, is_default, archive_flag, owner_id, group_id, perm_owner, perm_group, perm_members, perm_anon',"'$tid', '$topic', '$imageurl','$sortnum','$limitnews',$is_default,'$is_archive',$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon");
+        DB_save($_TABLES['topics'],'tid, topic, imageurl, meta_description, meta_keywords, sortnum, limitnews, is_default, archive_flag, owner_id, group_id, perm_owner, perm_group, perm_members, perm_anon',"'$tid', '$topic', '$imageurl', '$meta_description', '$meta_keywords','$sortnum','$limitnews',$is_default,'$is_archive',$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon");
 
         // update feed(s) and Older Stories block
         COM_rdfUpToDateCheck('article', $tid);
@@ -579,7 +588,7 @@
         $is_archive = $_POST['is_archive'];
     }
     $display .= savetopic (COM_applyFilter ($_POST['tid']), $_POST['topic'],
-                           $imageurl,
+                           $imageurl, $_POST['meta_description'], $_POST['meta_keywords'],
                            COM_applyFilter ($_POST['sortnum'], true),
                            COM_applyFilter ($_POST['limitnews'], true),
                            COM_applyFilter ($_POST['owner_id'], true),
diff -r e6b9b651bbce -r 6230420fef6d public_html/docs/english/config.html
--- a/public_html/docs/english/config.html	Sun Aug 16 17:55:44 2009 +0200
+++ b/public_html/docs/english/config.html	Mon Aug 24 09:42:00 2009 -0400
@@ -96,7 +96,7 @@
 <tr>
   <td valign="top"><a name="desc_meta_tags">meta_tags</a></td>
   <td valign="top">disabled</td>
-  <td valign="top">Enabled - The meta tags for stories will be displayed. If none are found, then the default will be used. The defaults will also be used for any page that doesn't have meta tags.<br>
+  <td valign="top">Enabled - The meta tags for stories and topics will be displayed. If none are found, then the default will be used. The default will also be used for any page that doesn't have meta tags.<br>
       Enabled (Default for Homepage only) - The same as Enabled except, the defaults are used only for the Homepage.<br>
     Disabled - Meta tags are not used.</td></tr>
 <tr>
diff -r e6b9b651bbce -r 6230420fef6d public_html/index.php
--- a/public_html/index.php	Sun Aug 16 17:55:44 2009 +0200
+++ b/public_html/index.php	Mon Aug 24 09:42:00 2009 -0400
@@ -131,6 +131,18 @@
     $header = '<link rel="microsummary" href="' . $_CONF['site_url']
             . '/index.php?display=microsummary&topic=' . urlencode($topic)
             . '" title="Microsummary"' . XHTML . '>';
+
+    // Meta Tags
+    If ($_CONF['meta_tags'] > 0) {
+        $result = DB_query ("SELECT meta_description, meta_keywords FROM {$_TABLES['topics']} WHERE tid = '{$topic}'");
+        $A = DB_fetchArray ($result);
+
+        $meta_description = stripslashes($A['meta_description']);
+        $meta_keywords = stripslashes($A['meta_keywords']);
+        //$meta_description = stripslashes( DB_getItem( $_TABLES['topics'], 'meta_description', "tid = '$topic'" ));
+        //$meta_keywords = stripslashes( DB_getItem( $_TABLES['topics'], 'meta_keywords', "tid = '$topic'" ));
+        $header .=  COM_createMetaTags($meta_description, $meta_keywords);
+    }
 } else {
     $header = '<link rel="microsummary" href="' . $_CONF['site_url']
             . '/index.php?display=microsummary" title="Microsummary"' . XHTML . '>';
diff -r e6b9b651bbce -r 6230420fef6d public_html/layout/professional/admin/topic/topiceditor.thtml
--- a/public_html/layout/professional/admin/topic/topiceditor.thtml	Sun Aug 16 17:55:44 2009 +0200
+++ b/public_html/layout/professional/admin/topic/topiceditor.thtml	Mon Aug 24 09:42:00 2009 -0400
@@ -25,6 +25,14 @@
                                         <td><input type="file" name="newicon"{xhtml}> ({lang_maxsize} {icon_dimensions})</td>
                                     </tr>
                                     <tr>
+                                        <td valign="top" align="right">{lang_metadescription}:</td>
+                                        <td><textarea name="meta_description" style="width:100%" rows="2">{meta_description}</textarea></td>
+                                    </tr>
+                                    <tr>
+                                        <td valign="top" align="right">{lang_metakeywords}:</td>
+                                        <td><textarea name="meta_keywords" style="width:100%" rows="2">{meta_keywords}</textarea></td>
+                                    </tr>                                     
+                                    <tr>
                                         <td class="alignright">{lang_defaulttopic}:</td>
                                         <td><input type="checkbox" name="is_default" {default_checked}{xhtml}> ({lang_defaulttext})</td>
                                     </tr>
diff -r e6b9b651bbce -r 6230420fef6d sql/mssql_tableanddata.php
--- a/sql/mssql_tableanddata.php	Sun Aug 16 17:55:44 2009 +0200
+++ b/sql/mssql_tableanddata.php	Mon Aug 24 09:42:00 2009 -0400
@@ -370,6 +370,8 @@
     [tid] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
     [topic] [varchar] (48) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
     [imageurl] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
+    [meta_description] [varchar] (5000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
+    [meta_keywords] [varchar] (5000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
     [sortnum] [smallint] NULL ,
     [limitnews] [smallint] NULL ,
     [is_default] [tinyint] NOT NULL ,
@@ -1413,8 +1415,8 @@
 
 $_SQL[] = "INSERT INTO {$_TABLES['syndication']} (type, topic, header_tid, format, limits, content_length, title, description, filename, charset, language, is_enabled, updated, update_info) VALUES ('article', '::all', 'all', 'RSS-2.0', 10, 1, 'Geeklog Site', 'Another Nifty Geeklog Site', 'geeklog.rss', 'iso-8859-1', 'en-gb', 1, getdate(), NULL)";
 
-$_SQL[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('General','General News','/images/topics/topic_news.gif',1,10,6,2,3,2,2,2)";
-$_SQL[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('Geeklog','Geeklog','/images/topics/topic_gl.gif',2,10,6,2,3,2,2,2)";
+$_SQL[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, meta_description, meta_keywords, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('General','General News','/images/topics/topic_news.gif','A topic that contains general news related posts.','News, Post, Information',1,10,6,2,3,2,2,2)";
+$_SQL[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, meta_description, meta_keywords, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('Geeklog','Geeklog','/images/topics/topic_gl.gif','A topic that contains posts about Geeklog.','Geeklog, Posts, Information',2,10,6,2,3,2,2,2)";
 
 $_SQL[] = "INSERT INTO {$_TABLES['usercomment']} (uid, commentmode, commentorder, commentlimit) VALUES (1,'nested','ASC',100)";
 $_SQL[] = "INSERT INTO {$_TABLES['usercomment']} (uid, commentmode, commentorder, commentlimit) VALUES (2,'threaded','ASC',100)";
diff -r e6b9b651bbce -r 6230420fef6d sql/mysql_tableanddata.php
--- a/sql/mysql_tableanddata.php	Sun Aug 16 17:55:44 2009 +0200
+++ b/sql/mysql_tableanddata.php	Mon Aug 24 09:42:00 2009 -0400
@@ -394,6 +394,8 @@
   tid varchar(20) NOT NULL default '',
   topic varchar(48) default NULL,
   imageurl varchar(255) default NULL,
+  meta_description TEXT NULL,
+  meta_keywords TEXT NULL,
   sortnum tinyint(3) default NULL,
   limitnews tinyint(3) default NULL,
   is_default tinyint(1) unsigned NOT NULL DEFAULT '0',
@@ -694,8 +696,8 @@
 
 $_DATA[] = "INSERT INTO {$_TABLES['syndication']} (type, topic, header_tid, format, limits, content_length, title, description, filename, charset, language, is_enabled, updated, update_info) VALUES ('article', '::all', 'all', 'RSS-2.0', 10, 1, 'Geeklog Site', 'Another Nifty Geeklog Site', 'geeklog.rss', 'iso-8859-1', 'en-gb', 1, '0000-00-00 00:00:00', NULL)";
 
-$_DATA[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('General','General News','/images/topics/topic_news.gif',1,10,6,2,3,2,2,2)";
-$_DATA[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('Geeklog','Geeklog','/images/topics/topic_gl.gif',2,10,6,2,3,2,2,2)";
+$_DATA[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, meta_description, meta_keywords, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('General','General News','/images/topics/topic_news.gif','A topic that contains general news related posts.','News, Post, Information',1,10,6,2,3,2,2,2)";
+$_DATA[] = "INSERT INTO {$_TABLES['topics']} (tid, topic, imageurl, meta_description, meta_keywords, sortnum, limitnews, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon) VALUES ('Geeklog','Geeklog','/images/topics/topic_gl.gif','A topic that contains posts about Geeklog.','Geeklog, Posts, Information',2,10,6,2,3,2,2,2)";
 
 $_DATA[] = "INSERT INTO {$_TABLES['usercomment']} (uid, commentmode, commentorder, commentlimit) VALUES (1,'nested','ASC',100) ";
 $_DATA[] = "INSERT INTO {$_TABLES['usercomment']} (uid, commentmode, commentorder, commentlimit) VALUES (2,'threaded','ASC',100) ";
diff -r e6b9b651bbce -r 6230420fef6d sql/updates/mssql_1.6.0_to_1.6.1.php
--- a/sql/updates/mssql_1.6.0_to_1.6.1.php	Sun Aug 16 17:55:44 2009 +0200
+++ b/sql/updates/mssql_1.6.0_to_1.6.1.php	Mon Aug 24 09:42:00 2009 -0400
@@ -1,7 +1,10 @@
 <?php
 
 // Add meta tag columns to story table 
-$_SQL[] = "ALTER TABLE {$_TABLES['stories']} ADD meta_description [varchar] (5000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL AFTER frontpage, ADD meta_keywords [meta_keywords] [varchar] (5000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL AFTER meta_description";
+$_SQL[] = "ALTER TABLE {$_TABLES['stories']} ADD [meta_description] [varchar] (5000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL AFTER frontpage, ADD [meta_keywords] [varchar] (5000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL AFTER meta_description";
+
+// Add meta tag columns to topics table 
+$_SQL[] = "ALTER TABLE {$_TABLES['topics']} ADD [meta_description] [varchar] (5000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL AFTER imageurl, ADD [meta_keywords] [varchar] (5000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL AFTER meta_description";
 
 /**
  * Add new config options
diff -r e6b9b651bbce -r 6230420fef6d sql/updates/mysql_1.6.0_to_1.6.1.php
--- a/sql/updates/mysql_1.6.0_to_1.6.1.php	Sun Aug 16 17:55:44 2009 +0200
+++ b/sql/updates/mysql_1.6.0_to_1.6.1.php	Mon Aug 24 09:42:00 2009 -0400
@@ -3,6 +3,10 @@
 // Add meta tag columns to story table 
 $_SQL[] = "ALTER TABLE {$_TABLES['stories']} ADD meta_description TEXT NULL AFTER frontpage, ADD meta_keywords TEXT NULL AFTER meta_description";
 
+
+// Add meta tag columns to topics table 
+$_SQL[] = "ALTER TABLE {$_TABLES['topics']} ADD meta_description TEXT NULL AFTER imageurl, ADD meta_keywords TEXT NULL AFTER meta_description";
+
 /**
  * Add new config options
  *



More information about the geeklog-cvs mailing list