Alors voici la base pour crée une page supplémentaire (tuto initial par garedo):
Il faut 3 fichiers:
- Photos.php (Fichier principal qui se trouvera dans le dossier source)
- Photos.template.php (Fichier qui gère l'affichage)
- photos.french.php (Fichier contenant les variables de langue)
Les fichiers supplémentaires a modifier sont le index.php (a la racine du forum) et le index.template.php (pour crée un lien vers la nouvelle page).
Dans le fichier "photos.php" il faut mettre:
<?php
/********************************************************************************
* Photos * ======================================================================
*
* Software Version: 1 *
* Copyright (C) 2001-2006 Garedo(http://.org) *
********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');
function PhotosMain()
{
global $txt, $scripturl, $modSettings, $context;
//Load the main links template
loadLanguage('photos');
//listing actions
$subActions = array(
'' => 'VoirPhotos',
);
// Default to sub action 'main' or 'settings' depending on permissions.
$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : '';
$subActions[$_REQUEST['sa']]();
}
//fonction pour afficher ma page
function VoirPhotos()
{
global $txt, $scripturl, $modSettings, $context;
//Load the main links template
loadTemplate('Photos');
loadLanguage('Photos');
//Load the main index links template
$context['sub_template'] = 'main';
//Set the page title
$context['page_title'] = $txt['Photos_1'];
$context['linktree'][] = array(
'url' => $scripturl . '?action=Photos',
'name' => $txt['Photos_1'],
);
}
?>
Dans le fichier "photos.template.php" il faut mettre:
<?php
/********************************************************************************
* Photos *
* ==============================================================================*
* Software Version: 1 *
* Copyright (C) 2001-2006 Garedo (http://.org) *
*********************************************************************************/
function template_main()
{
global $txt;
echo
theme_linktree(),
'<div align="center" style="border: solid 1px black;padding:20px;width: 300px;margin:auto;">'.$txt['Photos_2'].'</div>';
}
?>
Le contenue est a mettre dans la div.
Dans le fichier "photos.french.php" il faut mettre:
<?php
// Version: 1.1 ; Photos
$txt['Photos_1'] = 'Ma Page';
$txt['Photos_2'] = 'Bonjours a tous.<br />Voici Ma Page perso.';
?>
Ensuite dans index.php (racine)
chercher:
// Here's the monstrous $_REQUEST['action'] array - $_REQUEST['action'] => array($file, $function).
$actionArray = array(
Mettre après:
//Ajout page photos
'Photos' => array('Photos.php','PhotosMain'),
Et dans index.template.php
chercher:
if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))
Remplacer par:
if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm','Photos')))
chercher:
// The end of tab section.
echo '
<td class="maintab_' , $last , '"> </td>
</tr>
</table>';
mettre juste avant:
//Voir le bouton [Photos]
echo ($current_action=='Photos' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'Photos' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=Photos">Photos</a>
</td>' , $current_action == 'photos' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
Voila la base.