Alteração no menu [Dilber MC]

Started by Costa, October 10, 2008, 10:01:48 AM

Previous topic - Next topic

Costa

Olá pessoal

Queria fazer uma pequena modificação no menu do forum que administro, mas já queimei muito neurónio e ainda não consegui fazê-lo  :P

Se alguém me puder ajudar, agradecia

O meu fórum tem a barra de menu assim:


Eu queria que ficasse assim:


alguém consegue me ajudar?  :)
Hugo "Costa" Fernandes - PT SMF
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

margarett

Hummm... Tu "montaste" isso no photoshop ou viste algures assim?

Mete aí o código da função "template_menu" do index.template.php"
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Costa

#2
Montei no paint  :P
Não sei se dá pra fazer, mas se desse eu gostaria de o fazer  ;)
Não sou entendido em php, apenas dou uns toques  O:)

segue o código

// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
    global $context, $settings, $options, $scripturl, $txt;

    // Work out where we currently are.
    $current_action = 'home';
    if (in_array($context['current_action'], array('admin', 'ban', 'boardrecount', 'cleanperms', 'detailedversion', 'dumpdb', 'featuresettings', 'featuresettings2', 'findmember', 'maintain', 'manageattachments', 'manageboards', 'managecalendar', 'managesearch', 'membergroups', 'modlog', 'news', 'optimizetables', 'packageget', 'packages', 'permissions', 'pgdownload', 'postsettings', 'regcenter', 'repairboards', 'reports', 'serversettings', 'serversettings2', 'smileys', 'viewErrorLog', 'viewmembers')))
        $current_action = 'admin';
    if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'forum', 'spadmin')))
        $current_action = $context['current_action'];
    if ($context['current_action'] == 'search2')
        $current_action = 'search';
    if (isset($_GET['board']) || isset($_GET['topic']))
        $current_action = 'forum';
    if ($context['current_action']=='spadmin')
        $current_action = 'admin';
    if ($context['current_action'] == 'theme')
        $current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';

    // Dummy place holder, to set the height
    echo'
                <td align="center" class="menubg" height="30" width="20">
                </td>';

   
    // Show the [home] button.
    echo'
                <td align="center" class="menubg' , $current_action == 'home' ? '2' : '' , '">
                    <a href="', $scripturl, '">' , $txt[103] , '</a>
                </td>';
    // Here we go some new button.
      echo'
                       <td align="center" class="menubg' , $current_action == 'someuglytexthere' ? '2' : '' , '">
                               <a href="http://www.google.com.br" target="_blank">' , 'GOOGLE' , '</a>               
                        </td>';
    // Show the [help] button.
    echo'
                <td align="center" class="menubg' , $current_action == 'help' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=help">' , $txt[119] , '</a>
                </td>';
     // Show the [rules] button.
                 global $user_info, $modSettings;
                 if (!$user_info['is_guest'] || !empty($modSettings['rules_enable_guest_access']))
                 echo ($current_action == 'rules' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
                 <td align="center" class="menubg' , $current_action == 'rules' ? '2' : '' , '">
                        <a href="', $scripturl, '?action=rules">' , $txt['rules'] , '</a>
                </td>' , $current_action == 'rules' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
    // How about the [search] button?
    if ($context['allow_search'])
    echo'
                <td align="center" class="menubg' , $current_action == 'search' ? '2' : '' , '">
                        <a href="', $scripturl, '?action=search">' , $txt[182] , '</a>               
                </td>';
    // Is the user allowed to administrate at all? ([admin])
    if ($context['allow_admin'])
    echo'
                <td align="center" class="menubg' , $current_action == 'admin' ? '2' : '' , '">
                        <a href="', $scripturl, '?action=admin">' , $txt[2] , '</a>               
                </td>';
    // Edit Profile... [profile]
    if ($context['allow_edit_profile'])   
    echo'
                <td align="center" class="menubg' , $current_action == 'profile' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=profile">' , $txt[79] , '</a>                   
                </td>';
    // Go to PM center... [pm]
    if ($context['user']['is_logged'] && $context['allow_pm'])       
    echo'
                <td align="center" class="menubg' , $current_action == 'pm' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>                   
                </td>';
    // The [calendar]!
    if ($context['allow_calendar'])               
    echo'
                <td align="center" class="menubg' , $current_action == 'calendar' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a>                   
                </td>';               
    // the [member] list button
    if ($context['allow_memberlist'])               
    echo'
                <td align="center" class="menubg' , $current_action == 'mlist' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a>                   
                </td>';               

    // the [staff list] button
    if ($context['allow_view_stafflist'])
        echo ($current_action == 'staff' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
                <td align="center" class="menubg' , $current_action == 'staff' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=staff">' , $txt['smfstaff_stafflist']  , '</a>
                </td>' , $current_action == 'staff' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

    // If the user is a guest, show [login] button.
    if ($context['user']['is_guest'])
    echo'
                <td align="center" class="menubg' , $current_action == 'login' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=login">' , $txt[34] , '</a>                   
                </td>';               
    // If the user is a guest, also show [register] button.
    if ($context['user']['is_guest'])               
    echo'
                <td align="center" class="menubg' , $current_action == 'register' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=register">' , $txt[97] , '</a>               
                </td>';               
    // Otherwise, they might want to [logout]...
    if ($context['user']['is_logged'])               
    echo'
                <td align="center" class="menubg' , $current_action == 'logout' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>                   
                </td>';               
               
               
    // Dummy place holder, to end things
    echo'
                <td align="center" class="menubg" width="20">
                </td>';               


Este fórum já tinha muita coisa modificada quando peguei nele, ou seja, vais encontrar bastantes coisas que talvez estejam mal escritas...
Quando peguei nele tinha vários erros na template :o
Na skin padrão aparecia 4 botões da staff, 3 das MP etc etc

em anexo tens o arquivo index.template.php
Hugo "Costa" Fernandes - PT SMF
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

margarett

OK, dar, dá, mas exige uma modificaçãozeca... Queres tentar fazer?
Dou-te umas dicas ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Costa

Quero sim margarett

Se puderes fazê-lo ficaria agradecido :)
Hugo "Costa" Fernandes - PT SMF
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

margarett

Então por partes:
Percebes HTML? Muito, pouco, assim, assim?

O menu é composto por uma linha ("row", <tr>...</tr> em html) e essa linha composta por várias células ("data cell", <td>...</td> em html).

A chamada do menu é feita aqui:

<div class="menubar">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>';
// Show the menu here, according to the menu sub template.
template_menu();
echo '
</tr>
</table>
</div>';


Como vês, há um só "row" para o menu. Para criares um segundo "row" aqui, terias de ter 2 chamadas de função (e, claro, funções diferentes!), espalhando os botões por elas. Isso eventualmente cria-te dificuldades em compatibilidades com MODs.
O ideal será então tirar deste bocado de código os <tr>...</tr> e passá-los para a função lá em baixo. Desta forma, podes criar quantos rows quiseres, bastando colocar os botões no que te der mais jeito.

Boa sorte ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Costa

#6
hmmm, html entendo um pouco (mais que php)

Segundo o que entedi, seria retirar os <tr> de onde estão, apagá~los
mas inseri-los onde exactamente?
Aí perdi-me :p

Monto as "row" onde? aí já me perdi :p

Obrigado pela ajuda :)
Hugo "Costa" Fernandes - PT SMF
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

