vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   New to vBulletin and PHP - what is the lifecycle of a request? (https://vborg.vbsupport.ru/showthread.php?t=321180)

HootinHoller 12-24-2015 01:34 PM

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.

MarkFL 12-24-2015 02:10 PM

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. :)

HootinHoller 12-24-2015 03:44 PM

Quote:

Originally Posted by MarkFL (Post 2561108)
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.

Dave 12-24-2015 03:49 PM

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.

HootinHoller 12-24-2015 05:13 PM

Quote:

Originally Posted by HootinHoller (Post 2561112)
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?

MarkFL 12-24-2015 05:17 PM

What do you mean by "navigation section of the product xml file?"

HootinHoller 12-24-2015 05:34 PM

Quote:

Originally Posted by HootinHoller (Post 2561120)
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 (Post 2561122)
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.


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

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01696 seconds
  • Memory Usage 1,745KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_html_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete