Annonces
Question aléatoire
Livre d'or

Par ReidLos

@ "Visiteur" : Sign in and post your question on the forum in English preferably please.

@VB_Godfather : Merci de ton soutien

Concernant la tra [Suite...]

Livre d'or

Mini sondage
Disposez-vous de PHP 5 chez votre hébergeur ?








Résultats

 
   Le 13/01/12 à 00h45 Citer      

Booster Minigun

Groupe: Membre

Sexe:
Inscrit le: 09/01/12
Messages: 37
Lieu: Je me cherche e...
Reprise du message précédent

si
par exemple dans le fichier php tu met ça
Code PHP :
'VARIABLE' => 'Je suis une variable',

en ne pas oubliant de parser le tout avec un
Code PHP :
$tpl_news->parse();


et dans ton fichier tpl un jolie {VARIABLE} fera l'affaire :)

pm http://www.micro-making.fr    
   Le 13/01/12 à 01h40 Citer      

Booster Minigun

Groupe: Membre

Inscrit le: 05/01/12
Messages: 35
bon voilà j'ai mis sa à la fin de news.php
Code PHP :
 
$tpl_news->Assign_vars(array(
	'THEME_MOBILE' => 'mobile',
));
 
$tpl_news->parse();
 


dans news.tpl
Code TPL :
 
<li>{THEME_MOBILE}</li>
 


j'ai vidé le cache, mais toujours rien :/

pm    
   Le 13/01/12 à 10h30 Citer      

Administrateur

Chef de projet
Développement Noyau

Sexe:
Inscrit le: 27/02/09
Messages: 7984
Lieu: Alsace
Donne nous les fichiers modifiés avec les numéros de ligne c'est plus simple :)

pm http://www.phpboost.com    
   Le 14/01/12 à 13h04 Citer      

Booster Minigun

Groupe: Membre

Inscrit le: 05/01/12
Messages: 35
salut à tous
à la ligne 64 du fichier /news/news.php
Code PHP :
 
$tpl_news->Assign_vars(array(
	'GEO_AUTHOR' => 'geolocalisation',
));
 
$tpl_news->parse();
 


j'aimerais pouvoir mettre la variable {GEO_AUTHOR} n'importe où dans /template/MONTHEME/news.tpl
Code TPL :
 
{GEO_AUTHOR}
 


mais toujours pas de variable affichée.

voilà



Edité par BeHuman Le 14/01/12 à 13h04

pm    
   Le 14/01/12 à 13h14 Citer      

Booster Minigun

Groupe: Membre

Sexe:
Inscrit le: 09/01/12
Messages: 37
Lieu: Je me cherche e...
C'est pas normal ça... Poste nous les fichier complet s'il te plait :)

pm http://www.micro-making.fr    
   Le 14/01/12 à 13h45 Citer      

Booster Minigun

Groupe: Membre

Inscrit le: 05/01/12
Messages: 35
bon voilà le pour news.php:
Code PHP :
 
<?php
/*##################################################
 *                                news.php
 *                            -------------------
 *   begin              : June 20, 2005
 *   copyright          : (C) 2005 Viarre Régis
 *   email              : crowkait@phpboost.com
 *
 *
 ###################################################
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
###################################################*/
 
require_once('../kernel/begin.php');
require_once('../news/news_begin.php');
require_once('../kernel/header.php');
 
//$idnews, $idcat, $show_archive définies dans news_begin.php
 
$is_admin = $User->check_level(ADMIN_LEVEL);
if (empty($idnews) && empty($idcat)) // Accueil du module de news
{
	import('modules/modules_discovery_service');
	$modulesLoader = new ModulesDiscoveryService();
	$module_name = 'news';
	$module = $modulesLoader->get_module($module_name);
	if ($module->has_functionality('get_home_page')) {
		echo $module->functionality('get_home_page');
		require_once('../kernel/footer.php');
		exit;
	} elseif (!$no_alert_on_error) {
		global $Errorh;	
		$Errorh->handler('Le module <strong>' . $module_name . '</strong> n\'a pas de fonction get_home_page!', E_USER_ERROR, __LINE__, __FILE__);
		exit;
	}
}
elseif (!empty($idnews)) //On affiche la news correspondant à l'id envoyé.
{
	if (empty($news['id']))
		$Errorh->handler('e_unexist_news', E_USER_REDIRECT);
 
	import('content/comments');
	import('content/syndication/feed');
 
	$tpl_news = new Template('news/news.tpl');
 
	$next_news = $Sql->query_array(PREFIX . "news", "title", "id", "WHERE visible = 1 AND id > '" . $idnews . "' " . $Sql->limit(0, 1), __LINE__, __FILE__);
	$previous_news = $Sql->query_array(PREFIX . "news", "title", "id", "WHERE visible = 1 AND id < '" . $idnews . "' ORDER BY id DESC " . $Sql->limit(0, 1), __LINE__, __FILE__);
 
	$tpl_news->assign_vars(array(
		'GEO_AUTHOR' => 'geolocalisation',
	));
	$tpl_news->parse();
 
	$tpl_news->assign_vars(array(
		'C_IS_ADMIN' => $is_admin,
		'C_NEWS_BLOCK' => true,
		'C_NEWS_NAVIGATION_LINKS' => true,
		'C_PREVIOUS_NEWS' => !empty($previous_news['id']),
		'C_NEXT_NEWS' =>!empty($next_news['id']),
		'TOKEN' => $Session->get_token(),
		'PREVIOUS_NEWS' => $previous_news['title'],
		'NEXT_NEWS' => $next_news['title'],
		'U_PREVIOUS_NEWS' => url('.php?id=' . $previous_news['id'], '-0-' . $previous_news['id'] . '+' . url_encode_rewrite($previous_news['title']) . '.php'),
		'U_NEXT_NEWS' => url('.php?id=' . $next_news['id'], '-0-' . $next_news['id'] . '+' . url_encode_rewrite($next_news['title']) . '.php'),
		'L_SYNDICATION' => $LANG['syndication'],
		'L_ALERT_DELETE_NEWS' => $LANG['alert_delete_news'],
		'L_ON' => $LANG['on'],
		'L_DELETE' => $LANG['delete'],
		'L_EDIT' => $LANG['edit'],
	));
 
$tpl_news->parse();
	$tpl_news->assign_block_vars('news', array(
		'C_IMG' => !empty($news['img']),
		'C_ICON' => (!empty($news['icon']) && $CONFIG_NEWS['activ_icon'] == 1),
		'ID' => $news['id'],
		'IDCAT' => $news['idcat'],
		'ICON' => second_parse_url($news['icon']),
		'TITLE' => $news['title'],
		'CONTENTS' => second_parse($news['contents']),
		'EXTEND_CONTENTS' => second_parse($news['extend_contents']) . '<br /><br />',
		'IMG' => second_parse_url($news['img']),
		'IMG_DESC' => $news['alt'],
		'PSEUDO' => $CONFIG_NEWS['display_author'] ? $news['login'] : '',				
		'DATE' => $CONFIG_NEWS['display_date'] ? $LANG['on'] . ': ' . gmdate_format('date_format_short', $news['timestamp']) : '',
		'U_COM' => ($CONFIG_NEWS['activ_com'] == 1) ? Comments::com_display_link($news['nbr_com'], '../news/news' . url('.php?cat=0&amp;id=' . $idnews . '&amp;com=0', '-0-' . $idnews . '+' . url_encode_rewrite($news['title']) . '.php?com=0'), $idnews, 'news') : '',
		'U_USER_ID' => url('.php?id=' . $news['user_id'], '-' . $news['user_id'] . '.php'),
		'U_NEWS_LINK' => url('.php?id=' . $news['id'], '-0-' . $news['id'] . '+' . url_encode_rewrite($news['title']) . '.php'),
	    'FEED_MENU' => Feed::get_feed_menu(FEED_URL)
	));	
}
elseif (!empty($idcat))
{
	$tpl_news = new Template('news/news_cat.tpl');
 
	$cat = $Sql->query_array(PREFIX . 'news_cat', 'id', 'name', 'icon', "WHERE id = '" . $idcat . "'", __LINE__, __FILE__);
	if (empty($cat['id']))
		$Errorh->handler('error_unexist_cat', E_USER_REDIRECT);
 
	$tpl_news->assign_vars(array(
		'C_IS_ADMIN' => $is_admin,
		'C_NEWS_LINK' => true,
		'CAT_NAME' => $cat['name'],
		'IDCAT' => $cat['id'],
		'L_EDIT' => $LANG['edit'],
		'L_CATEGORY' => $LANG['category']
	));
 
	$result = $Sql->query_while("SELECT n.id, n.title, n.nbr_com, nc.id AS idcat, nc.icon
	FROM " . PREFIX . "news n
	LEFT JOIN " . PREFIX . "news_cat nc ON nc.id = n.idcat
	WHERE n.visible = 1 AND n.idcat = '" . $idcat . "'
	ORDER BY n.timestamp DESC", __LINE__, __FILE__);
	while ($row = $Sql->fetch_assoc($result))
	{ 
		$tpl_news->assign_block_vars('list', array(
			'ICON' => ((!empty($row['icon']) && $CONFIG_NEWS['activ_icon'] == 1) ? '<a href="news' . url('.php?cat=' . $row['idcat'], '-' . $row['idcat'] . '.php') . '"><img class="valign_middle" src="' . $row['icon'] . '" alt="" /></a>' : ''),
			'TITLE' => $row['title'],
			'COM' => $row['nbr_com'],
			'U_NEWS' => 'news' . url('.php?id=' . $row['id'], '-0-' . $row['id'] . '+'  . url_encode_rewrite($row['title']) . '.php')
		));
	}
}
 
//Affichage commentaires.
if (isset($_GET['com']) && $idnews > 0)
{
	$tpl_news->assign_vars(array(
		'COMMENTS' => display_comments('news', $idnews, url('news.php?id=' . $idnews . '&amp;com=%s', 'news-0-' . $idnews . '.php?com=%s'))
	));
}
$tpl_news->parse();
 
require_once('../kernel/footer.php');
 
?>
 

j'ai placer l'attribution de la variable GEO_AUTHOR à la ligne 64:
Code PHP :
 
        $tpl_news->assign_vars(array(
		'GEO_AUTHOR' => 'geolocalisation',
	));
	$tpl_news->parse();
 



et voilà pour news.tpl:
Code TPL :
 
        <script type="text/javascript">
        <!--
        function Confirm() {
            return confirm("{L_ALERT_DELETE_NEWS}");
        }
        -->
        </script>
 
        # IF C_NEWS_EDITO #
        <div class="news_container_ed">
            <div class="news_top_l_ed"></div>
            <div class="news_top_r_ed"></div>
            <div class="news_top_ed">
                <div class="titred" >{TITLE}<span># IF C_IS_ADMIN # <a href="../news/admin_news_config.php" title="{L_EDIT}"><img src="{PATH_TO_ROOT}/templates/{THEME}/images/admin/ed.png" class="valign_middle" alt="{L_EDIT}" /></a> # ENDIF #</span></div>
 
            </div>
            <div class="news_content_ed">
                &nbsp;&nbsp;{CONTENTS}
            </div>
            <div class="news_bottom_l_ed"></div>
            <div class="news_bottom_r_ed"></div>
            <div class="news_bottom_ed"></div>
        </div>
        <!--###### JAVASCRIIPT SLIDESHOW ######-->
        <script type="text/javascript">
            var content = document.getElementById("CSlideShow3_content");
            var tc01 = document.getElementById("CSlideShow3_tc01");
            var tc02 = document.getElementById("CSlideShow3_tc02");
            var tc03 = document.getElementById("CSlideShow3_tc03");
            var tt01 = document.getElementById("CSlideShow3_tt01");
            var tt02 = document.getElementById("CSlideShow3_tt02");
            var tt03 = document.getElementById("CSlideShow3_tt03");
            var img01 = document.getElementById("CSlideShow3_img01");
            var img02 = document.getElementById("CSlideShow3_img02");
            var img03 = document.getElementById("CSlideShow3_img03");
            var limg01 = document.getElementById("CSlideShow3_list_img01");
            var limg02 = document.getElementById("CSlideShow3_list_img02");
            var limg03 = document.getElementById("CSlideShow3_list_img03");
            var loop=1;
            setTimeout("CSlideShow3_Slide(loop)", 1);
        </script>
        <!--###### JAVASCRIIPT SLIDESHOW ######-->
        # ENDIF #
 
 
 
        # IF C_NEWS_NO_AVAILABLE #
        <div class="news_container">
            <div class="news_top_l"></div>
            <div class="news_top_r"></div>
            <div class="news_top">
                <div style="float:left;padding-left:30px;"><a href="../syndication.php?m=news" title="Syndication"><img class="valign_middle" src="../templates/{THEME}/images/rss.png" alt="Syndication" title="Syndication" /></a></div>
                <div style="float:right;"><h3 class="title valign_middle">{L_LAST_NEWS}</h3></div>
            </div>  
            <div class="news_content">
                <p class="text_strong text_center">{L_NO_NEWS_AVAILABLE}</p>
            </div>
            <div class="news_bottom_l"></div>
            <div class="news_bottom_r"></div>
            <div class="news_bottom"></div>
        </div>
        # ENDIF #
 
 
 
        # IF C_NEWS_BLOCK #
 
        # START news #        
        # IF news.C_NEWS_ROW # <div class="spacer"></div> # ENDIF #
		# IF C_NEWS_BLOCK_COLUMN # 
        <div class="news_container" style="float:left;width:45%">
		# ELSE #
        <div class="news_container">
		# ENDIF #
            <div class="news_top_l"></div>
            <div class="news_top_r"></div>
            <div class="news_top">
                <span style="float:left;padding-left:5px;">
 
                    <a class="news_title" href="../news/news{news.U_NEWS_LINK}">{news.TITLE}</a> 
                </span>
 
 
            </div>
            <div class="news_content">
 
			<div class="datee">
<!--			<span style="float:left"  ><a style="padding-left:7px;" class="small_link" href="../member/member{news.U_USER_ID}"><img src="{PATH_TO_ROOT}/templates/{THEME}/images/admin/members_mini.png" alt="" class="valign_middle" />{news.PSEUDO} {news.DATE}</a>-->
<!--			</span>-->
            <span style="float:left"  ><a style="padding-left:7px;" class="small_link" href="../news/news{news.U_NEWS_LINK}">{news.DATE}</a>
			</span>
			<span style="float:right"  >
			# IF C_IS_ADMIN #
					<a href="../news/admin_news.php?id={news.ID}" title="{L_EDIT}"><img class="valign_middle" src="{PATH_TO_ROOT}/templates/{THEME}/images/admin/ed.png" alt="{L_EDIT}" /></a>
					<a href="../news/admin_news.php?delete=1&amp;id={news.ID}&amp;token={TOKEN}" title="{L_DELETE}" onclick="javascript:return Confirm();"><img class="valign_middle" src="{PATH_TO_ROOT}/templates/{THEME}/images/admin/del.png" alt="{L_DELETE}" /></a>
					# ENDIF #
			<span style="background:#ececec;border:1px solid #dddddd ; padding: 3px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;"><img src="{PATH_TO_ROOT}/templates/{THEME}/images/admin/comm.png" alt="" class="valign_middle" /> {news.U_COM}</span> &nbsp;&nbsp;
<!--			<a href="../syndication.php?m=news" title="Rss"><img class="valign_middle" src="{PATH_TO_ROOT}/templates/{THEME}/images/admin/rrs.png" alt="Rss" title="Rss" /></a>-->
			</span>
			</div>
			<div class="spacer"></div>
                # IF news.IMG # <img src="{news.IMG}" alt="{news.IMG_DESC}" title="{news.IMG_DESC}" class="img_right" /> # ENDIF # 
				# IF news.C_ICON # <a href="news.php?cat={news.IDCAT}"><img class="valign_middle" src="{news.ICON}" alt="" /></a> # ENDIF # 
 
				{news.CONTENTS}
                <br />
              {news.EXTEND_CONTENTS}
				<div class="spacer"></div>
                <!-- SOCIAL NETWORK START -->
                <ul id="social_network" >
                    <li class="social_network">
                        <a rel="external" href="http://twitter.com/home?status={news.TITLE}%20-%20http://lalocale.ckdevelop.org/news/news{news.U_NEWS_LINK}%20@Radio_La_Locale" target="_BLANK">
                            <img src="../templates/{THEME}/theme/images/twitter.png"/>
                        </a>
                    </li>
                    <li class="social_network">
                        <a rel="external" href="http://www.facebook.com/share.php?u=http://lalocale.ckdevelop.org/news/news{news.U_NEWS_LINK}" target="_BLANK">
                            <img src="../templates/{THEME}/theme/images/facebook.png"/>
                        </a>
                    </li>
                </ul>
                <!-- SOCIAL NETWORK END -->
                <div class="news_bottom_r">par {news.PSEUDO} &agrave; {GEO_AUTHOR}</div>
                <br />
            </div>
            <div class="news_bottom_l"></div>
            <div class="news_bottom_r"></div>
            <div class="news_bottom"></div>
        </div>		
       {COMMENTS}	   
        # END news #
 
        # IF C_NEWS_NAVIGATION_LINKS #
        <div style="width:90%;padding:20px;margin:auto;margin-top:-15px;">
            # IF C_PREVIOUS_NEWS # <span style="float:left;"><a href="news{U_PREVIOUS_NEWS}"><img src="../templates/{THEME}/images/left.png" alt="" class="valign_middle" /></a> <a href="news{U_PREVIOUS_NEWS}">{PREVIOUS_NEWS}</a></span> # ENDIF #
           # IF C_NEXT_NEWS # <span style="float:right;"><a href="news{U_NEXT_NEWS}">{NEXT_NEWS}</a> <a href="news{U_NEXT_NEWS}"><img src="../templates/{THEME}/images/right.png" alt="" class="valign_middle" /></a></span> # ENDIF #
        </div>
        # ENDIF #
 
		<div class="spacer"></div>
        <div class="text_center">{PAGINATION}</div>
        <div class="text_center">{ARCHIVES}</div>
		<div class="spacer"></div>
        # ENDIF #
 
 
 
        # IF C_NEWS_LINK #		
		<div class="news_container">
			<div class="news_top_l"></div>			
			<div class="news_top_r"></div>
			<div class="news_top">
				<div style="float:left"><a href="../syndication.php?m=news" title="Syndication"><img class="valign_middle" src="../templates/{THEME}/images/rss.png" alt="Syndication" title="Syndication" /></a> <h3 class="title valign_middle">{L_LAST_NEWS}</h3></div>
				<div style="float:right"># IF C_IS_ADMIN # &nbsp;&nbsp;<a href="admin_news_cat.php?id={IDCAT}" title="{L_EDIT}"><img class="valign_middle" src="../templates/{THEME}/images/{LANG}/edit.png" /></a> # ENDIF #</div>
			</div>	
			<div class="news_content">
 
			# START list #
				# IF list.C_NEWS_ROW # 
				<div class="spacer"></div> 
				# ENDIF #
 
				# IF C_NEWS_LINK_COLUMN # 
				<div style="float:left;width:{COLUMN_WIDTH}%">
				# ELSE #
				<div>
				# ENDIF #
					<ul style="margin:0;padding:0;list-style-type:none;">
						<li><img src="../templates/{THEME}/images/li.png" alt="" /> {list.ICON} <span class="text_small">{list.DATE} :</span> <a href="{list.U_NEWS}">{list.TITLE}</a></li>
					</ul>
				</div>
			# END list #
 
				<div class="spacer">&nbsp;</div>
				<div class="text_center">{PAGINATION}</div>
				<div class="text_center">{ARCHIVES}</div>				
			</div>
			<div class="news_bottom_l"></div>		
			<div class="news_bottom_r"></div>
			<div class="news_bottom"></div>
		</div>		
		# ENDIF #
 
 

j'ai placer la variable à la ligne 123:
Code TPL :
<div class="news_bottom_r">par {news.PSEUDO} &agrave; {GEO_AUTHOR}</div>


en espérant que ça aille cette fois-ci :)



Edité par BeHuman Le 14/01/12 à 13h45

pm    
   Le 14/01/12 à 13h56 Citer      

Booster Minigun

Groupe: Membre

Sexe:
Inscrit le: 09/01/12
Messages: 37
Lieu: Je me cherche e...
ton news.tpl est dans un dossier template ? (news/template/news.tpl)

pm http://www.micro-making.fr    
   Le 14/01/12 à 14h03 Citer      

Booster Minigun

Groupe: Membre

Inscrit le: 05/01/12
Messages: 35
ici pour le PHP PATH_ROOT/news/news.php ****
ici pour le TPL PATH_ROOT/templates/MON_THEME/modules/news/news.tpl

je devrais peut être faire un truc dans le genre:
Code PHP :
 
$tpl_news_perso = new Template('modules/news/news.tpl');
$tpl_news_perso->assign_vars(array(
    'GEO_AUTHOR' => 'geolocalisation',
));
$tpl_news_perso->parse();
 


non?



Edité par BeHuman Le 14/01/12 à 16h25

pm    
   Le 14/01/12 à 16h24 Citer      

Booster Minigun

Groupe: Membre

Inscrit le: 05/01/12
Messages: 35
BeHuman:
je devrais peut être faire un truc dans le genre:
Code PHP :
 
