Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
  #16  
Old 08 Jun 2007, 14:25
iVox's Avatar
iVox iVox is offline
 
Join Date: May 2007
Thumbs up

Compliments to Kerry-Anne for posting this.

I'm new to vB, but a long time PHP guru and forum admin (including uBB and phpBB).

After reviewing some of the replies here I wish to add that the information presented here is not simply copy/paste, and requires basic knowledge of PHP as well as the hook and template system of vB. I noticed some of the more experienced PHP developers making suggestings and fixes here. I concur and wish to expand on that.

I tried the procedure, and with a few minor corrections got it to work with less overhead simply by optimizing the commands (using advice posted earlier plus new advice from me):

I can sum it up in 4 easy steps (vb 3.6.7+):

1) Create a custom template, i.e. "mytemplate" for purposes of these instructions

Put in there "Hello World!" or any HTML so you know its working when it displays.

2) Add a new plugin, suggested name is "mytemplate_plugin" for easy reference

Pick hook as "global_start" if you want your template available in any other, or select the appropriate hook depending on where you want your template to display. The latter is the better choice if you are customizing a specific feature of vB.

Set plugin PHP code: $mytemplate_plugin = fetch_template('mytemplate_plugin_home');

3) Create another plugin, suggested name is: "Cached - mytemplate_plugin"

Pick hook as "cache_template" (located within vBulletin; General hooks in pulldown)

Set plugin PHP code: $globaltemplates[]='mytemplate_plugin';

4) In whatever template you wish (based on step 2) place the variable $mytemplate_plugin where you want your custom template to display. If successful, you'll see your "Hello World!" or your HTML as in step 1.

Folks, that's all there is to it. Notice no need for eval or array_merge.

This approach follows a simple naming convention that's easy to understand long after you implement and forget, and uses the most efficient PHP to get the job done, and will work perfectly without have to hack any native vB code. Yes, there are a million ways to skin a cat, this is one, but if you start doing alot of customization of this type, keeping the naming convention and optimizing the PHP code will save valuable server resources.

Compliments to all who posted.

Thanks for your time and if I missed something, please let me know.

-jim
Reply With Quote
  #17  
Old 13 Aug 2007, 20:27
jingman jingman is offline
 
Join Date: Aug 2007
Originally Posted by iVox View Post
In whatever template you wish...
The original post indicates that by attaching the "eval(.." plugin to the "parse_templates" hook, the template will be available to all other templates. I have not found that to be the case. I made a custom template, followed the above instructions precisely, and tried to use my custom template in FORUMDISPLAY and SHOWTHREAD - neither worked. It does work when I attach it to the "forumdisplay_complete" hook and the "showthread_complete" hook.

I want to be able to eval it in a single plugin, and make that template available to absolutely every other template - is there a way I can do that with a single hook?
Reply With Quote
  #18  
Old 09 Dec 2007, 10:32
loonytune15's Avatar
loonytune15 loonytune15 is offline
 
Join Date: Mar 2003
This is just what i have been looking for. I now have my affiliates on a seperate template from my forum home
__________________
Website -
Reply With Quote
  #19  
Old 26 Dec 2007, 00:04
haaba haaba is offline
 
Join Date: Jan 2007
Like Jingman stated - none of your solutions working if new template is added to FORUMDISPLAY, no matter of the hook location...

Any other thoughts?

Thanks
Reply With Quote
  #20  
Old 04 Jan 2008, 12:57
GameWizard's Avatar
GameWizard GameWizard is offline
 
Join Date: Apr 2004
Both Methods, original and that of iVox, seem to make my template appear, however they do not seem to parse the template. I have conditionals in my template, and they appear like ".(($post[field5]) ? (" on the page.

What can be done to fix this?
Reply With Quote
  #21  
Old 06 Jan 2008, 22:54
siliconfinance siliconfinance is offline
 
Join Date: Mar 2007
didn't work for me in 3.6.8
Reply With Quote
  #22  
Old 13 Jun 2008, 03:16
Jhonnyf's Avatar
Jhonnyf Jhonnyf is offline
 
Join Date: Dec 2007
then.. if I want to use a Custom Templare, I should make all that ceremony?
__________________
Hablo Espaņol para Soporte vBulletin
http://www.vbsoporte.com Foro Soporte vBulletin en Espaņol
Reply With Quote
  #23  
Old 15 Oct 2008, 22:08
sarahk's Avatar
sarahk sarahk is offline
 
Join Date: Jun 2004
Hi Kerry-Anne

My template will have a few variables generated for it. Which plugin carries the code to process them?
__________________
Property Management Services
Simple SEO Blog
Reply With Quote
  #24  
Old 06 Dec 2008, 03:29
Varsh's Avatar
Varsh Varsh is offline
 
Join Date: Aug 2006
Real name: Aaron Varshney
Originally Posted by Paul M View Post
You shouldn't be merging arrays for this, that's very wasteful of resources, just add to the array ;


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
This I got errors with due to an unexpected "[". If it worked then this would've been the ideal statement to use. Has anyone else had this issue on vB3.8x?
Reply With Quote
  #25  
Old 12 Jan 2009, 09:18
vietfancy's Avatar
vietfancy vietfancy is offline
 
Join Date: Mar 2005
it should be:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #26  
Old 15 Jan 2009, 21:30
Gulf Soul Gulf Soul is offline
 
Join Date: Jul 2007
Hello

I need a code which i forgot. ill try try to explain it.
for e.g.
If i wanted to add the line aaa under the line yyy in the footer or forumhome.
what could shall i use??

thanks
Reply With Quote
  #27  
Old 15 Mar 2009, 20:50
alexpaterson alexpaterson is offline
 
Join Date: Mar 2009
Hi, I'm in the same position,

I can't get my own variable content to show in the template.

Is there a template variable assignment statement , like in smarty ?


Alex
Reply With Quote
  #28  
Old 17 Mar 2009, 19:37
alexpaterson alexpaterson is offline
 
Join Date: Mar 2009
I got this working OK, I just declared the variable assignments in the global_start hook, so it was in scope for the entire board.

Thanks to Kerry-Anne for posting this, it saved me lots of time.
Reply With Quote
  #29  
Old 19 Mar 2009, 10:14
Come2Daddy Come2Daddy is offline
 
Join Date: May 2008
this is exactly, what I'v been wondering about

thanx a lot
Reply With Quote
  #30  
Old 21 Mar 2009, 12:24
Hitterman's Avatar
Hitterman Hitterman is offline
 
Join Date: May 2008
Location: Tutorialistic.net
Real name: Anand
This was really extrmely helpful. Thanks a lot.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 02:34.

Layout Options | Width: Wide Color: