Quote:
Good morning, er, evening cellarius! :) |
Quote:
Quote:
|
Please i need a little of help, i can't get this working..!!
I created a template called: contenedor_de_foro So i only write "Hi" inside it. I want to get "Hi" in my Header template so i made a plugin on global_start and put: Code:
$templater = vB_Template::create('contenedor_de_foro'); |
Do we need to register stylevars as well?
|
Hi cellarius,
Thanks for the great article :) I running into a bit of a problem, I can see the solution right in front of me but for some reason can't quite get it. Bassically I'm making a plugin so I have the breadcrumbs in the header. This is what I've got so far setup on the parse_templates hook: Code:
$templater = vB_Template::create('breadcrumbs'); Thanks |
Thank you cellarius for this!
I've even printed this out and read this even while sitting on the throne quite a few times. I got some of the options working for a custom about us page. The option to - Output template directly - custom pages works just great for VB4. The option to - Save into a variable for later use in custom template works only after noticing an error in this code. In VB4 This resulted in a blank white page. PHP Code:
PHP Code:
Then option to - Save into an array and preregister to use in an existing/stock template. Unfortunately I was unable to get this working. I could not locate the template hook "forumhome_wgo_pos2" in VB4. As for Caching Templates, I didn't see any templates in red on because it this doesn't work on server that is ran locally. I've managed to get this working on an actual server. EDIT: I does work locally in my testing environment, I added... PHP Code:
Thanks for this write up, It helped me quite a bit in understanding more and more about VB. |
Quote:
Quote:
Quote:
|
Quote:
Quote:
At first I was using your example to familiarize myself on how things work. PHP Code:
did not match second argument in the register function. $templater->register('my_template_rendered', $my_template_rendered); So I changed this: $templater->register('my_template_rendered', $my_template_rendered); to: $templater->register('my_template_rendered', $mytemplate_rendered); And everything worked fine. Quote:
My guess is that I'm not fully understanding this particular option. I've tried this on a clean install and was unable to locate this hook or maybe I'm just looking in the wrong place for it. Additional guidance will very much be appreciated if you don't mind? As for your last statement, I didn't not combine all of these options into one. I created separate custom pages for each option just to see the results of each option listed. The only one I had difficult understanding was the template hook option. |
Alright. I can get it to display just straight templates, that used to use just eval('print_output')...........
How would I go about displaying this: Code:
eval('$userslist .= ", ' . fetch_template('userslist_bit') . '";'); |
Quote:
Code:
$newTemplate = vB_Template::create('userslist_bit'); |
I still cannot figure out how in the heck to work this new template system.
Code:
eval('$awarduserslist .= ", ' . fetch_template('awards_awardusers_bit') . '";'); However Code:
$displayTemplate = vB_Template::create('awards_awardusers_bit'); |
Thanks for this guide, at the beginning I was totally confused about this new system.
On the other hand, is there a system to preregister a var in all templates with a single call? |
Thanks for the guide :)
|
Quote:
Absolutly a great introduction how things now working on VB4. It answere`s many questions to me now. I just wanne thank you cellarius for this. btw. many thanks to Lynne who also allways help out. i`m absolutly new to stuff like "vb" or "php" but with your "helping hand`s" alot of work is possible to do for me too. Sorry about my englisch, its not "my one" :) Thanks again an enjoy the hollydays ...... if there some ........ |
I have question:
How to change content of existing template inside of plugin? I'm remaking my mod for vB4. I'm adding there flags to header of footer. In vB3 version I simply change insides of template using templatecache. I.e.: PHP Code:
How to change this line of code to make it working in vB4? EDIT: Ok - I already found it here :) Now check if its working :P --------------- Added [DATE]1262746169[/DATE] at [TIME]1262746169[/TIME] --------------- Other question: In vB3 my mod have possibility to put additional data in custom place - so user just manually adds variable into required template and he has flags where he put it. How to do this in vB4 where variables have to be preregistered????... --------------- Added [DATE]1262746545[/DATE] at [TIME]1262746545[/TIME] --------------- Quote:
Also this solution is working on already parsed template - I need fresh one, not parsed yet. Anyone have idea how to do that? EDIT Ok I have it :) need to use hook parse_templates |
Awesome guide. It has helped me move forward a bit, but I still don't have it all down yet. If anyone has this down pat, I'd be interested in some more tutorials that show old 3.x code and then below shows the 4.x code. This way I can test myself and see how well I have it down.
In the meantime though, is the new rendering needed for redirects? For example: Code:
$vbulletin->url = "misc.php?do=editform&fid=$fid"; Code:
$templater = vB_Template::create('redirect_insertform'); |
No, standard redirects and errors still work the old way. If you want to know something like that, just look one up in the original vB4 php files.
|
I have a template that I need to insert into multiple pre-existing templates (I add some additional graphics/formatting to the header and footer of most tables ... and my CSS skills aren't good enough to achieve what I'm trying to do through CSS alone, so I need to add old HTML table coding). I do it this way so that if I want to make changes, I don't have to change lots of different templates. After a bit of struggling, I have managed to get the following code running.
Code:
$templater = vB_Template::create('layout_start'); I have two questions. Is there any way to preRegister for more than one pre-existing template (or a global registration), or do I have to create Plugins for every page I want to add this to (*groan*)? And what is the best hook to have this on. I am currently using 'parse_templates'. The other unusual thing I'm finding happening is if I include my template in postbit_legacy, it will show on the first post, but not on the posts after that. Thanks in advance... |
Quote:
Code:
$templater = vB_Template::create('layout_start'); Code:
$templater = vB_Template::create('layout_start'); Quote:
|
...
|
nvm figured it out
|
I have read all posts and dont know how to call 3 templates in one page.
I have this code: PHP Code:
|
I would fetch it before...
PHP Code:
F. |
Thanks for this, hopefully i'll be able to know what to do.
|
does anyone know how i can insert this into a template using plugin manager
to be placed in header Code:
|
n/m I figured I was missing $templater->render();
|
I am not much of a coder at all, and hence need your help big time.
I want to call a simple php file to be placed just under the navbar. So, I created a plugin: Product: vBulletin Title: Insert Simple PHP Execution order: 5 (it was default) Hook Location: global_start PHP code: Code:
ob_start(); Now, I went to the NAVBAR template and inserted Code:
{vb:raw insert_simple_php} Code:
{vb:raw ad_location.global_below_navbar} * Where does the 'register/pre-register' come? * What is the exact change I need to make here? Thanks for your help! |
Great article!
but i have a problem. I have a template which i want to show inside another template, and it seems to work with every template except for the header. This is the plugin i used: PHP Code:
of course i have a template called TopPanel which i created, and it works great in vbcms_page for example but not in header. Do you have an idea why is that? Thanks in advance. |
As the name suggests, the hook you use is called when vB-internal template processing is already completed. No use in preregistering templates then anymore. Since that hook did not exist in 4.0.1 as far as I can see, you're using 4.0.2. Another hook that got added in 4.02 is template_register_var, and that would be the right one to use.
|
Quote:
PHP Code:
|
cellarius & moonray - you are both stars!!! :D
Thanks you! Al |
FINAL WORKING CODE:
Product: vBulletin Title: Insert Simple PHP Execution order: 5 Hook Location: global_start PHP code: Code:
ob_start(); Now, go to the NAVBAR template and insert Code:
{vb:raw insert_simple_php} Code:
{vb:raw ad_location.global_below_navbar} |
I'm hoping someone can help me.. I'm having trouble displaying Openx Ads in various locations. For example in the header template.
This is the php code that Openx generates: PHP Code:
PHP Code:
|
No comments on my last post?
|
This is what I'm using.
PHP Code:
|
Thank you very much WAJones!! That works great! :D :up: :up: :up:
|
Guys help me to update this hack to vB 4
https://vborg.vbsupport.ru/misc.php?...t_post_only_37 I cant show the message "register...." to guests: PHP Code:
|
Great article!
I have a question. In vB3, you could do this: PHP Code:
|
Quote:
|
I'm trying to append some text to the end of the footer.. in a plugin.. but I'm totally lost.
How do I get the footer out of the cache to append some text to it? |
All times are GMT. The time now is 11:42 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 | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|