Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
  #31  
Old 31 Mar 2009, 20:45
tipoboy's Avatar
tipoboy tipoboy is offline
 
Join Date: Dec 2005
Real name: scotty
this help a lot thanks
__________________
Available for help just PM details!
Reply With Quote
  #32  
Old 05 Apr 2009, 09:29
kronnos kronnos is offline
 
Join Date: Apr 2006
Can these instructions be take a little further so the following can be done. When making a template, can that template include a variable that can be entered somewhere in the admincp? For example I want the temple to show "THIS". The only thing is I do not want to go to the template all the time and edit "THIS". Can I make a little addition to the admin CP so I can specify what "THIS" is?

Also, can all these template hooks, templates and all related to me showing "THIS" be saved in one package like a mod is so It can be uploaded to another forum easily?

Thanks

Last edited by kronnos; 06 Apr 2009 at 19:48.
Reply With Quote
  #33  
Old 12 Jun 2009, 13:01
IdanB's Avatar
IdanB IdanB is offline
 
Join Date: May 2009
Real name: Idan Bismut
Thanks for this guide. Indeed good tutorial.

I've crossed into weird thing though (vbulletin version 3.8.2), maybe someone came aross it & can give few tips on what i could have missed - i can't get rid of "uncached template" warning eventhough I have plugin on "cache_templates" adding it to $globaltemplates[], so not sure what am i missing.
__________________
vBHackers.com - vBulletin Modification Community

Last edited by IdanB; 12 Jun 2009 at 13:06.
Reply With Quote
  #34  
Old 12 Jun 2009, 13:02
ragtek's Avatar
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
what hook are you using and whats the plugincode?
nobody can help you without that infos
__________________
my addons: http://ragtek.github.com
Reply With Quote
  #35  
Old 12 Jun 2009, 13:11
IdanB's Avatar
IdanB IdanB is offline
 
Join Date: May 2009
Real name: Idan Bismut
2 plugins:
1] location: "global_start"
name: "alt_lp_template"
with followign code:

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

2] location: "cache_templates"
name: "Tempalte Cache"
with followign code:

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

and on forum i keep getting "uncached template" warning for "alternate_view".
Note this template was added to master style.

EDIT: what's more weird, i know it's cached, as later on i can access it from $vbulletin->templatecache['alternate_view']
__________________
vBHackers.com - vBulletin Modification Community

Last edited by IdanB; 12 Jun 2009 at 13:14. Reason: more
Reply With Quote
  #36  
Old 12 Jun 2009, 13:38
ragtek's Avatar
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
You have to make it this way:
to cache it:

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

and save the content from the template into a variable:

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

Now you can use $varname
__________________
my addons: http://ragtek.github.com
Reply With Quote
  #37  
Old 12 Jun 2009, 14:04
IdanB's Avatar
IdanB IdanB is offline
 
Join Date: May 2009
Real name: Idan Bismut
thanks, that solved it, wrote under cache name the var name instead... silly me
__________________
vBHackers.com - vBulletin Modification Community
Reply With Quote
  #38  
Old 14 Jun 2009, 08:22
street tactic street tactic is offline
 
Join Date: Aug 2007
Excellent Post. Including my Javascript php file worked in parse_templates rather than cache_templates.
__________________
FlaForum.com :: Connecting Florida's Cities
Reply With Quote
  #39  
Old 25 Jun 2009, 01:15
warrentr2 warrentr2 is offline
 
Join Date: May 2009
Hi Everyone,
Lets say I set some variable:

$domain = "testsub.domain.com";

from within a global_start plugin. SHOULD I be able to use this in any template??

I seem to have very mixed results. Some pages with links that contain this domain are just broken...

Any ideas?
Reply With Quote
  #40  
Old 24 Jul 2009, 09:28
ragtek's Avatar
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
No, some templates are called from functions/methods, so you would have to create plugins to make your variable in the scope there.

You could write your variable into $vbulletin['myvarname'] = 'foo.bar.tld'; because $vbulletin should be everywhere in the scope.


I hope you can understand what i mean
__________________
my addons: http://ragtek.github.com
Reply With Quote
  #41  
Old 04 Aug 2009, 15:02
Omar Al-Ansari Omar Al-Ansari is offline
 
Join Date: Jun 2009
Hi all,

I have tried this and it works good however it only works within vb if I try to use the same template in vba it does not?

any help will be appreciated

Product: vBulletin
Hook Location: global_start


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

Reply With Quote
  #42  
Old 04 Aug 2009, 15:04
ragtek's Avatar
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
global_start is too early
try global_setup_complete instead
__________________
my addons: http://ragtek.github.com
Reply With Quote
  #43  
Old 04 Aug 2009, 19:34
Omar Al-Ansari Omar Al-Ansari is offline
 
Join Date: Jun 2009
Originally Posted by ragtek View Post
global_start is too early
try global_setup_complete instead
Hey ragtek,

Still not working

if i use this $adv_portal_rotating_articles in forumhome or any vb page it works fine

but not in vba

--------------- Added 04 Aug 2009 at 19:42 ---------------

Originally Posted by Omar Al-Ansari View Post
Hey ragtek,

Still not working

if i use this $adv_portal_rotating_articles in forumhome or any vb page it works fine

but not in vba
ok nevermind I got it working ..

it should be defined through CMPS CP

Last edited by Omar Al-Ansari; 04 Aug 2009 at 19:42. Reason: Auto-Merged DoublePost
Reply With Quote
  #44  
Old 04 Aug 2009, 19:52
ragtek's Avatar
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
or also $GLOBALS[adv_portal_rotating_articles] should also work
__________________
my addons: http://ragtek.github.com
Reply With Quote
  #45  
Old 12 Oct 2009, 05:16
Dax IX Dax IX is offline
 
Join Date: Jul 2005
Real name: Emily
Originally Posted by iVox View Post
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
I'm a little confused. The code in this post makes very little sense to me. Is it still valid?

Originally Posted by IdanB View Post
2 plugins:
1] location: "global_start"
name: "alt_lp_template"
with followign code:

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

2] location: "cache_templates"
name: "Tempalte Cache"
with followign code:

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

and on forum i keep getting "uncached template" warning for "alternate_view".
Note this template was added to master style.

EDIT: what's more weird, i know it's cached, as later on i can access it from $vbulletin->templatecache['alternate_view']
Originally Posted by ragtek View Post
You have to make it this way:
to cache it:

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

and save the content from the template into a variable:

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

Now you can use $varname
Originally Posted by IdanB View Post
thanks, that solved it, wrote under cache name the var name instead... silly me
Can you explain exactly what you did to fix this? Did you still need the eval() code?

I can get the contents of my test template to show, but it escapes my quotes within my HTML, so no styling is applied.

--------------- Added 12 Oct 2009 at 12:11 ---------------

Here's the code that I used:

2 plugins:
1] location: "global_start"
name: "test_template_plugin"
with followign code:

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

2] location: "cache_templates"
name: "Cached - test_template"
with followign code:

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

Like I said, I can see my content, but quotes are escaped, so no styling is applied.

my template contents (test_template) (VERY simple)


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

What am I doing wrong?

--------------- Added 13 Oct 2009 at 03:14 ---------------

I was trying to follow the advice of the first post that I quoted, and it just didn't work.

I changed the first plugin to include the eval() code for my variable, and it worked properly.

Sorry for the bother.
__________________
Just a placeholder.

Last edited by Dax IX; 13 Oct 2009 at 03:14. Reason: Auto-Merged DoublePost
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


New To Site? Need Help?

All times are GMT. The time now is 00:50.

Layout Options | Width: Wide Color: