Update of /cvsroot/php-blog/serendipity/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4758/include
Modified Files:
Tag: branch-smarty
genpage.inc.php
Log Message:
- Embed smarty_layout.php into genpage, to avoid future BC problems
Index: genpage.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/Attic/genpage.inc.php,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- genpage.inc.php 6 Nov 2004 11:22:49 -0000 1.1.2.1
+++ genpage.inc.php 12 Nov 2004 16:27:44 -0000 1.1.2.2
@@ -20,9 +20,47 @@
);
if ($serendipity['smarty_raw_mode']) {
+ /* For BC reasons, we have to ask for layout.php */
include_once(serendipity_getTemplateFile('layout.php', 'serendipityPath'));
} else {
- include_once(serendipity_getTemplateFile('smarty_layout.php', 'serendipityPath'));
+ switch ($serendipity['GET']['action']) {
+ // User wants to read the diary
+ case 'read':
+ if (isset($serendipity['GET']['id'])) {
+ serendipity_printEntries(array(serendipity_fetchEntry('id', $serendipity['GET']['id'])), 1);
+ } else {
+ serendipity_printEntries(serendipity_fetchEntries($serendipity['range'], true, 15));
+ }
+ break;
+
+ // User searches
+ case 'search':
+ $r = serendipity_searchEntries($serendipity['GET']['searchTerm']);
+ if (strlen($serendipity['GET']['searchTerm']) <= 3) {
+ $serendipity['smarty']->assign('content_message', SEARCH_TOO_SHORT);
+ break;
+ }
+
+ if ($r === true) {
+ $serendipity['smarty']->assign('content_message', sprintf(NO_ENTRIES_BLAHBLAH, $serendipity['GET']['searchTerm']));
+ break;
+ }
+
+ $serendipity['smarty']->assign('content_message', sprintf(YOUR_SEARCH_RETURNED_BLAHBLAH, $serendipity['GET']['searchTerm'], count($r)));
+ serendipity_printEntries($r);
+ break;
+
+ // Show the archive
+ case 'archives':
+ serendipity_printArchives();
+ break;
+
+ // Welcome screen or whatever
+ default:
+ serendipity_printEntries(serendipity_fetchEntries(null, true, 15));
+ break;
+ }
+
serendipity_smarty_fetch('CONTENT', 'content.tpl');
}
|