[geeklog-hg] geeklog: Added topicrelated.thtml template file so related topic...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Wed Jan 8 21:03:02 EST 2014


changeset 9402:d95ee4274ef3
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/d95ee4274ef3
user: Tom <websitemaster at cogeco.net>
date: Sat Jan 04 17:29:10 2014 -0500
description:
Added topicrelated.thtml template file so related topics of articles can be customized easier.

diffstat:

 public_html/docs/english/theme.html                    |   1 +
 public_html/layout/denim/topicrelated.thtml            |  12 +++++++++
 public_html/layout/modern_curve/topicrelated.thtml     |  12 +++++++++
 public_html/layout/professional/topicrelated.thtml     |  12 +++++++++
 public_html/layout/professional_css/topicrelated.thtml |  12 +++++++++
 system/lib-topic.php                                   |  23 ++++++++++++++---
 6 files changed, 68 insertions(+), 4 deletions(-)

diffs (113 lines):

diff -r 2ac353bc34aa -r d95ee4274ef3 public_html/docs/english/theme.html
--- a/public_html/docs/english/theme.html	Sat Jan 04 10:39:33 2014 -0500
+++ b/public_html/docs/english/theme.html	Sat Jan 04 17:29:10 2014 -0500
@@ -204,6 +204,7 @@
 
 <ul>
 <li>Added the template variable {related_topics} to <tt>featuredstorytext.thtml</tt> and <tt>storytext.thtml</tt></li>li>
+<li>Added <tt>topicrelated.thtml</tt> which displays related topics for articles.</li>
 <li>Removed <tt>topicoption.thtml</tt> and <tt>topicoption_off.thtml</tt>.
     Added <tt>topicnavigation.thtml</tt> which uses blocks to reduce the number of template files.</li>
 <li>Renamed <tt>page_navigation.thtml</tt> to <tt>pagenavigation.thtml</tt>
diff -r 2ac353bc34aa -r d95ee4274ef3 public_html/layout/denim/topicrelated.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/denim/topicrelated.thtml	Sat Jan 04 17:29:10 2014 -0500
@@ -0,0 +1,12 @@
+{# begin {templatelocation} - Related Topics uses template blocks which is built into this file #}
+
+<div class="related-topics">{lang_filed_under} {topics}</div>
+
+{# end {templatelocation} #}
+
+<!-- BEGIN topicitem -->
+<a href="{topic_url}">{topic}</a>
+<!-- END topicitem -->
+<!-- BEGIN separator -->
+&nbsp
+<!-- END separator -->
diff -r 2ac353bc34aa -r d95ee4274ef3 public_html/layout/modern_curve/topicrelated.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/modern_curve/topicrelated.thtml	Sat Jan 04 17:29:10 2014 -0500
@@ -0,0 +1,12 @@
+{# begin {templatelocation} - Related Topics uses template blocks which is built into this file #}
+
+<div class="related-topics">{lang_filed_under} {topics}</div>
+
+{# end {templatelocation} #}
+
+<!-- BEGIN topicitem -->
+<a href="{topic_url}">{topic}</a>
+<!-- END topicitem -->
+<!-- BEGIN separator -->
+&nbsp
+<!-- END separator -->
diff -r 2ac353bc34aa -r d95ee4274ef3 public_html/layout/professional/topicrelated.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/professional/topicrelated.thtml	Sat Jan 04 17:29:10 2014 -0500
@@ -0,0 +1,12 @@
+{# begin {templatelocation} - Related Topics uses template blocks which is built into this file #}
+
+<div class="related-topics">{lang_filed_under} {topics}</div>
+
+{# end {templatelocation} #}
+
+<!-- BEGIN topicitem -->
+<a href="{topic_url}">{topic}</a>
+<!-- END topicitem -->
+<!-- BEGIN separator -->
+&nbsp
+<!-- END separator -->
diff -r 2ac353bc34aa -r d95ee4274ef3 public_html/layout/professional_css/topicrelated.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/professional_css/topicrelated.thtml	Sat Jan 04 17:29:10 2014 -0500
@@ -0,0 +1,12 @@
+{# begin {templatelocation} - Related Topics uses template blocks which is built into this file #}
+
+<div class="related-topics">{lang_filed_under} {topics}</div>
+
+{# end {templatelocation} #}
+
+<!-- BEGIN topicitem -->
+<a href="{topic_url}">{topic}</a>
+<!-- END topicitem -->
+<!-- BEGIN separator -->
+&nbsp
+<!-- END separator -->
diff -r 2ac353bc34aa -r d95ee4274ef3 system/lib-topic.php
--- a/system/lib-topic.php	Sat Jan 04 10:39:33 2014 -0500
+++ b/system/lib-topic.php	Sat Jan 04 17:29:10 2014 -0500
@@ -1505,15 +1505,30 @@
     $result = DB_query($sql);
     $nrows = DB_numRows($result);
     if ($nrows > 0) {
-        $retval = '<div class="related-topics">' . $LANG27['filed_under:'];
+        $topicrelated = COM_newTemplate($_CONF['path_layout']);
+        $topicrelated->set_file( array(
+            'topicrelated' => 'topicrelated.thtml'
+            ));
+        $blocks = array('topic', 'separator');
+        foreach ($blocks as $block) {
+            $topicrelated->set_block('menunavigation', $block);
+        }             
+        
+        $topicrelated->set_var('lang_filed_under', $LANG27['filed_under:']);
         for ($i = 0; $i < $nrows; $i++) {
             $A = DB_fetchArray($result);
-            $url = $_CONF['site_url'] . '/index.php?topic=' . $A['tid'];            
+            $url = $_CONF['site_url'] . '/index.php?topic=' . $A['tid'];
             
-            $retval .= ' <a href="' . $url . '">' . $A['topic'] . '</a>';
+            $topicrelated->set_var('topic_url', $url);
+            $topicrelated->set_var('topic', $A['topic']);            
+            
+            $topicrelated->parse('topics', 'topicitem', true);
+            if (($i+1) < $nrows) {
+                $topicrelated->parse('topics', 'separator', true);
+            }
         }
         
-        $retval .= '</div>';
+        $retval = $topicrelated->finish($topicrelated->parse('topicrelated', 'topicrelated'));
     }    
 
     return $retval;



More information about the geeklog-cvs mailing list