Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

smallarticlelist.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: smallarticlelist.php 8283 2001-11-05 16:44:16Z th $
5 //
6 // Created on: <18-Oct-2000 14:41:37 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( "classes/INIFile.php" );
28 // include_once( "classes/eztemplate.php" );
29 // include_once( "classes/ezlocale.php" );
30
31 // include_once( "ezarticle/classes/ezarticlecategory.php" );
32 // include_once( "ezarticle/classes/ezarticle.php" );
33 // include_once( "ezarticle/classes/ezarticlerenderer.php" );
34
35 $ini =& eZINI::instance( 'site.ini' );
36
37 $Language = $ini->variable( "eZArticleMain", "Language" );
38 $ImageDir = $ini->variable( "eZArticleMain", "ImageDir" );
39 $CapitalizeHeadlines = $ini->variable( "eZArticleMain", "CapitalizeHeadlines" );
40 $DefaultLinkText = $ini->variable( "eZArticleMain", "DefaultLinkText" );
41 $PageCaching = $ini->variable( "eZArticleMain", "PageCaching" );
42
43 unset( $menuCachedFile );
44 // do the caching
45 if ( $PageCaching == "enabled" )
46 {
47 $menuCachedFile = "kernel/ezarticle/cache/smallarticlelist,". $GlobalSiteDesign .".cache";
48
49 if ( file_exists( $menuCachedFile ) )
50 {
51 include( $menuCachedFile );
52 }
53 else
54 {
55 createSmallArticleList( true, $menuCachedFile, $ini, $Language, $GlobalSiteDesign, $GlobalSectionID, $CategoryID, $Offset, $Limit, $noItem, $DefaultLinkText );
56 }
57 }
58 else
59 {
60 createSmallArticleList(false, false, $ini, $Language, $GlobalSiteDesign, $GlobalSectionID, $CategoryID, $Offset, $Limit, $noItem, $DefaultLinkText );
61 }
62
63 function createSmallArticleList( $generateStaticPage = false, $menuCachedFile = false, $ini = null, $Language = null, $GlobalSiteDesign = null,
64 $GlobalSectionID = null, $CategoryID = null, $Offset = null, $Limit = null, $noItem = null, $DefaultLinkText = null )
65 {
66 // global $ini;
67 // global $menuCachedFile;
68 // global $noItem;
69 // global $GlobalSiteDesign;
70 // global $CategoryID;
71 // global $Offset;
72 // global $Limit;
73 // global $Language;
74 // global $DefaultLinkText;
75
76 $t = new eZTemplate( "kernel/ezarticle/user/" . $ini->variable( "eZArticleMain", "TemplateDir" ),
77 "kernel/ezarticle/user/intl/", $Language, "smallarticlelist.php" );
78
79 $t->setAllStrings();
80
81 $t->set_file( "article_list_page_tpl", "smallarticlelist.tpl" );
82
83 $t->set_block( "article_list_page_tpl", "article_list_tpl", "article_list" );
84 $t->set_block( "article_list_tpl", "article_item_tpl", "article_item" );
85 $t->set_block( "article_item_tpl", "read_more_tpl", "read_more_item" );
86
87 $category = new eZArticleCategory( $CategoryID );
88
89 $t->set_var( "current_category_name", $category->name() );
90 $t->set_var( "current_category_description", $category->description() );
91
92 $t->set_var( "sitedesign", $GlobalSiteDesign );
93
94 $articleList = $category->articles( $category->sortMode(), false, true, $Offset, $Limit );
95
96 $locale = new eZLocale( $Language );
97 $i = 0;
98 $t->set_var( "article_list", "" );
99 foreach ( $articleList as $article )
100 {
101 $nr = ( $i % 2 ) + 1;
102 $t->set_var( "alt_nr", $nr );
103
104 $t->set_var( "article_id", $article->id() );
105 $t->set_var( "article_name", $article->name() );
106
107 $renderer = new eZArticleRenderer( $article );
108
109 $published = $article->published();
110
111 $t->set_var( "article_published", $locale->format( $published ) );
112
113 $t->set_var( "category_id", $CategoryID );
114
115 $t->set_var( "article_intro", $renderer->renderIntro( ) );
116
117 $contents =& $renderer->renderPage();
118
119 if ( $article->linkText() != "" )
120 {
121 $t->set_var( "article_link_text", $article->linkText() );
122 $t->parse( "read_more_item", "read_more_tpl" );
123 }
124 else if ( !( trim( $contents[1] ) == "" && count( $article->attributes( false ) ) <= 0 ))
125 {
126 $t->set_var( "article_link_text", $DefaultLinkText );
127 $t->parse( "read_more_item", "read_more_tpl" );
128 }
129 else
130 {
131 $t->set_var( "article_link_text", "" );
132 $t->set_var( "read_more_item", "" );
133 }
134
135 $t->parse( "article_item", "article_item_tpl", true );
136 $i++;
137 }
138
139 if ( count( $articleList ) > 0 )
140 $t->parse( "article_list", "article_list_tpl" );
141 else
142 $t->set_var( "article_list", "" );
143
144
145 if ( $generateStaticPage )
146 {
147 $fp = eZPBFile::fopen( $menuCachedFile, "w+");
148
149 $output = $t->parse( "output", "article_list_page_tpl" );
150 // print the output the first time while printing the cache file.
151
152 print( $output );
153 fwrite ( $fp, $output );
154 fclose( $fp );
155 }
156 else
157 {
158 $t->pparse( "output", "article_list_page_tpl" );
159 }
160 }
161
162 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$locale
$locale
Definition: admin/adlist.php:127
$i
$i
Definition: admin/adlist.php:91
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$article
$article
Definition: articlelog.php:45
$renderer
if(! $article->get( $ArticleID)) $renderer
Definition: articlepreview.php:76
eZArticleCategory
Definition: ezarticlecategory.php:45
eZArticleRenderer
Definition: ezarticlerenderer.php:36
eZLocale
Definition: ezlocale.php:119
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
file_exists
static file_exists( $inifilename)
Definition: eZPBINIFile.php:195
$fp
$fp
Definition: export.php:97
$GlobalSectionID
$GlobalSectionID
Definition: ezad/user/datasupplier.php:28
$Limit
$Limit
Definition: ezarticle/admin/categorylist.php:66
$contents
$contents
Definition: ezarticle/user/extendedsearch.php:52
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$output
$output
Definition: formpreview.php:81
$GlobalSiteDesign
global $GlobalSiteDesign
Definition: latestmessages.php:52
$articleList
$articleList
Definition: pendinglist.php:112
createSmallArticleList
createSmallArticleList( $generateStaticPage=false, $menuCachedFile=false, $ini=null, $Language=null, $GlobalSiteDesign=null, $GlobalSectionID=null, $CategoryID=null, $Offset=null, $Limit=null, $noItem=null, $DefaultLinkText=null)
Definition: smallarticlelist.php:63
$ImageDir
$ImageDir
Definition: smallarticlelist.php:38
$Language
$Language
Definition: smallarticlelist.php:37
$ini
$ini
Definition: smallarticlelist.php:35
$DefaultLinkText
$DefaultLinkText
Definition: smallarticlelist.php:40
$CapitalizeHeadlines
$CapitalizeHeadlines
Definition: smallarticlelist.php:39
$PageCaching
$PageCaching
Definition: smallarticlelist.php:41
$noItem
$noItem
Definition: user/pollist.php:36
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.