Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

eznewsfeed/user/headlines.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: headlines.php 9590 2002-06-03 17:15:29Z fh $
5 //
6 // Created on: <16-Nov-2000 10:51:34 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 // this page requires the variable $CategoryID to be set
28
29 // this allows several newslistings on the same page:
30 if( !function_exists( 'printNewsHeaderList' ) )
31 {
32 function printNewsHeaderList( $CategoryID, $GenerateStaticPage, $cachedFile )
33 {
34 // include_once( "classes/INIFile.php" );
35 // include_once( "classes/eztemplate.php" );
36 // include_once( "classes/ezlocale.php" );
37
38 // include_once( "eznewsfeed/classes/eznews.php" );
39 // include_once( "eznewsfeed/classes/eznewscategory.php" );
40
41 // include_once( "classes/ezdatetime.php" );
42
43 $news = new eZNews( );
44
45 $ini = eZINI::instance( 'site.ini' );
46
47 $Language = $ini->variable( "eZNewsFeedMain", "Language" );
48 $ImageDir = $ini->variable( "eZNewsFeedMain", "ImageDir" );
49
50 $t = new eZTemplate( "kernel/eznewsfeed/user/" . $ini->variable( "eZNewsFeedMain", "TemplateDir" ),
51 "kernel/eznewsfeed/user/intl/", $Language, "headlines.php" );
52
53 $t->setAllStrings();
54
55 $t->set_file( array(
56 "headlines_page_tpl" => "headlines.tpl"
57 ) );
58
59 $t->set_block( "headlines_page_tpl", "head_line_item_tpl", "head_line_item" );
60
61 $t->set_var( "head_line_item", "" );
62
63 if ( $CategoryID != "" )
64 {
65 $category = new eZNewsCategory( $CategoryID );
66 $newsList =& $category->newsList( "time", "no", 0, 5 );
67 $t->set_var( "category_name", $category->name() ); }
68 else
69 {
70 print( "to" );
71 // $newsList =& $news->newsList();
72 }
73
74 $locale = new eZLocale();
75
76 foreach ( $newsList as $newsItem )
77 {
78 $t->set_var( "head_line", $newsItem->name() );
79 $t->set_var( "head_line_url", $newsItem->url() );
80
81 $t->set_var( "head_line_origin", $newsItem->origin() );
82
83 $published = $newsItem->originalPublishingDate();
84 $date =& $published->date();
85 $t->set_var( "head_line_date", $locale->format( $date ) );
86
87 $t->parse( "head_line_item", "head_line_item_tpl", true );
88 }
89
90 if ( $GenerateStaticPage == "true" )
91 {
92 $fp = eZPBFile::fopen( $cachedFile, "w+");
93
94 $output = $t->parse( "output", "headlines_page_tpl" );
95
96 // print the output the first time while printing the cache file.
97 print( $output );
98 fwrite ( $fp, $output );
99 fclose( $fp );
100 }
101 else
102 {
103 $t->pparse( "output", "headlines_page_tpl" );
104 }
105 }
106 }
107
108 $PageCaching = $ini->variable( "eZNewsFeedMain", "PageCaching" );
109 $cachedFile = "kernel/eznewsfeed/cache/headlines," . $CategoryID . ".cache";
110
111 if ( $PageCaching == "enabled" )
112 {
113 if ( file_exists( $cachedFile ) )
114 {
115 include( $cachedFile );
116 }
117 else
118 {
119 printNewsHeaderList( $CategoryID, "true", $cachedFile );
120 }
121 }
122 else
123 {
124 printNewsHeaderList( $CategoryID, "false", $cachedFile );
125 }
126
127 ?>
$ImageDir
$ImageDir
Definition: adedit.php:291
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$locale
$locale
Definition: admin/adlist.php:127
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$date
$date
Definition: bugpreview.php:66
eZLocale
Definition: ezlocale.php:119
eZNewsCategory
Definition: eznewscategory.php:42
eZNews
Definition: eznews.php:63
eZPBFile\fopen
static fopen( $filename, $options)
Definition: ezpbfile.php:326
eZTemplate
Definition: eztemplate.php:107
$t
foreach( $Modules as $module) if(isset( $ItemInsert)) $t
Definition: classes/admin/linklist.php:168
$Language
$Language
Definition: classes/admin/linklist.php:65
$ini
$ini
Definition: classes/admin/linklist.php:64
file_exists
static file_exists( $inifilename)
Definition: eZPBINIFile.php:195
$fp
$fp
Definition: export.php:97
$news
if( $Action=="Insert") if( $Action=="Update") if( $Action=="Delete") $news
Definition: eznewsfeed/admin/categoryedit.php:69
$PageCaching
if(!function_exists( 'printNewsHeaderList')) $PageCaching
Definition: eznewsfeed/user/headlines.php:108
$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+.