[phpBB 3.0.x] Ajouter de nouvelles options dans le sujet

Toutes les documentations phpBB seront ici.
Verrouillé
Avatar du membre
Dakin Quelia
Webmaster
Webmaster
Messages : 565
Enregistré le : ven. 27 nov. 2009 05:47
Localisation : Belgique
Contact :

[phpBB 3.0.x] Ajouter de nouvelles options dans le sujet

Message par Dakin Quelia »

» Ajouter de nouvelles options dans le sujet

Vous souhaitez ajouter de nouvelles icônes dans le sujet afin de pouvoir effectuer de nouvelles actions telles que imprimer le sujet, télécharger le sujet au format HTML ou encore avoir le sujet au format PDF, dans ce cas, il suffit de suivre cette documentation.

Avant tout, téléchargez ce pack:
topic_options.zip
(4.58 Kio) Téléchargé 328 fois
Ouvrez le fichier « language/fr/common.php ».

Cherchez:

Code : Tout sélectionner

    'default_dateformat'    => 'D j M Y H:i', // Lun 10 Jan 2007 13:37    
Après, ajoutez:

Code : Tout sélectionner

    'DOWNLOAD_TOPIC'        => 'Télécharger le sujet',
Ouvrez le fichier « viewtopic.php ».

Cherchez:

Code : Tout sélectionner

$update        = request_var('update', false); 
Après, ajoutez:

Code : Tout sélectionner

$action     = request_var('action', ''); 
Cherchez:

Code : Tout sélectionner

// Send vars to template
$template->assign_vars(array( 
Avant, ajoutez:

Code : Tout sélectionner

if ($action == 'download')
{
    // Send file headers
    header('Content-type: text/html');
    header('Content-Disposition: attachment;filename=' . $topic_data['topic_title']);
    header('Pragma: no-cache');
    header('Expires: 0');
} 
Cherchez:

Code : Tout sélectionner

    'U_TOPIC'                => "{$server_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id", 
Avant, ajoutez:

Code : Tout sélectionner

    'U_DOWNLOAD_TOPIC'        => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id&action=download"), 
Cherchez:

Code : Tout sélectionner

    'body' => ($view == 'print') ? 'viewtopic_print.html' : 'viewtopic_body.html') 
Remplacez par:

Code : Tout sélectionner

    'body' => ($view == 'print') ? 'viewtopic_print.html' : ($action == 'download') ? 'viewtopic_download.html' : 'viewtopic_body.html') 
Ouvrez le fichier « styles/prosilver/template/viewtopic_body.html ».

Cherchez:

Code : Tout sélectionner

	<!-- IF PAGINATION or TOTAL_POSTS -->
		<div class="pagination">
			<!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --><a href="{U_VIEW_UNREAD_POST}">{L_VIEW_UNREAD_POST}</a> &bull; <!-- ENDIF -->{TOTAL_POSTS}
			<!-- IF PAGE_NUMBER --><!-- IF PAGINATION --> &bull; <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> &bull; <span>{PAGINATION}</span><!-- ELSE --> &bull; {PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
		</div>
	<!-- ENDIF -->
Remplacez par:

Code : Tout sélectionner

	<div style="float: right;  margin-top: 5px;">
		<div class="buttons">
			<div class="download-topic"><a href="{U_DOWNLOAD_TOPIC}" title="{L_DOWNLOAD_TOPIC}" accesskey="d"><span></span>{L_DOWNLOAD_TOPIC}</a></div>
			<!-- IF U_PRINT_TOPIC --><div class="print-topic"><a href="{U_PRINT_TOPIC}" title="{L_PRINT_TOPIC}" accesskey="p"><span></span>{L_PRINT_TOPIC}</a></div><!-- ENDIF -->
			<!-- <div class="pdf-topic"><a href="{U_PRINT_TOPIC}" title="{L_PRINT_TOPIC}" accesskey="p"><span></span>{L_PRINT_TOPIC}</a></div> -->
		</div>
	</div>
Ouvrez le fichier « styles/prosilver/theme/buttons.css ».

Cherchez:

Code : Tout sélectionner

.forwardpm-icon span 	{ background: none 0 0 no-repeat; }
Après, ajoutez:

Code : Tout sélectionner

/* Nouvelles icones de sujet */
.download-topic span { background: none 0 0 no-repeat; }
.print-topic span 	{ background: none 0 0 no-repeat; }
.pdf-topic span 	{ background: none 0 0 no-repeat; }

.buttons div.download-topic	{ width: 16px; height: 16px; }
.buttons div.print-topic		{ width: 16px; height: 16px; }
.buttons div.pdf-topic		{ width: 16px; height: 16px; }
Ouvrez le fichier « styles/prosilver/theme/colours.css ».

Cherchez:

Code : Tout sélectionner

.forwardpm-icon span	{ background-image: url("{IMG_BUTTON_PM_FORWARD_SRC}") ;}
Après, ajoutez:

Code : Tout sélectionner

.print-topic span	{ background-image: url("{T_THEME_PATH}/images/icon_print.png"); }
.download-topic span	{ background-image: url("{T_THEME_PATH}/images/icon_download.png"); }
.pdf-topic span		{ background-image: url("{T_THEME_PATH}/images/icon_pdf.gif"); }
N'oubliez pas de rafraîchir le fichier template, thème et le pack image (onglet Styles) ainsi que de vider le cache (onglet Général).

Ce qui donne le résultat suivant:

Image

Verrouillé

Qui est en ligne

Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 20 invités