$tpl_news_perso = new Template('modules/news/news.tpl');
$tpl_news_perso->assign_vars(array(
    'GEO_AUTHOR' => 'geolocalisation',
));
$tpl_news_perso->parse();
 


non?


bein c'est pas ça :heink

pourtant j'ai lu la doc, je vois pas là où j'ai faux
tiens est j'ai vus une erreur sur mon message précédent désolé
l'erreur:
ici pour le PHP PATH_ROOT//news/news.tpl
en
ici pour le PHP PATH_ROOT/news/news.php

ça peut porter à confusion :mat



Edité par BeHuman Le 14/01/12 à 16h27

pm    
   Le 15/01/12 à 13h19 Citer      

Booster Minigun

Groupe: Membre

Inscrit le: 05/01/12
Messages: 35
salut à tous,

un petit up, toujours le même problème. :)

merci ++

pm    
   Le 29/01/12 à 16h14 Citer      

Booster Roquette

Développement Modules
Equipe test 4.0

Sexe:
Inscrit le: 01/09/08
Messages: 303
Bonjour,

Essaye de remplacer ton fichier news.php par celui ci :

Code PHP :
 
<?php
/*##################################################
 *                                news.php
 *                            -------------------
 *   begin              : June 20, 2005
 *   copyright          : (C) 2005 Viarre Régis
 *   email              : crowkait@phpboost.com
 *
 *
 ###################################################
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
###################################################*/
 
require_once('../kernel/begin.php');
require_once('../news/news_begin.php');
require_once('../kernel/header.php');
 
//$idnews, $idcat, $show_archive définies dans news_begin.php
 
$is_admin = $User->check_level(ADMIN_LEVEL);
if (empty($idnews) && empty($idcat)) // Accueil du module de news
{
	import('modules/modules_discovery_service');
	$modulesLoader = new ModulesDiscoveryService();
	$module_name = 'news';
	$module = $modulesLoader->get_module($module_name);
	if ($module->has_functionality('get_home_page')) {
		echo $module->functionality('get_home_page');
		require_once('../kernel/footer.php');
		exit;
	} elseif (!$no_alert_on_error) {
		global $Errorh;	
		$Errorh->handler('Le module <strong>' . $module_name . '</strong> n\'a pas de fonction get_home_page!', E_USER_ERROR, __LINE__, __FILE__);
		exit;
	}
}
elseif (!empty($idnews)) //On affiche la news correspondant à l'id envoyé.
{
	if (empty($news['id']))
		$Errorh->handler('e_unexist_news', E_USER_REDIRECT);
 
	import('content/comments');
	import('content/syndication/feed');
 
	$tpl_news = new Template('news/news.tpl');
 
	$next_news = $Sql->query_array(PREFIX . "news", "title", "id", "WHERE visible = 1 AND id > '" . $idnews . "' " . $Sql->limit(0, 1), __LINE__, __FILE__);
	$previous_news = $Sql->query_array(PREFIX . "news", "title", "id", "WHERE visible = 1 AND id < '" . $idnews . "' ORDER BY id DESC " . $Sql->limit(0, 1), __LINE__, __FILE__);
 
	$tpl_news->assign_vars(array(
		'C_IS_ADMIN' => $is_admin,
		'C_NEWS_BLOCK' => true,
		'C_NEWS_NAVIGATION_LINKS' => true,
		'C_PREVIOUS_NEWS' => !empty($previous_news['id']),
		'C_NEXT_NEWS' =>!empty($next_news['id']),
		'TOKEN' => $Session->get_token(),
		'PREVIOUS_NEWS' => $previous_news['title'],
		'NEXT_NEWS' => $next_news['title'],
		'U_PREVIOUS_NEWS' => url('.php?id=' . $previous_news['id'], '-0-' . $previous_news['id'] . '+' . url_encode_rewrite($previous_news['title']) . '.php'),
		'U_NEXT_NEWS' => url('.php?id=' . $next_news['id'], '-0-' . $next_news['id'] . '+' . url_encode_rewrite($next_news['title']) . '.php'),
		'L_SYNDICATION' => $LANG['syndication'],
		'L_ALERT_DELETE_NEWS' => $LANG['alert_delete_news'],
		'L_ON' => $LANG['on'],
		'L_DELETE' => $LANG['delete'],
		'L_EDIT' => $LANG['edit'],
	));
 
        $tpl_news->parse();
	$tpl_news->assign_block_vars('news', array(
		'C_IMG' => !empty($news['img']),
		'C_ICON' => (!empty($news['icon']) && $CONFIG_NEWS['activ_icon'] == 1),
		'ID' => $news['id'],
		'IDCAT' => $news['idcat'],
		'ICON' => second_parse_url($news['icon']),
		'TITLE' => $news['title'],
		'CONTENTS' => second_parse($news['contents']),
		'EXTEND_CONTENTS' => second_parse($news['extend_contents']) . '<br /><br />',
		'IMG' => second_parse_url($news['img']),
		'IMG_DESC' => $news['alt'],
		'PSEUDO' => $CONFIG_NEWS['display_author'] ? $news['login'] : '',				
		'DATE' => $CONFIG_NEWS['display_date'] ? $LANG['on'] . ': ' . gmdate_format('date_format_short', $news['timestamp']) : '',
		'U_COM' => ($CONFIG_NEWS['activ_com'] == 1) ? Comments::com_display_link($news['nbr_com'], '../news/news' . url('.php?cat=0&amp;id=' . $idnews . '&amp;com=0', '-0-' . $idnews . '+' . url_encode_rewrite($news['title']) . '.php?com=0'), $idnews, 'news') : '',
		'U_USER_ID' => url('.php?id=' . $news['user_id'], '-' . $news['user_id'] . '.php'),
		'U_NEWS_LINK' => url('.php?id=' . $news['id'], '-0-' . $news['id'] . '+' . url_encode_rewrite($news['title']) . '.php'),
	    'FEED_MENU' => Feed::get_feed_menu(FEED_URL),
            'GEO_AUTHOR' => 'geolocalisation'
	));	
}
elseif (!empty($idcat))
{
	$tpl_news = new Template('news/news_cat.tpl');
 
	$cat = $Sql->query_array(PREFIX . 'news_cat', 'id', 'name', 'icon', "WHERE id = '" . $idcat . "'", __LINE__, __FILE__);
	if (empty($cat['id']))
		$Errorh->handler('error_unexist_cat', E_USER_REDIRECT);
 
	$tpl_news->assign_vars(array(
		'C_IS_ADMIN' => $is_admin,
		'C_NEWS_LINK' => true,
		'CAT_NAME' => $cat['name'],
		'IDCAT' => $cat['id'],
		'L_EDIT' => $LANG['edit'],
		'L_CATEGORY' => $LANG['category']
	));
 
	$result = $Sql->query_while("SELECT n.id, n.title, n.nbr_com, nc.id AS idcat, nc.icon
	FROM " . PREFIX . "news n
	LEFT JOIN " . PREFIX . "news_cat nc ON nc.id = n.idcat
	WHERE n.visible = 1 AND n.idcat = '" . $idcat . "'
	ORDER BY n.timestamp DESC", __LINE__, __FILE__);
	while ($row = $Sql->fetch_assoc($result))
	{ 
		$tpl_news->assign_block_vars('list', array(
			'ICON' => ((!empty($row['icon']) && $CONFIG_NEWS['activ_icon'] == 1) ? '<a href="news' . url('.php?cat=' . $row['idcat'], '-' . $row['idcat'] . '.php') . '"><img class="valign_middle" src="' . $row['icon'] . '" alt="" /></a>' : ''),
			'TITLE' => $row['title'],
			'COM' => $row['nbr_com'],
			'U_NEWS' => 'news' . url('.php?id=' . $row['id'], '-0-' . $row['id'] . '+'  . url_encode_rewrite($row['title']) . '.php')
		));
	}
}
 
//Affichage commentaires.
if (isset($_GET['com']) && $idnews > 0)
{
	$tpl_news->assign_vars(array(
		'COMMENTS' => display_comments('news', $idnews, url('news.php?id=' . $idnews . '&amp;com=%s', 'news-0-' . $idnews . '.php?com=%s'))
	));
}
$tpl_news->parse();
 
require_once('../kernel/footer.php');
 
?>


Et dis moi si ça s'arrange.

julienseth78



Edité par julienseth78 Le 29/01/12 à 16h16

pm    
3 Utilisateurs en ligne :: 0 Administrateur, 0 Modérateur, 0 Membre et 3 Visiteurs
Utilisateurs en ligne: Aucun membre connecté
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie
Annonces