The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
vB4.2 Navigation Manager - how to discussion
I have vB 4.2.0 BETA 1 running in my test system. Products that use templates/hooks to integrate with the navbar will need the following changes to work with the Navigation Manager. Please post code snips and hints in this thread, we are all on a learning curve. 1. Remove old style navigation hooks/templates etc. 2. Create a new <navigation> section in the product XML file (You can create the navigation in the navigation manager, linked to a product then export the product file as a skeleton) 3. Set any conditionals in a hook or in your main code Eg. $show['apmgtug'] = true; is set for one of the menu items in my example My example relies on $show['member'] = true; as well. Leave the <show> tag empty for 'public' tabs/links 4. If you have multiple scripts, leave <scripts> blank and set $root at the new hooks set_navigation_tab_fallaback or set_navigation_tab_vbview Code:
if (<some condition>) $root= '<name of tab>'; I would probably have a new vB4.2 code base because of the differences, you could have the same code base with some sort of version check. In the end the new navigation integration is better and easier. Here are sample <navigation> from one of my own plugins... Code:
<navigation> <tab name="aptab_competition" date="1337135420" username="APcompetition" version="3.0.0"> <active>1</active> <show>member</show> <scripts>apcompetition</scripts> <displayorder>30</displayorder> <url><![CDATA[apcompetition.php{session.sessionurl_q}]]></url> </tab> <link name="aplink_enter" date="1337135420" username="APcompetition" version="3.0.0"> <active>1</active> <show>member</show> <parent>aptab_competition</parent> <displayorder>20</displayorder> <url><![CDATA[apcompetition.php{session.sessionurl_q}]]></url> </link> <link name="aplink_search" date="1337135420" username="APcompetition" version="3.0.0"> <active>1</active> <show>member</show> <parent>aptab_competition</parent> <displayorder>40</displayorder> <url><![CDATA[apcompetition.php?{vb:raw session.sessionurl}do=search&apmycomps=1]]></url> </link> <link name="aplink_performance" date="1337135420" username="APcompetition" version="3.0.0"> <active>1</active> <show>member</show> <parent>aptab_competition</parent> <displayorder>60</displayorder> <url><![CDATA[apcompetition.php?{vb:raw session.sessionurl}do=performance]]></url> </link> <link name="aplink_fame" date="1337135420" username="APcompetition" version="3.0.0"> <active>1</active> <show>apmgtug</show> <parent>aptab_competition</parent> <displayorder>80</displayorder> <url><![CDATA[apcompetition.php?{vb:raw session.sessionurl}do=finalvotereport]]></url> </link> </navigation> Code:
<phrasetype name="GLOBAL" fieldname="global"> <phrase name="vb_navigation_tab_aptab_competition_text" date="1336964077" username="APcompetition" version="3.0.0"><![CDATA[Competitions]]></phrase> <phrase name="vb_navigation_link_aplink_enter_text" date="1336964077" username="APcompetition" version="3.0.0"><![CDATA[Enter a Competition]]></phrase> <phrase name="vb_navigation_link_aplink_search_text" date="1336964077" username="APcompetition" version="3.0.0"><![CDATA[Search Competitions]]></phrase> <phrase name="vb_navigation_link_aplink_performance_text" date="1336964077" username="APcompetition" version="3.0.0"><![CDATA[My Performance]]></phrase> <phrase name="vb_navigation_link_aplink_fame_text" date="1336964077" username="APcompetition" version="3.0.0"><![CDATA[Hall of Fame]]></phrase> </phrasetype> Pull down menu's can also be coded. Have a look at the vB source for examples. Specifically "./install/vbulletin-navigation.xml" |
#12
|
||||
|
||||
Quote:
If the designer want's to do smth. complletely different from <ul> he can do that by simply modifying the template - with the list entries being generated in PHP he can't |
#13
|
|||
|
|||
I'm curious, do you know why that is? Is it the time needed to create the objects?
|
#14
|
||||
|
||||
Quote:
Kym |
#15
|
||||
|
||||
This is very handy... https://vborg.vbsupport.ru/showthread.php?t=283123 (Thanks Andreas)
Also Scott's post on vb.com https://www.vbulletin.com/forum/show...56#post2295256 |
#16
|
|||
|
|||
Quote:
And a note for any other coders that might want to add menus via DB addition rather than at installation.. Be sure you run build_language() after adding the navigation and phrase info. If you don't, your phrase won't appear in the menus. EDIT: Another note.. The information that's the original topic of this thread gets added to the install XML when you export it. So, you just need to create the navigation links and export a new XML for the mod. |
#17
|
|||
|
|||
OK, but I ran this modified version of the benchmark:
PHP Code:
and I got these results: Code:
Time taken for 10.000 Bit Templates: 0.072948932647705 Time taken for 10.000 Array-Elements with <vb:each>: 0.011199951171875 Success - Both methods yielded the same result data vs. these for the original version: Code:
Time taken for 10.000 Bit Templates: 1.542927980423 Time taken for 10.000 Array-Elements with <vb:each>: 0.011492967605591 Success - Both methods yielded the same result data That's 6.5 times slower vs 134 times slower, and seems to indicate that eval() isn't the main offender. |
Благодарность от: | ||
AusPhotography |
#18
|
||||
|
||||
It's basically the overhead required for variable registration and object creation that makes rending templates in a loop pretty slow.
|
#19
|
|||
|
|||
Yeah, I played around more and found that my times dropped from 1.5 to 0.7 just by not calling register_globals().
|
#20
|
||||
|
||||
Quote:
I've come up with this code, it's not efficient but it works, I will work on efficiency- nhawk I know you mentioned making a database change but I prefer to avoid db edits if possible. This example adds a link to Quick Links No phrase needed. On navigation_tab_complete hook: PHP Code:
|
Благодарность от: | ||
Hippy |
#21
|
||||
|
||||
That is a problem
I do not know the exact ideas behind Navigation Manager , but I think it simply wasn't designed with dynamic links in mind as vBulletin itself (except vBulletin CMS) does not do that. As I see it, there are currently three alternatives (of which none is realldy ideal):
IMHO the best solution would be if the Navigation Manager would offer "Dynamic Content" items which would just act as placeholders in ACP and are only being filled with content on the frontend when needed. This would be easy to implement and maintain for Add-ons and would still give the Administrator the power to control placement, etc. http://tracker.vbulletin.com/browse/VBIV-15123 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|