The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Find in template
Hi Guys,
I am just starting out with php programming... What code do I need to find a bit of template code and replace it with something else in vB? I am trying to make a product where it finds xx template code, and replaces it with yy. I have been trying ever so hard, but I can't quite get it. Cheers LTC |
#2
|
|||
|
|||
Maybe this: [How-To] Using Plugins for Automatic Template Edits ?
|
#3
|
||||
|
||||
Opserty - If he's just starting, the plugin method for template changes is probably a littler deep! Even experienced vB coders have problems with that.
TC - The first issue is finding the right template you need to modify. You can't generally just search for text using the ACP template search, because pretty much none of the text you see on the actual page is in the template, as it's all dynamically included with phrases and runtime variables. So the first thing to do is enable the "Add Template Name in HTML Comments" option in the ACP, under vBulletin General Options. This will embed comments in each page showing where every template stops and starts. So you can view source of the page you are working on, and see what part of the page is in which template. Then you can start looking at the template you need in the ACP template editor. If you are running in debug mode, you will have access to the Master Style. DO NOT EDIT ANYTHING IN THE MASTER STYLE! Use the Default style, or create a test style. I can pretty much guarrantee your first look at some template code will confuse the heck out of you. Don't Panic. It's all pretty straight forward. It's usually obvious what each $vhphase[] is about, and if not you can look it up in the Phrase Manager. So it's usually pretty simple working out where you need to make your edits. When you do make an edit, I suggest you get in the habit of wrapping comments around stuff you change, like ... <!-- start edit - changed this to do whatever --> ... the template code ... <!-- end edit --> If you always use the same words, like "start edit", it makes it a lot easier to find your edits in the future, which comes in real handy when you upgrade vB. -- hugh |
#4
|
|||
|
|||
Oh yes, thank you for that Cheese. I actually know how to edit templates etc...But what I am trying to do is create my first product. I want to find XX piece of code, and replace it with YY piece of code when someone installs the product. Any suggestions ?
|
#5
|
|||
|
|||
If it involves customising a default vBulletin template it is best just to provide instructions to the User as to what to do. Most people will already have other mods installed and customised styles (especially if they are downloading mods), if you start messing around with their styles automatically then they are going to get annoyed when their vBulletin falls apart.
Just provide instructions to modify existing templates and if you are making new templates insert them into the MASTER STYLE and associate the template's product with your product. |
#6
|
||||
|
||||
Or better yet use the Advanced Product Manager, which makes the basic steps of creating a product and adding templates, plugins, phrases, settings, etc. a snap. Works on 3.6 and 3.7.
Doesn't help with the vB template edits, but takes a lot of the pain out of everything else. -- hugh |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|