Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-19-2004, 02:16 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vbExtension utilities or class (Poll)

Something that has been on my mind for some time is the notion of a community-supported set of utilities for writing vBulletin extensions/hacks. vBulletin itself is not designed with extensibility in mind.

The two most compelling reasons for such a set of utilities would be:
  1. To protect extensions from changes in vBulletin. If it were community supported, changes in vBulletin could be integrated in the utilities so that hacks using the utilities would be somewhat protected from incompatible changes in vBulletin code.
  2. To provide common interfaces for the most common vBulletin idioms, such as generating a list of accessible forums. Why repeat this code in every hack?
I have put some of the ideas for interface ideas in the poll. Others?
Reply With Quote
  #2  
Old 07-19-2004, 02:26 PM
nexialys
Guest
 
Posts: n/a
Default

take a close look at the /includes/ directory, and you will have everything you need to suite your needs. all these files are like the default API classes for your needs. each file have the specific functions to answer specific needs in code integration.

no need of more extensions...

2¢CA == 1¢US... but btw, it's a cent

EDIT... btw, discussing the code structure of vB would have more values on vBulletin.com than here... we already code new things because we need more features, having them implemented in vB means you discuss with the coders of it, at vBulletin.com !
Reply With Quote
  #3  
Old 07-19-2004, 02:35 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by nexialys
take a close look at the /includes/ directory, and you will have everything you need to suite your needs. all these files are like the default API classes for your needs. each file have the specific functions to answer specific needs in code integration.

no need of more extensions...

2?CA == 1?US... but btw, it's a cent

EDIT... btw, discussing the code structure of vB would have more values on vBulletin.com than here... we already code new things because we need more features, having them implemented in vB means you discuss with the coders of it, at vBulletin.com !
I am not suggesting it be coded *in* vBulletin. It would be supported here, for the purpose of making extensions easier to write, more standardized, and to some extent, to help prevent incompatible changes in vB ripple through all of the extensions in the world (e.g., change in a functions parameters).

I have perused most of the code in include files, and have used a good deal of the common routines. While they offer decent functionality, they clearly do not provide many of the common requirements of writing an extension. If they did, we would not have to post lines of code everytime someone asks "How to I get a proper navbar?" or "How to I generate a list of forums that are accessible?", etc.

Cheers
Reply With Quote
  #4  
Old 07-19-2004, 02:43 PM
nexialys
Guest
 
Posts: n/a
Default

sure, but i was talking about integrating to vB... if you want to develop a setup class, no problem, i will be one of the first to try it... i'm doing so myself, as i'm developping external tools and each time, i build the complete list of functions to be independant from vB, so i don't have to upgrade each time vB upgrade..
Reply With Quote
  #5  
Old 07-19-2004, 02:46 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

> "How to I get a proper navbar?"
$navbits = array('put smth. useful here');
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

I don't think this could be done much easier ... ?
Reply With Quote
  #6  
Old 07-19-2004, 03:05 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by nexialys
sure, but i was talking about integrating to vB...
And I was not...

It is difficult for me to understand why folks would want to hand-code something like permission checking or the pagenav stuff. In the end, all it does is lead to extensions being posted without the proper functionality.

The sorts of calls one would make might look like this:
PHP Code:
/* Set page title, script-related var's, and var's according to option string. */
$vbext = &New vbExtension($TITLE$URL'navbar, forum_jump);
...

/* Generate list of forums with these permissions (or can_moderate). */
$forumids = $vbext->get_accessible_forumids('
canviewcanviewothers'); 
Reply With Quote
  #7  
Old 07-19-2004, 03:11 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
> "How to I get a proper navbar?"
$navbits = array('put smth. useful here');
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

I don't think this could be done much easier ... ?
I understand where you are coming from, but again, it codes in a dependency on vBulletin and, it clearly more difficult than:
PHP Code:
/* Default navbar based on initial call to vbExtension. */
$navbar $vbext->get_navbar(); 
In fact, that call would be unecessary if 'navbar' were specified in the class-creation call.

Or to generate a navbar two-levels deep:
PHP Code:
$navbar $vbext->get_navbar('Sub-page name'); 
Both calls work because the title and URL info are available from when the class is created.
Reply With Quote
  #8  
Old 07-19-2004, 03:29 PM
nexialys
Guest
 
Posts: n/a
Default

hum.. looks like i see where is your point... you would like to have parts of vB to become OOP... i don't think it's planned... OOP is not even recognised at php.net, even in PHP5...

your leveled navbar example is not concise...:
PHP Code:
$navbits construct_navbits(array(
                                    
'element_url.html'  => 'element_name',
                                    
''                  => 'last_element_name_without_link'
                            
)   ); 
is it so complicated to build ?!... you tell in your explanation that our actual structure is hard to understand... i think that OOP is complicated, not pure php...
Reply With Quote
  #9  
Old 07-19-2004, 03:47 PM
CarCdr CarCdr is offline
 
Join Date: Apr 2004
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by nexialys
hum.. looks like i see where is your point... you would like to have parts of vB to become OOP... i don't think it's planned... OOP is not even recognised at php.net, even in PHP5...

your leveled navbar example is not concise...:
PHP Code:
$navbits construct_navbits(array(
                                    
'element_url.html'  => 'element_name',
                                    
''                  => 'last_element_name_without_link'
                            
)   ); 
is it so complicated to build ?!... you tell in your explanation that our actual structure is hard to understand... i think that OOP is complicated, not pure php...
It could just as easily be straight functions. using a class is a simple means of keeping information without using global variables. (Classes does require PHP 4. Creating a class does not require that vB be OOP. It's just standard PHP.)

As for my navbar call, it would work fine. In the initial call we were supplied the page title and the page URL. We save three pieces of information in globals:

1) The file name, saved in say $EXT_filename. E.g., foo.php
2) The URL, in say $EXT_url. E.g., ./foo.php
3) The page title, in say $pagetitle.

A call to generate a two-level navbar then only requires the page title of the sub-page. Hence, the call:
PHP Code:
$navbar get_navbar('Sub-page name'); 
would contain code along these lines:
PHP Code:
construct_navbits(array($EXT_url => $pagetitle
                        
''       => 'Sub-page name'
                        
)); 
It is the most common sort of design consideration to hide the structure of data where feasible. We now have the details of building a navbar in exactly one place, called by extensions.
Reply With Quote
  #10  
Old 07-19-2004, 05:12 PM
nexialys
Guest
 
Posts: n/a
Default

any way to create such function would mean to create documentation for each function anyway... so why not simply build documentation on what already exists on vB?!...
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:29 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09472 seconds
  • Memory Usage 2,272KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (7)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (6)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete