Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

allcategories.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: allcategories.php 8504 2001-11-19 09:46:46Z jhe $
5 //
6 // Created on: <02-Jan-2001 12:43:05 bf>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "eznewsfeed/classes/eznews.php" );
28 // include_once( "eznewsfeed/classes/eznewscategory.php" );
29 // include_once( "eznewsfeed/classes/eznewsimporter.php" );
30
31 // include_once( "classes/ezdatetime.php" );
32 // include_once( "classes/ezlocale.php" );
33 // include_once( "classes/eztemplate.php" );
34
35 $ini = eZINI::instance( 'site.ini' );
36
37 $Language = $ini->variable( "eZNewsFeedMain", "Language" );
38
39 $t = new eZTemplate( "kernel/eznewsfeed/user/" . $ini->variable( "eZNewsFeedMain", "TemplateDir" ),
40 "kernel/eznewsfeed/user/intl/", $Language, "allcategories.php" );
41
42 $t->setAllStrings();
43
44 $t->set_file( array(
45 "news_archive_page_tpl" => "allcategories.tpl"
46 ) );
47
48 // news
49 $t->set_block( "news_archive_page_tpl", "news_list_tpl", "news_list" );
50 $t->set_block( "news_list_tpl", "news_item_tpl", "news_item" );
51
52 $t->set_var( "news_list", "" );
53
54 $category = new eZNewsCategory( );
55
56 $categories = $category->getAll();
57
58
59 $numCols = 2;
60 foreach ( $categories as $category )
61 {
62 $t->set_var( "category_name", $category->name() );
63 $t->set_var( "category_id", $category->id() );
64 $t->set_var( "num_cols", $numCols );
65
66
67 // fetch the n next news items
68 $newsList =& $category->newsList( "time", "no", 0, 10 );
69
70 $locale = new eZLocale( $Language );
71
72 $t->set_var( "news_item", "" );
73 $i=0;
74 foreach ( $newsList as $news )
75 {
76 if ( ( $i % $numCols ) == 0 )
77 {
78 $t->set_var( "starttr", "<tr>" );
79 $t->set_var( "endtr", "" );
80 }
81 else
82 {
83 $t->set_var( "starttr", "" );
84 $t->set_var( "endtr", "</tr>" );
85 }
86
87
88 $t->set_var( "news_name", $news->name() );
89
90 $t->set_var( "news_intro", $news->intro() );
91 $t->set_var( "news_url", $news->url() );
92 $t->set_var( "news_origin", $news->origin() );
93
94 $published = $news->originalPublishingDate();
95
96 $t->set_var( "news_date", $locale->format( $published ) );
97
98
99 $t->set_var( "news_id", $news->id() );
100
101 $t->parse( "news_item", "news_item_tpl", true );
102 $i++;
103 }
104
105 $t->parse( "news_list", "news_list_tpl", true );
106 }
107
108 if ( $GenerateStaticPage == "true" )
109 {
110 $fp = eZPBFile::fopen( $cachedFile, "w+");
111
112 $output = $t->parse( "output", "news_archive_page_tpl" );
113
114 // print the output the first time while printing the cache file.
115 print( $output );
116 fwrite ( $fp, $output );
117 fclose( $fp );
118 }
119 else
120 {
121 $t->pparse( "output", "news_archive_page_tpl" );
122 }
123
124 ?>
$locale
$locale
Definition: admin/adlist.php:127
$i
$i
Definition: admin/adlist.php:91
$category
$category
Definition: allcategories.php:54
$t
$t
Definition: allcategories.php:39
$numCols
$numCols
Definition: allcategories.php:59
$Language
$Language
Definition: allcategories.php:37
$ini
$ini
Definition: allcategories.php:35
$categories
$categories
Definition: allcategories.php:56
eZLocale
Definition: ezlocale.php:119
eZNewsCategory
Definition: eznewscategory.php:42
eZPBFile\fopen
static fopen( $filename, $options)
Definition: ezpbfile.php:326
eZTemplate
Definition: eztemplate.php:107
$fp
$fp
Definition: export.php:97
$news
if( $Action=="Insert") if( $Action=="Update") if( $Action=="Delete") $news
Definition: eznewsfeed/admin/categoryedit.php:69
$cachedFile
$cachedFile
Definition: eznewsfeed/user/headlines.php:109
$output
$output
Definition: formpreview.php:81
$newsList
if(isset( $URLQueryString)) $newsList
Definition: newssearch.php:68
$GenerateStaticPage
$GenerateStaticPage
Definition: quizscores.php:95
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.