Smf Menüye Manuel Buton Alt Buton Ekleme

orhan

Moderator
Katılım
5 Ara 2018
Mesajlar
466
Tepkime puanı
93
Puanları
28
Yazıları ekleyebilmek/değiştirebilmek için dil dosyası : Themes/default/languages/index.turkish.php

daha fazla buton ekleyebilmek için : Sources/Subs.php

Subs.php dosyasında :

Bul :
Kod:
// 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'])
Bu kodların altında
Kod:
$buttons = array(
        'home' => array(
            'title' => $txt['home'],
            'href' => $scripturl,
            'show' => true,
            'sub_buttons' => array(
            ),
            'is_last' => $context['right_to_left'],
        ),
Ana sayfa butonuyla başlar...

mesela diyelimki google.com.tr sitesine link vereceksiniz. bunun için yeni bir buton yapmanız gerekli diyoruz mantık olarak... ve bu buton ana sayfa düğmesinin hemen sağında olacak diyoruz.

en başta arıyoruz:
Bul:
Kod:
'home' => array(
            'title' => $txt['home'],
            'href' => $scripturl,
            'show' => true,
            'sub_buttons' => array(
            ),
            'is_last' => $context['right_to_left'],
        ),
Altına Ekle :
Kod:
        'google' => array(
            'title' => $txt['google'],
            'href' => 'http://www.google.com.tr',
            'show' => true,
            'sub_buttons' => array(
            ),
            'is_last' => $context['right_to_left'],
        ),
Şimdi yapmamız gereken olay dil dosyasına Google ismini yazmak

default/language/index.turkish.php dosyasını açıyoruz ve en altına :
Kod:
$txt['google'] = 'Google';

buradaki dikkat etmemiz gereken olay kırmızı ile işaretlenmiştir:
'google' => array(
            'title' => $txt['google'],
            'href' => 'http://www.google.com.tr',
            'show' => true,
            'sub_buttons' => array(
            ),
        ),


yada bir üyenin sayfasına yönlendireceğiz diyelim... Örnek olarak Adminin Sayfasını ele alıyorum

Kod:
        'user1' => array(
            'title' => $txt['adminin_sayfasi'],
            'href' => $scripturl . '?action=profile;u=1',
            'show' => true,
            'sub_buttons' => array(
            ),
        ),
ve yine dil dosyasının en altına ekliyoruz...
Kod:
$txt['adminin_sayfasi'] = 'Adminin Sayfasý';

Çoklu Buton Ekleme

Kod:
        
        'adminler' => array(
            'title' => $txt['adminler'],
            'href' => '#',
            'show' => true,
            'sub_buttons' => array(
              'admin1' => array(
                  'title' => $txt['siteadmin'],
                  'href' => $scripturl . '?action=profile;u=1',
                  'show' => true,
              ),
              'moderator1' => array(
                  'title' => $txt['moderator1'],
                  'href' => $scripturl . '?action=profile;u=2',
                  'show' => true,
              ),
              'moderator2' => array(
                  'title' => $txt['moderator2'],
                  'href' => $scripturl . '?action=profile;u=3',
                  'show' => true,
              ),
              'editor1' => array(
                  'title' => $txt['editor1'],
                  'href' => $scripturl . '?action=profile;u=4',
                  'show' => true,
              ),
              'editor2' => array(
                  'title' => $txt['editor2'],
                  'href' => $scripturl . '?action=profile;u=5',
                  'show' => true,
              ),
              'editor3' => array(
                  'title' => $txt['editor3'],
                  'href' => $scripturl . '?action=profile;u=5',
                  'show' => true,
                  'is_last' => true,
              ),
            ),
        ),
Dil dosyasına gene eklemeler yapılır
Kod:
$txt['adminler'] = 'Site Yönetimi';
$txt['siteadmin'] = 'Yönetici';
$txt['moderator1'] = 'Ana Moderator';
$txt['moderator2'] = 'Yardýmcý Moderator';
$txt['editor1'] = '1. Editör';
$txt['editor2'] = '2. Editör';
$txt['editor3'] = '3. Editör';

Anlaşılmayan bir şey olduğunu zannetmiyorum...

sadece dikkat etmeniz gereken olay 'href' => $scripturl . '?action=*******', sonlamadır...

Ana Sayfa Butonunun altına SubButon Ekleme
Örnek olarak Ana Sayfa Butonuna alt buton eklemek...

Sources/Subs.php içinde

Bul:
Kod:
'home' => array(
            'title' => $txt['home'],
            'href' => $scripturl,
            'show' => true,
            'sub_buttons' => array(
            ),
            'is_last' => $context['right_to_left'],
        ),

Değiştir:

Kod:
$buttons = array(
        'home' => array(
            'title' => $txt['home'],
            'href' => $scripturl,
            'show' => true,
            'sub_buttons' => array(
              'altbuton1' => array(
                  'title' => $txt['altbutonyazisi1'],
                  'href' => $scripturl . '?action=?',
                  'show' => true,
              ),
              'altbuton2' => array(
                  'title' => $txt['altbutonyazisi2'],
                  'href' => $scripturl . '?action=?',
                  'show' => true,
              ),
              'altbuton3' => array(
                  'title' => $txt['altbutonyazisi3'],
                  'href' => $scripturl . '?action=?',
                  'show' => true,
              ),
            ),
            'is_last' => $context['right_to_left'],
        ),

Dikkat edip değiştireceğin yerler:
bu şekilde çoğaltabilirsiniz butonları. kolay gelsin...

'altbuton1' => array(
  'title' => $txt['altbutonyazisi1'],
  'href' => $scripturl . '?action=****',
  'show' => true,
),


Tam anlamıyla her konuda açıklamanın yapıldığını düşünüyorum...

Kolay gelsin...
 

Ekli dosyalar

  • 20210114_010044.png
    20210114_010044.png
    25.1 KB · Görüntüleme: 2
  • 20210114_010029.png
    20210114_010029.png
    42.2 KB · Görüntüleme: 2
Bu kodu bulun

Kod:
@media (max-width: 480px) {
.dropmenu li ul, .dropmenu li li:hover ul, .dropmenu li li ul {
    position: relative;
    border-radius: 0;
    left: 0;
}
}

Bunu silin

position: relative;
 

Yasal Uyarı

İçerik sağlayıcı paylaşım sitesi olarak hizmet veren webtiryakin.com 5651 sayılı kanunun 8. maddesine ve T.C.Knın 125. maddesine göre tüm üyelerimiz yaptıkları paylaşımlardan kendileri sorumludur. Hukuka ve mevzuata aykırı olduğunu düşündüğünüz içeriği BURADAN bildirebilirsiniz. Kısa sürede dönüş yapmaya çalışacağız.
Geri
Üst