PDA

View Full Version : New to vBulletin and PHP - what is the lifecycle of a request?


HootinHoller
12-24-2015, 01:34 PM
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':


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

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

<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
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, (https://vborg.vbsupport.ru/showthread.php?t=318840&highlight=make+plugins) 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
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
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 1450986040 at 1450986040 ---------------

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.