margarett

Deves retirar os "tr" do código acima (ou seja, da chamada da função), e passá-los (moldando à tua necessidade) dentro do código da função. Ou seja, a própria função é que vai "desenhar" os rows e células.

Ou seja, qualquer coisa assim:

// Dummy place holder, to set the height
echo'
<td align="center" class="menubg" height="30" width="20">
</td>';

Passa a:

// Dummy place holder, to set the height
echo'
                     <tr>
<td align="center" class="menubg" height="30" width="20">
</td>';


E não esquecer o final onde te convém. Basicamente, construindo 2 "rows" podes criar as 2 linhas de menu que queres ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Costa

#8
Grande Bruno! Já descobri onde estava errando, mas surgiu um probleminha agora...
Já consegui fazer as linhas, só deu um problema  :P
alinhá-las e metê-las na ordem que eu quero eu sei fazer, porém desapareceu o fundo azulinho

alterei assim:
     // Dummy place holder, to set the height
    echo'
                            <tr>
                <td align="center" class="menubg" height="16" width="20">
                </td>';

   
    // Show the [home] button.
    echo'
                <td align="center" class="menubg' , $current_action == 'home' ? '2' : '' , '">
                    <a href="', $scripturl, '">' , $txt[103] , '</a>
                </td>';
    // Here we go some new button.
      echo'
                       <td align="center" class="menubg' , $current_action == 'Google' ? '2' : '' , '">
                               <a href="http://www.google.com.br" target="_blank">' , 'GOOGLE' , '</a>               
                        </td>';
    // Show the [help] button.
    echo'
                <td align="center" class="menubg' , $current_action == 'help' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=help">' , $txt[119] , '</a>
                </td>';
     // Show the [rules] button.
                 global $user_info, $modSettings;
                 if (!$user_info['is_guest'] || !empty($modSettings['rules_enable_guest_access']))
                 echo ($current_action == 'rules' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
                 <td align="center" class="menubg' , $current_action == 'rules' ? '2' : '' , '">
                        <a href="', $scripturl, '?action=rules">' , $txt['rules'] , '</a>
                </td>' , $current_action == 'rules' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
    // The [calendar]!
    if ($context['allow_calendar'])               
    echo'
                <td align="center" class="menubg' , $current_action == 'calendar' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a>                   
                </td>';               
    // the [member] list button
    if ($context['allow_memberlist'])               
    echo'
                <td align="center" class="menubg' , $current_action == 'mlist' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a>                   
                </td>';               

    // the [staff list] button
    if ($context['allow_view_stafflist'])
        echo ($current_action == 'staff' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
                <td align="center" class="menubg' , $current_action == 'staff' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=staff">' , $txt['smfstaff_stafflist']  , '</a>
                </td>' , $current_action == 'staff' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
    // How about the [search] button?
    if ($context['allow_search'])
    echo'
                <td align="center" class="menubg' , $current_action == 'search' ? '2' : '' , '">
                        <a href="', $scripturl, '?action=search">' , $txt[182] , '</a>               
                </td></tr>';
        // Edit Profile... [profile]
    if ($context['allow_edit_profile'])   
    echo'
                            <tr>
                <td align="center" class="menubg' , $current_action == 'profile' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=profile">' , $txt[79] , '</a>                   
                </td>';
        // Go to PM center... [pm]
    if ($context['user']['is_logged'] && $context['allow_pm'])       
    echo'
                <td align="center" class="menubg' , $current_action == 'pm' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>                   
                </td>';
        // Is the user allowed to administrate at all? ([admin])
    if ($context['allow_admin'])
    echo'
                <td align="center" class="menubg' , $current_action == 'admin' ? '2' : '' , '">
                        <a href="', $scripturl, '?action=admin">' , $txt[2] , '</a>               
                </td>';
    // If the user is a guest, show [login] button.
    if ($context['user']['is_guest'])
    echo'
                <td align="center" class="menubg' , $current_action == 'login' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=login">' , $txt[34] , '</a>                   
                </td>';               
    // If the user is a guest, also show [register] button.
    if ($context['user']['is_guest'])               
    echo'
                <td align="center" class="menubg' , $current_action == 'register' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=register">' , $txt[97] , '</a>               
                </td>';               
    // Otherwise, they might want to [logout]...
    if ($context['user']['is_logged'])               
    echo'
                       
                <td align="center" class="menubg' , $current_action == 'logout' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>                   
                </td></tr>';               
               
                   
    // Dummy place holder, to end things
    echo'
                       
                <td align="center" class="menubg" width="20">
                </td>';


e aparece assim:



Alinhar as opções eu sei, mas queria que aparecesse tudo na barrinha azul  com o fundo correto...
Onde é que eu errei?
Hugo "Costa" Fernandes - PT SMF
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

Costa

Hugo "Costa" Fernandes - PT SMF
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

margarett

Hummm é que não tou a ver mesmo... Só com o fórum montado, para ir mexendo e escavacando :P

Assim de repente, eu punha assim:


     // Dummy place holder, to set the height
    echo'
                            <tr>
                <td align="center" class="menubg" height="16" width="20">
                </td>';

   
    // Show the [home] button.
    echo'
                <td align="center" class="menubg' , $current_action == 'home' ? '2' : '' , '">
                    <a href="', $scripturl, '">' , $txt[103] , '</a>
                </td>';
    // Here we go some new button.
      echo'
                       <td align="center" class="menubg' , $current_action == 'Google' ? '2' : '' , '">
                               <a href="http://www.google.com.br" target="_blank">' , 'GOOGLE' , '</a>               
                        </td>';
    // Show the [help] button.
    echo'
                <td align="center" class="menubg' , $current_action == 'help' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=help">' , $txt[119] , '</a>
                </td>';
     // Show the [rules] button.
                 global $user_info, $modSettings;
                 if (!$user_info['is_guest'] || !empty($modSettings['rules_enable_guest_access']))
                 echo ($current_action == 'rules' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
                 <td align="center" class="menubg' , $current_action == 'rules' ? '2' : '' , '">
                        <a href="', $scripturl, '?action=rules">' , $txt['rules'] , '</a>
                </td>' , $current_action == 'rules' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
    // The [calendar]!
    if ($context['allow_calendar'])               
    echo'
                <td align="center" class="menubg' , $current_action == 'calendar' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a>                   
                </td>';               
    // the [member] list button
    if ($context['allow_memberlist'])               
    echo'
                <td align="center" class="menubg' , $current_action == 'mlist' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a>                   
                </td>';               

    // the [staff list] button
    if ($context['allow_view_stafflist'])
        echo ($current_action == 'staff' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
                <td align="center" class="menubg' , $current_action == 'staff' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=staff">' , $txt['smfstaff_stafflist']  , '</a>
                </td>' , $current_action == 'staff' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
    // How about the [search] button?
    if ($context['allow_search'])
    echo'
                <td align="center" class="menubg' , $current_action == 'search' ? '2' : '' , '">
                        <a href="', $scripturl, '?action=search">' , $txt[182] , '</a>               
                </td>';

    // Dummy place holder, to end things
    echo'
                       
                <td align="center" class="menubg" width="20">
                </td></tr>';

//2ª linha do menu
     // Dummy place holder, to set the height
    echo'
                            <tr>
                <td align="center" class="menubg" height="16" width="20">
                </td>';

        // Edit Profile... [profile]
    if ($context['allow_edit_profile'])   
    echo'
                            <tr>
                <td align="center" class="menubg' , $current_action == 'profile' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=profile">' , $txt[79] , '</a>                   
                </td>';
        // Go to PM center... [pm]
    if ($context['user']['is_logged'] && $context['allow_pm'])       
    echo'
                <td align="center" class="menubg' , $current_action == 'pm' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>                   
                </td>';
        // Is the user allowed to administrate at all? ([admin])
    if ($context['allow_admin'])
    echo'
                <td align="center" class="menubg' , $current_action == 'admin' ? '2' : '' , '">
                        <a href="', $scripturl, '?action=admin">' , $txt[2] , '</a>               
                </td>';
    // If the user is a guest, show [login] button.
    if ($context['user']['is_guest'])
    echo'
                <td align="center" class="menubg' , $current_action == 'login' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=login">' , $txt[34] , '</a>                   
                </td>';               
    // If the user is a guest, also show [register] button.
    if ($context['user']['is_guest'])               
    echo'
                <td align="center" class="menubg' , $current_action == 'register' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=register">' , $txt[97] , '</a>               
                </td>';               
    // Otherwise, they might want to [logout]...
    if ($context['user']['is_logged'])               
    echo'
                       
                <td align="center" class="menubg' , $current_action == 'logout' ? '2' : '' , '">
                    <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>                   
                </td></tr>';               
               
                   
    // Dummy place holder, to end things
    echo'
                       
                <td align="center" class="menubg" width="20">
                </td></tr>';



Pareceu-me faltar um </tr>, e *TALVEZ* aqueles "dummy" placeholders façam falta, nã sei...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Costa

não, fica como na SS em anexo, heuehuehuhe

Vou continuar a fuçar, hehe
Obrigado por tudo Margarett
Hugo "Costa" Fernandes - PT SMF
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

margarett

#12
Raisparta :s

Mas deve ter a ver alguma coisa com isto... Verifica as "class" dos "td", se tudo bate certo, se não há <td>, </td>, <tr> ou </tr> a mais ou a menos.

edit: pela comparação, há alguma coisa mal... Ele aparenta estar bem dentro da linha "superior" depois que há botões. Antes dos botões parece ter linhas "2 em 1"...

Cola o código num editor bom (tipo Dreamweaver) e tenta identar (aquela cena de avançar o código dentro das funções) o texto de forma a identificares perfeitamente cada um dos "rows" e "células".
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Costa

Quote from: margarett on October 16, 2008, 01:04:10 PM
Cola o código num editor bom (tipo Dreamweaver) e tenta identar (aquela cena de avançar o código dentro das funções) o texto de forma a identificares perfeitamente cada um dos "rows" e "células".
é.........
Tenho é de "importar" um dreamweaver, huahauhauha
Valeu por tudo Bruno, hehe

Vou fuçar, tentativa e erro, um vez tem que que dar
Quando o conseguir posto o resultado aqui para quem quiser

Farebem
Hugo "Costa" Fernandes - PT SMF
Todas as MP's a pedir ajuda são sujeitas a radioactividade, microondas, queimadas e atiradas borda fora.

"At least someone appreciates the fact that I am doing and not thinking..."
"Laziness is counter-revolutionary."

Advertisement: