Simple Machines Community Forum

SMF Support => Language Specific Support => Français (French) => Topic started by: ( Tchey ) on November 17, 2010, 07:35:35 AM

Title: Qu'est-ce qui cloche dans mon code pour ajouter un menu déroulant ?
Post by: ( Tchey ) on November 17, 2010, 07:35:35 AM
Bonjour,

Je souhaite ajouter un menu déroulant sur le forum, à côté de Accueil, Admin, etc. J'ai vu qu'il y avait un mod pour ça mais j'aimerais le faire à la main pour apprendre.

Comme souvent, je copie/colle un code déjà existant et je touche des petits bouts pour voir ce que ça fait. Hors là, un truc m'échappe visiblement.

J'ouvre donc le fichier /source/subs.php avec notepadd++ et je bidouille.

Voilà le code :


// All the buttons we can possible want and then some, try pulling the final list of buttons from cache first.
if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])
{
$buttons = array(
'' => array(
'title' => 'Carnets Virtuels',
'href' => 'http://carnets-virtuels.org/',
'show' => true,
'sub_buttons' => array(
'' => array(
'title' => "Dol Orh'Ant",
'href' => 'http://carnets-virtuels.org/dolorhant/',
'show' => true,
),
'' => array(
'title' => 'Les Carnets',
'href' => 'http://carnets-virtuels.org/blog/',
'show' => true,
),
'' => array(
'title' => 'Forum',
'href' => 'http://carnets-virtuels.org/forum/',
'show' => true,
'is_last' => true,
),
),
),


Le résultat est que seule la dernière option est disponible, Forum. Le reste est simplement invisible.

Merci pour votre aide.
Title: Re: Qu'et-ce qui cloche dans mon code pour ajouter un menu déroulant ?
Post by: maximus23 on November 17, 2010, 07:48:34 AM
Bonjour,

Comment veux-tu qu'il retrouve ta variable tableau si tu ne la définis pas ?

Exemple :


'carnet' => array(
'title' => 'Les Carnets',
'href' => 'http://carnets-virtuels.org/blog/',
'show' => true,
),



:)
Title: Re: Qu'et-ce qui cloche dans mon code pour ajouter un menu déroulant ?
Post by: ( Tchey ) on November 17, 2010, 08:01:14 AM
Effectivement... Merci...

Encore un "détail" : j'ai un point jaune à droite des menus qui renvoie sur le forum. Je n'ai rien modifié en dehors du premier menu déroulant.


$buttons = array(
'cvcarnets' => array(
'title' => 'Carnets Virtuels',
'href' => 'http://carnets-virtuels.org/',
'show' => true,
'sub_buttons' => array(
'cvdolorhant' => array(
'title' => "Dol Orh'Ant",
'href' => 'http://carnets-virtuels.org/dolorhant/',
'show' => true,
),
'cvblog' => array(
'title' => 'Les Carnets',
'href' => 'http://carnets-virtuels.org/blog/',
'show' => true,
),
'cvforum' => array(
'title' => 'Forum',
'href' => 'http://carnets-virtuels.org/forum/',
'show' => true,
'is_last' => true,
),
),
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),
),
'admin' => array(
'title' => $txt['admin'],
'href' => $scripturl . '?action=admin',
'show' => $context['allow_admin'],
'sub_buttons' => array(
'featuresettings' => array(
'title' => $txt['modSettings_title'],
'href' => $scripturl . '?action=admin;area=featuresettings',
'show' => allowedTo('admin_forum'),
),
'packages' => array(
'title' => $txt['package'],
'href' => $scripturl . '?action=admin;area=packages',
'show' => allowedTo('admin_forum'),
),
'errorlog' => array(
'title' => $txt['errlog'],
'href' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc',
'show' => allowedTo('admin_forum') && !empty($modSettings['enableErrorLogging']),
),
'permissions' => array(
'title' => $txt['edit_permissions'],
'href' => $scripturl . '?action=admin;area=permissions',
'show' => allowedTo('manage_permissions'),
'is_last' => true,
),
),
),
'moderate' => array(
'title' => $txt['moderate'],
'href' => $scripturl . '?action=moderate',
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'modlog' => array(
'title' => $txt['modlog_view'],
'href' => $scripturl . '?action=moderate;area=modlog',
'show' => !empty($modSettings['modlog_enabled']) && !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
),
'poststopics' => array(
'title' => $txt['mc_unapproved_poststopics'],
'href' => $scripturl . '?action=moderate;area=postmod;sa=posts',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'attachments' => array(
'title' => $txt['mc_unapproved_attachments'],
'href' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
'show' => $modSettings['postmod_active'] && !empty($user_info['mod_cache']['ap']),
),
'reports' => array(
'title' => $txt['mc_reported_posts'],
'href' => $scripturl . '?action=moderate;area=reports',
'show' => !empty($user_info['mod_cache']) && $user_info['mod_cache']['bq'] != '0=1',
'is_last' => true,
),
),
),
'profile' => array(
'title' => $txt['profile'],
'href' => $scripturl . '?action=profile',
'show' => $context['allow_edit_profile'],
'sub_buttons' => array(
'summary' => array(
'title' => $txt['summary'],
'href' => $scripturl . '?action=profile',
'show' => true,
),
'account' => array(
'title' => $txt['account'],
'href' => $scripturl . '?action=profile;area=account',
'show' => allowedTo(array('profile_identity_any', 'profile_identity_own', 'manage_membergroups')),
),
'profile' => array(
'title' => $txt['forumprofile'],
'href' => $scripturl . '?action=profile;area=forumprofile',
'show' => allowedTo(array('profile_extra_any', 'profile_extra_own')),
'is_last' => true,
),
),
),
'pm' => array(
'title' => $txt['pm_short'],
'href' => $scripturl . '?action=pm',
'show' => $context['allow_pm'],
'sub_buttons' => array(
'pm_read' => array(
'title' => $txt['pm_menu_read'],
'href' => $scripturl . '?action=pm',
'show' => allowedTo('pm_read'),
),
'pm_send' => array(
'title' => $txt['pm_menu_send'],
'href' => $scripturl . '?action=pm;sa=send',
'show' => allowedTo('pm_send'),
'is_last' => true,
),
),
),
'calendar' => array(
'title' => $txt['calendar'],
'href' => $scripturl . '?action=calendar',
'show' => $context['allow_calendar'],
'sub_buttons' => array(
'view' => array(
'title' => $txt['calendar_menu'],
'href' => $scripturl . '?action=calendar',
'show' => allowedTo('calendar_post'),
),
'post' => array(
'title' => $txt['calendar_post_event'],
'href' => $scripturl . '?action=calendar;sa=post',
'show' => allowedTo('calendar_post'),
'is_last' => true,
),
),
),
'mlist' => array(
'title' => $txt['members_title'],
'href' => $scripturl . '?action=mlist',
'show' => $context['allow_memberlist'],
'sub_buttons' => array(
'mlist_view' => array(
'title' => $txt['mlist_menu_view'],
'href' => $scripturl . '?action=mlist',
'show' => true,
),
'mlist_search' => array(
'title' => $txt['mlist_search'],
'href' => $scripturl . '?action=mlist;sa=search',
'show' => true,
'is_last' => true,
),
),
),
'login' => array(
'title' => $txt['login'],
'href' => $scripturl . '?action=login',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
),
'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),
'logout' => array(
'title' => $txt['logout'],
'href' => $scripturl . '?action=logout;%1$s=%2$s',
'show' => !$user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),
);
Title: Re: Qu'est-ce qui cloche dans mon code pour ajouter un menu déroulant ?
Post by: maximus23 on November 17, 2010, 10:58:11 AM
Bonjour,

Un point jaune ? Fais une capture pour que cela soit plus clair :)