Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-24-2015, 01:34 PM
HootinHoller HootinHoller is offline
 
Join Date: Dec 2015
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default New to vBulletin and PHP - what is the lifecycle of a request?

Where are templates stored, etc. I've found docs on the pieces-parts, but haven't found how they hang together. I'm on 4.2.3

I typically work on JEE/JSP-faces tech stack. I'm having trouble seeing the big picture about how mods hang together. I understand hooks and callbacks. But how do I find the hook I need. It feels like I'm missing something obvious.

I haven't found a programming primer that describes the lifecycle of vBulletin.

Firefox, showed me the page structure below when I clicked 'New Posts':

Code:
...
<div class="body_wrapper">
    <div id="breadcrumb" class="breadcrumb">
    <form id="notices" class="notices" method="post" action="profile.php?do=dismissnotice">
    <div id="pagetitle">
    <div id="above_searchresults" class="floatcontainer">
    <form id="search_inlinemod_form" method="post" action="inlinemod.php">
        <input type="hidden" value="/search.php?searchid=2659" name="url">
        <input type="hidden" value="" name="s">
        <input type="hidden" value="1450912181-94f517a9b74949b6bb0c5b7bec54ff4d7b84b487" name="securitytoken">
        <input type="hidden" value="" name="forumid">
        <div id="thread" class="block searchresults">
            <h2 class="searchlisthead">
            <div class="blockbody">
                <ol id="searchbits" class="searchbits" start="1">
                    <li id="thread_854" class="imodselector threadbit dot new title_editable" title="testing one two">
                </ol>
            </div>
...
What I'm trying to do is fetch a results list of postings like the 'New Posts' and replace the blockbody div held in the thread div.

How do I track down the hook I need? How do I add it to the navigation tree?

Is there a developer primer? My google-fu has failed me.
Reply With Quote
  #2  
Old 12-24-2015, 02:10 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What I would do, is look at the HTML for something I think will be unique to that template, such as:

HTML Code:
<h2 class="searchlisthead">
Then I would follow:

AdminCP -> Styles & Templates -> Search in Templates

Then in the "Search for Text" field paste:

<h2 class="searchlisthead">

and click "Find"

You should see the "search_resultlist" template in the result. Double-click it to open the template, and then you will see your search text in the "Search in Template" field, so click the "Find" button, and you will be taken to where the search text is located within the template. Several lines below that, you will find the block:

HTML Code:
		<div class="blockbody">
			<vb:if condition="$displayCommon">
				<h3 class="blocksubhead">{vb:rawphrase words_very_common}: $displayCommon</h3>
			</vb:if>
			<vb:if condition="$show['results']">
				<ol id="searchbits" start="1" class="searchbits">
					{vb:raw searchbits}
				</ol>
				
			<vb:else />
				<div class="blockrow">{vb:rawphrase no_unread_threads}</div>
			</vb:if>
		</div>
Then you can edit the HTML as you desire, and click "Save" or "Save and Reload." Then go to your forum, and see if the changes you made work as you want.
Reply With Quote
Благодарность от:
andy_mcguire
  #3  
Old 12-24-2015, 03:44 PM
HootinHoller HootinHoller is offline
 
Join Date: Dec 2015
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarkFL View Post
What I would do, is look at the HTML for something I think will be unique to that template, such as:

Then you can edit the HTML as you desire, and click "Save" or "Save and Reload." Then go to your forum, and see if the changes you made work as you want.
Well I was being a little more ambitious than that. In following the steps in your post, I dropped into debug mode, created a product, copied the template we use found with your technique, and made a new one for the product.

I don't think I need options yet, and did not add a settings group.

I added some plugin code for the product and template and hooked it to the search_start hook.

I tried exporting it, but I only get a pretty much empty xml file in a download dialog.

I see no files to be bundled on the filesystem of the server.

I also have no clue as to how to add the product into the navigation, I would like to put it into the what's new tab submenu.

I really appreciate your time Mark, thank you.
Reply With Quote
  #4  
Old 12-24-2015, 03:49 PM
Dave Dave is offline
 
Join Date: May 2010
Posts: 2,583
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In order to find the right hook which you need, you first check the PHP script the page uses which you want to modify. Then open that PHP file and go to the part where PHP does the logic for that part, you can usually tell by the GET or POST parameters that the page uses.

Then simply look for a hook definition around that location. Note that not every location has a hook so there's a chance you may not be able to do what you want without modifying vBulletin's files itself.
Reply With Quote
  #5  
Old 12-24-2015, 05:13 PM
HootinHoller HootinHoller is offline
 
Join Date: Dec 2015
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by HootinHoller View Post
I dropped into debug mode, created a product, copied the template we use found with your technique, and made a new one for the product.

I don't think I need options yet, and did not add a settings group.

I added some plugin code for the product and template and hooked it to the search_start hook.

I tried exporting it, but I only get a pretty much empty xml file in a download dialog.

I see no files to be bundled on the filesystem of the server.

I also have no clue as to how to add the product into the navigation, I would like to put it into the what's new tab submenu.

I really appreciate your time Mark, thank you.
After fixing some product references in the plugin and template, they now appear in my exported product xml file.

The remaining question I have now is where is the navigation section of the product xml file stored or generated from?
Reply With Quote
  #6  
Old 12-24-2015, 05:17 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What do you mean by "navigation section of the product xml file?"
Reply With Quote
  #7  
Old 12-24-2015, 05:34 PM
HootinHoller HootinHoller is offline
 
Join Date: Dec 2015
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by HootinHoller View Post
The remaining question I have now is where is the navigation section of the product xml file stored or generated from?
Found it. Settings -> Navigation Manager

Thanks Again for everyone's help.

--------------- Added [DATE]1450986040[/DATE] at [TIME]1450986040[/TIME] ---------------

Quote:
Originally Posted by MarkFL View Post
What do you mean by "navigation section of the product xml file?"
When I export the product, I only get one file. An xml file that contains the code for the templates, plugins, and navigation in addition to other things.

In that file is a navigation section that is driven by entries in Settings -> Navigation Manager

Thanks again.
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 04:28 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.05172 seconds
  • Memory Usage 2,240KB
  • 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
  • (1)bbcode_code
  • (2)bbcode_html
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (1)post_thanks_box_bit
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete