Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
  #16  
Old 18 Nov 2009, 02:11
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Originally Posted by Shadab View Post
Not a problem!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Another note; on multidimensional arrays...
Suppose you have a nested / multidimensional array set, like:


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

You can chain the array 'keys' like in the second example:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
I have extended my example to provide for multidimensional arrays. Thanks for pointing this out
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #17  
Old 18 Nov 2009, 10:52
testebr testebr is offline
 
Join Date: Jan 2004
Can you give us a simple example of how to insert code to footer without fech from other template?
Reply With Quote
  #18  
Old 18 Nov 2009, 12:00
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Try to insert $my_insertvar

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

and call {vb:raw my_insertvar}.
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #19  
Old 18 Nov 2009, 19:17
testebr testebr is offline
 
Join Date: Jan 2004
hi cellarius, I don't want to call the var manually, I just want to inject code like my old example for 3.x:

hook: parse_templates

code: $vbulletin->templatecache['footer'] .= 'text added to footer';

Capiche?
Reply With Quote
  #20  
Old 18 Nov 2009, 19:23
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Nope, that does not work. You would need to do a str_replace on something you know is there.
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de

Last edited by cellarius; 18 Nov 2009 at 19:50.
Reply With Quote
  #21  
Old 18 Nov 2009, 20:54
testebr testebr is offline
 
Join Date: Jan 2004
I figure out how to solve it:

hook: process_templates_complete

code: $footer .= 'text added to footer';

No idea if was the best solution, but that worked very well.
Reply With Quote
  #22  
Old 18 Nov 2009, 21:13
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Originally Posted by testebr View Post
hook: process_templates_complete

code: $footer .= 'text added to footer';
Indeed, you can manipulate the already rendered template doing this. Also possible is str_replace:

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

Although this is a somewhat bad example, since "Terms of Service" is a phrase, of course, and will vary by language. Always make sure you use strings for replacement that are always present.

terms1.jpg

Using str_replace, you can also add stuff in the middle of the template like so:

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

terms2.jpg
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de

Last edited by cellarius; 18 Nov 2009 at 21:18.
Reply With Quote
  #23  
Old 19 Nov 2009, 20:26
David Regimbal David Regimbal is offline
 
Join Date: May 2009
Hi,

I'm trying to add something that requires PHP under the navbar. Back in vb 3.8.x I just used plugins for this. But, I'm not sure which hook to use if I want to display something under the navbar.
Reply With Quote
  #24  
Old 20 Nov 2009, 11:19
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
@David: This is not related to the topic of this article. You should open your own thread on this..


Also, I just added the bonus track about template caching.
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #25  
Old 20 Nov 2009, 16:02
ragtek's Avatar
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Originally Posted by cellarius View Post
@David: This is not related to the topic of this article. You should open your own thread on this..


Also, I just added the bonus track about template caching.
Sure?
It's $cache[] = 'xxx'; and not $globaltemplate now
__________________
my addons: http://ragtek.github.com
Reply With Quote
  #26  
Old 20 Nov 2009, 16:10
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Real name: Sven
Ah, damn, of course you're right. I had my example code for vB3 and the one I was about to change for vB4 side by side and then obviously copied/pasted the wrong one. Stupid me
__________________
Please note that there will be no further updates to my addons, especially they will not be upgraded for vB5. I'm leaving vB, since IB choose to go the banana-way yet again.

http://www.roma-antiqua.de
Reply With Quote
  #27  
Old 20 Nov 2009, 16:19
ragtek's Avatar
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Originally Posted by cellarius View Post
Ah, damn, of course you're right. I had my example code for vB3 and the one I was about to change for vB4 side by side and then obviously copied/pasted the wrong one. Stupid me
Yea, i know.
I made the mistake in all my add-ons on porting them to vB4
__________________
my addons: http://ragtek.github.com
Reply With Quote
  #28  
Old 22 Nov 2009, 01:15
EidolonAH EidolonAH is offline
 
Join Date: May 2009
Real name: Eidolon
Thanks for the "cache your templates" info, I made use of this info after making my own Terms of Service and Privacy custom pages, very helpful, thank you.
Reply With Quote
  #29  
Old 27 Nov 2009, 22:13
Zaiaku's Avatar
Zaiaku Zaiaku is offline
 
Join Date: Jul 2007
Originally Posted by cellarius View Post
Indeed, you can manipulate the already rendered template doing this. Also possible is str_replace:

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

Although this is a somewhat bad example, since "Terms of Service" is a phrase, of course, and will vary by language. Always make sure you use strings for replacement that are always present.

Attachment 106372

Using str_replace, you can also add stuff in the middle of the template like so:

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

Also can this be used on variables? ex: {vb:raw variable}

Attachment 106374
OK I'm trying to do the same thing but on showthread, from this example is $footer a var already being used of is this an additional variable made up int he plugin? Right now I'm using $vbulletin->templatecache['postbit'] with the <hookname>process_templates_complete, should this something diffrent?

<hookname>showthread_query</hookname>
$vbulletin->templatecache['postbit'] = str_replace($find, $replace, $vbulletin->templatecache['postbit']);

Also can this be used on variables? ex: {vb:raw variable}
__________________
Live everyday as if it was your last, because one day it just may be.

Last edited by Zaiaku; 27 Nov 2009 at 22:43.
Reply With Quote
  #30  
Old 01 Dec 2009, 19:42
jlevi jlevi is offline
 
Join Date: Sep 2009
This isn't working for me. I'm probably doing something wrong, but at the moment I have a custom php page (I created following another tutorial elsewhere) that is calling a custom template.

The code for the php page:

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


And the HTML template (called TESTPAGE):

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

And the plugin in global_start:

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


Where have I gone wrong? I've spent a good half an hour going through the tutorial and trying various things but can't seem to get it working. It always makes the whole site blank, but if I call another template (e.g. contactus instead of TESTPAGE) it works fine, so the problem seems to lie with the plugin.

Any help greatly appreciated - thanks in advance

Last edited by jlevi; 01 Dec 2009 at 20:12.
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 11:12.

Layout Options | Width: Wide Color: