[PBTV5.0] Barre BBCode: Ajouter des styles

Introduction:



Parfois et selon l'utilité que cela peut avoir, nous avons toujours besoin d'un petit plus ! Ici nous rajoutons donc des styles dans la barre BBcode.

Avertissement



Avant toutes modifications de fichiers, pensez à faire une sauvegarde du site et de votre Base de données.

Le visuel





Les fichiers php



BBCodeParser.class.php



- Rendez-vous dans le module "BBcode/formatting" et ouvrez le " BBCodeParser.class.php", à la ligne 202 vous avez ceci :

Code PHP :
            'style' => '`[style=(success|question|notice|warning|error)](.+)[/style]`isU',
 


Replacez par :

Code PHP :
            'style' => '`[style=(success|question|notice|warning|error|note|astuce)](.+)[/style]`isU',
 


Enregistrer et fermer.

BBCodeUnparser.class.php



- Rendez-vous dans le module "BBcode/formatting" et ouvrez le " BBCodeUnparser.class.php", à la ligne 153 vous avez ceci :

Code PHP :
            '`<span class="(success|question|notice|warning|error)">(.*)</span>`isU',


Replacez par :

Code PHP :
            '`<span class="(success|question|notice|warning|error|note|astuce)">(.*)</span>`isU',


Enregistrer et fermer.

BBCodeEditor.class.php



- Rendez-vous dans le module "BBcode/formatting" et ouvrez le " BBCodeEditor.class.php", à la ligne 123vous avez ceci :

Code PHP :
            'L_QUESTION' => $LANG['question'],
            'L_NOTICE' => $LANG['notice'],
            'L_WARNING' => $LANG['warning'],
            'L_ERROR' => LangLoader::get_message('error', 'status-messages-common'),
            'L_SUCCESS' => $LANG['success'],


En dessous rajoutez comme suit:

Code PHP :
            'L_QUESTION' => $LANG['question'],
            'L_NOTICE' => $LANG['notice'],
            'L_WARNING' => $LANG['warning'],
            'L_ERROR' => LangLoader::get_message('error', 'status-messages-common'),
            'L_SUCCESS' => $LANG['success'],
            'L_NOTE' => $bbcode_lang['note'],
            'L_ASTUCE' => $bbcode_lang['astuce'],


Enregistrer et fermer.

common.php



- Rendez-vous dans le module "BBcode/lang/french" et ouvrez le " common.php", à la fin avant le la fermeture php "?>"

Placez ceci :

Code PHP :
//Ajout EDN
$lang['note'] = 'Note';
$lang['astuce'] = 'Astuce';


[style=note] Faite de même dans le dossier "BBcode/lang/english/common.php"[/style]

Enregistrer et fermer.

Le fichier :bbcode_editor.tpl



Ce fichier vous le trouverez dans le module "BBcode/templates". Cependant Attention : certains d'entre vous on déjà peut être modifié se fichier dans leur thème. Un coup d'oeil rapide dans le dossier "MON-THEME/modules/" pour vérifier si un dossier "BBCode" est existant et si le dit bbcode_editor.tpl est présent.

- Si c'est le cas : modifiez celui de votre thème.
- Si il n'y est pas , modifiez celui qui est dans le module "BBcode/templates
".

Poursuivons ...

Éditez le et rendez vous à la ligne 213

Vous avez ceci :

Code TPL :
                <div class="bbcode-block-container" style="display:none;" id="bb-block4{FIELD}">
                    <ul class="bbcode-block bbcode-block-list bbcode-block-message" onmouseover="bb_hide_block('4', '{FIELD}', 1);" onmouseout="bb_hide_block('4', '{FIELD}', 0);">
                        <li><a href="" onclick="{DISABLED_B}insertbbcode('[style=success] ', '[/style]', '{FIELD}');bb_hide_block('4', '{FIELD}', 0);return false;" title="{L_SUCCESS} "> {L_SUCCESS}</a></li>
                        <li><a href="" onclick="{DISABLED_B}insertbbcode('[style=question]', '[/style]', '{FIELD}');bb_hide_block('4', '{FIELD}', 0);return false;" title="{L_QUESTION}"> {L_QUESTION}</a></li>
                        <li><a href="" onclick="{DISABLED_B}insertbbcode('[style=notice]', '[/style]', '{FIELD}');bb_hide_block('4', '{FIELD}', 0);return false;" title="{L_NOTICE}"> {L_NOTICE}</a></li>
                        <li><a href="" onclick="{DISABLED_B}insertbbcode('[style=warning]', '[/style]', '{FIELD}');bb_hide_block('4', '{FIELD}', 0);return false;" title="{L_WARNING}"> {L_WARNING}</a></li>
                        <li><a href="" onclick="{DISABLED_B}insertbbcode('[style=error]', '[/style]', '{FIELD}');bb_hide_block('4', '{FIELD}', 0);return false;" title="{L_ERROR}"> {L_ERROR}</a></li>                
                    </ul>
                </div>


Remplacer par :

Code TPL :
                <div class="bbcode-block-container" style="display:none;" id="bb-block4{FIELD}">
                    <ul class="bbcode-block bbcode-block-list bbcode-block-message" onmouseover="bb_hide_block('4', '{FIELD}', 1);" onmouseout="bb_hide_block('4', '{FIELD}', 0);">
                        <li><a href="" onclick="{DISABLED_B}insertbbcode('[style=success] ', '[/style]', '{FIELD}');bb_hide_block('4', '{FIELD}', 0);return false;" title="{L_SUCCESS} "> {L_SUCCESS}</a></li>
                        <li><a href="" onclick="{DISABLED_B}insertbbcode('[style=question]', '[/style]', '{FIELD}');bb_hide_block('4', '{FIELD}', 0);return false;" title="{L_QUESTION}"> {L_QUESTION}</a></li>
                        <li><a href="" onclick="{DISABLED_B}insertbbcode('[style=notice]', '[/style]', '{FIELD}');bb_hide_block('4', '{FIELD}', 0);return false;" title="{L_NOTICE}"> {L_NOTICE}</a></li>
                        <li><a href="" onclick="{DISABLED_B}insertbbcode('[style=warning]', '[/style]', '{FIELD}');bb_hide_block('4', '{FIELD}', 0);return false;" title="{L_WARNING}"> {L_WARNING}</a></li>
                        <li><a href="" onclick="{DISABLED_B}insertbbcode('[style=error]', '[/style]', '{FIELD}');bb_hide_block('4', '{FIELD}', 0);return false;" title="{L_ERROR}"> {L_ERROR}</a></li>
                        <li><a href="" onclick="{DISABLED_B}insertbbcode('[style=note]', '[/style]', '{FIELD}');bb_hide_block('4', '{FIELD}', 0);return false;" title="{L_NOTE}"> {L_NOTE}</a></li>
                        <li><a href="" onclick="{DISABLED_B}insertbbcode('[style=astuce]', '[/style]', '{FIELD}');bb_hide_block('4', '{FIELD}', 0);return false;" title="{L_ASTUCE}"> {L_ASTUCE}</a></li>                    
                    </ul>
                </div>


Enregistrer et fermer.

Le fichier : global.css



Dans le global.css , à partir de la ligne 438, vous pourrez modifier comme suit :

Code CSS :
 
/* -- Les messages d erreurs -- */
/* ---------------------------- */
div.message-helper-small {
    width: 50%;
}
.error,
.notice,
.warning,
.success,
.question,
.note,
.astuce {
    position: relative;
    display: block;
    margin: 5px auto 15px auto;
    padding: 10px 10px 10px 40px;
    height: auto;
    border: 1px solid #FFFFFF;
    border-radius: 4px;
    line-height: 20px;
    text-align: left;
    overflow: hidden;
}
.error:before,
.notice:before,
.warning:before,
.success:before, 
.question:before,
.note:before,
.astuce:before{
    position: absolute;
    left: 6px;
    top: 7px;
    width: 28px;
    font-family: FontAwesome;
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    font-size: 2em;
    text-align: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.error:before    { content: "f00d"; }
.notice:before   { content: "f12a"; }
.warning:before     { content: "f071"; }
.success:before     { content: "f00c"; }
.question:before { content: "f128"; }
.note:before { content: "f24a"; }
.astuce:before { content: "f0eb"; }
.error, .error:before       { color: #efefef; }
.notice, .notice:before     { color: #555555; }
.warning, .warning:before   { color: #AD022A; }
.success, .success:before   { color: #044D00; }
.question, .question:before { color: #006A9E; }
.note, .note:before { color: #335522; }
.astuce, .astuce:before { color: #232255; }
.error    { background-color: #6d0000; border-color: #6d0000; }
.notice   { background-color: #CCCCCC; border-color: #CCCCCC; }
.warning  { background-color: #FCB34C; border-color: #FCB34C; }
.success  { background-color: #8ac77f; border-color: #8ac77f; }
.question { background-color: #ADCEE2; border-color: #ADCEE2; }
.note { background-color: #FFEF8F; border-color: #FFEF8F; }
.astuce { background-color: #D4CDFF; border-color: #D4CDFF; }
 


Enregistrer et fermer.


Et pour finir ...



Important: N'oubliez pas de rafraîchir vos cache dans l'administration/Outils/Cache ==> CSS et tpl!

Si vous avez des questions, n'hésitez pas à les poser sur le forum :)


Créé le03/01/2017, par Swan

Cette page a été consultée 1807 fois