Register Arama Bugünkü Mesajlar Tüm Forumu Okundu Say

Reply
 
Thread Tools
[How To] Adding Navigation Tabs Fast and Easy
vB.Org Poster
vB.Org Poster has disabled reputation
Kayıt Tarihi: Jul 2018
Mesajlar: 298

Show Printable Version Email this Page
Makale: vBulletin 4 Makaleleri, yazan vB.Org Poster 10 Jul 2018, 09:53

Spoiler (vBulletin 4):




Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

Spoiler (vBulletin 3):




Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

---

Adding a navigation tab is not a new concept. There are two articles (Lynne's and Ragtek's) on vBulletin.org showing how to do this. Both solutions work, but you are reading this to learn how to do take it from workable to fast, efficient, and portable.

Let's first explore the two ways it is currently done. Let's say we want to add a 'Twitter' tab, linking to "twitter.com/xyz", on every page.

Using Lynne's method:
Plugin (hook: process_templates_complete)

Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

The benefit to this method is that it is straightforward for static, childless tabs; if you know a little php and html, this is not too difficult to implement. The problem with this method is that everything is hard-coded. The html is static; it does not make use of the template or phrase system. If you want to change the tab and add sub-links and drop-downs, you have mess with the html to get it just right. Doing anything else is going to require advanced skills and knowledge of the navigation tab system (first article), no matter how you slice it.

Using Ragtek's method:

Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

Plugin (hook: process_templates_complete)

Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

This method addresses on some of the weaknesses of Lynne's method and inherits others. Benefits include making use of the phrase and template systems. On the other hand, this shares many of the same weaknesses on the plugin side; anything but the most simple tab is going to require advanced knowledge (second article).



The first two choices come down to either simplicity at the cost of flexibility, or flexibility at the cost of complexity. There is a way to have the best of both worlds and the worst of none.

How? The answer lies in the `LancerForHire - Extended Navigations` product.

Enter, `ExtendedNavigations::update`:

Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

Let's bring this into context by replicating the tab examples in the two articles, but using the ExtendedNavigations class.

Lynne's:
Plugin (hook: global_setup_complete), Order: 999 or less

Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

Ragtek's:
Plugin (hook: global_setup_complete), Order: 999 or less

Kod Blok Kilitli:      (Kayıt veya giriş yapmalısın)  
Engellenmiş, kayıtlı olmayan veya onay bekleyen kişiler kodlara erişemezler.

No static html, no css classes, no new templates, no conditions. Simple. You could even drop this code in vB 3 and have a new navigation link (more in the final section).

The `ExtendedNavigations::update` function takes a variable number of arrays. Each array ($options) follows the format below.


How do I get this?

Download the product-extended_navigations_ Xml and add it (extended_navigations) as a product dependency. Yes; that's it!

Extended Navigations is reverse compatible and can be used to add tabs to vBulletin 3 easily. To use Extended Navigations in vBulletin 3, an additional product download and dependency are required: product-extended_legacies. No code changes required.

Brought to you by LancerForHire, LLC.
Views: 30
Reply With Quote
Reply

Thread Tools

Şunları Yapabilirsin
Yeni Konu Açmak
Konuya Cevap Yazmak
Eklenti Eklemek
Düzenleme Yapabilmek

Forum Atla


LD'de Yeni misin? Yardıma mı ihtiyacın var?

All times are GMT +3. The time now is 11:56.

Tasarım Özelliği | Genişlik: Geniş Renk: [How To] Adding Navigation Tabs Fast and Easy [How To] Adding Navigation Tabs Fast and Easy [How To] Adding Navigation Tabs Fast and Easy [How To] Adding Navigation Tabs Fast and Easy [How To] Adding Navigation Tabs Fast and Easy