Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

newssearch.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: newssearch.php 8504 2001-11-19 09:46:46Z jhe $
5 //
6 // Created on: <13-Dec-2000 10:57:59 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
34 $ini = eZINI::instance( 'site.ini' );
35
36 $Language = $ini->variable( "eZNewsFeedMain", "Language" );
37
38 $t = new eZTemplate( "kernel/eznewsfeed/admin/" . $ini->variable( "eZNewsFeedMain", "TemplateDir" ),
39 "kernel/eznewsfeed/admin/intl/", $Language, "newssearch.php" );
40
41 $t->setAllStrings();
42
43 $t->set_file( array(
44 "news_search_page_tpl" => "newssearch.tpl"
45 ) );
46
47 // news
48 $t->set_block( "news_search_page_tpl", "news_list_tpl", "news_list" );
49 $t->set_block( "news_list_tpl", "news_item_tpl", "news_item" );
50
51
52 $t->set_block( "news_search_page_tpl", "previous_tpl", "previous" );
53 $t->set_block( "news_search_page_tpl", "next_tpl", "next" );
54
55 $news = new eZNews();
56
57 if ( !isset( $Limit ) )
58 $Limit = 20;
59 if ( !isset( $Offset ) )
60 $Offset = 0;
61
62 if ( isset( $URLQueryString ) )
63 {
64 $SearchText = urldecode( $URLQueryString );
65 }
66
67 // fetch the n next news items
68 $newsList =& $news->search( $SearchText, true, $Offset, $Limit );
69 $newsListCount =& $news->searchCount( $SearchText, true );
70
71
72 $locale = new eZLocale( $Language );
73 $i=0;
74 $t->set_var( "news_list", "" );
75
76
77 foreach ( $newsList as $news )
78 {
79 if ( ( $i % 2 ) == 0 )
80 {
81 $t->set_var( "starttr", "<tr>" );
82 $t->set_var( "endtr", "" );
83 }
84 else
85 {
86 $t->set_var( "starttr", "" );
87 $t->set_var( "endtr", "</tr>" );
88 }
89
90
91 $t->set_var( "news_name", $news->name() );
92
93 $t->set_var( "news_intro", $news->intro() );
94 $t->set_var( "news_url", $news->url() );
95 $t->set_var( "news_origin", $news->origin() );
96
97 $published = $news->originalPublishingDate();
98
99 $t->set_var( "news_date", $locale->format( $published ) );
100
101
102 $t->set_var( "news_id", $news->id() );
103
104 $t->parse( "news_item", "news_item_tpl", true );
105 $i++;
106 }
107
108 if ( count( $newsList ) > 0 )
109 $t->parse( "news_list", "news_list_tpl" );
110 else
111 $t->set_var( "news_list", "" );
112
113
114 $prevOffs = $Offset - $Limit;
115 $nextOffs = $Offset + $Limit;
116
117 if ( $prevOffs >= 0 )
118 {
119 $t->set_var( "prev_offset", $prevOffs );
120 $t->parse( "previous", "previous_tpl" );
121 }
122 else
123 {
124 $t->set_var( "previous", "" );
125 }
126
127 if ( $nextOffs <= $newsListCount )
128 {
129 $t->set_var( "next_offset", $nextOffs );
130 $t->parse( "next", "next_tpl" );
131 }
132 else
133 {
134 $t->set_var( "next", "" );
135 }
136
137 $t->set_var( "url_query_string", urlencode( $SearchText ) );
138
139 $t->pparse( "output", "news_search_page_tpl" );
140
141 ?>
eZLocale
Definition: ezlocale.php:119
eZNews
Definition: eznews.php:63
eZTemplate
Definition: eztemplate.php:107
$SearchText
$SearchText
Definition: ezaddress/admin/typelist.php:143
$Limit
$Limit
Definition: ezarticle/admin/categorylist.php:66
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$locale
$locale
Definition: newssearch.php:72
$t
$t
Definition: newssearch.php:38
$nextOffs
$nextOffs
Definition: newssearch.php:115
$newsListCount
$newsListCount
Definition: newssearch.php:69
$news
$news
Definition: newssearch.php:55
$newsList
if(isset( $URLQueryString)) $newsList
Definition: newssearch.php:68
$prevOffs
$prevOffs
Definition: newssearch.php:114
$i
$i
Definition: newssearch.php:73
$Language
$Language
Definition: newssearch.php:36
$ini
$ini
Definition: newssearch.php:34
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.