Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 16 May 2012, 11:54
Rich's Avatar
Rich Rich is offline
 
Join Date: Mar 2004
Real name: Rich
Insert Template Into Existing Template

I am so frustrated with the template system. I loved the days when $variable was used. I am completely lost on this new way of inserting templates into existing templates. I have read the article on variables and don't seem to be understanding it because it doesn't seem to be working for me.

All I want to do is add my ad code to the top of the forumdispaly template via calling another template.

Lets say the template were called "myadtemplate". How the heck do I get it to show at the top of the forumdisplay template below the navbar? I simply can't get it to display. I am trying to do this via plugins. I had no issues in the past when I could simply set the variable as $variable and eval the template.

Thanks for any help you can offer.
__________________
Rich

Swapped 2 sites to Xenforo since vBulletin left me hanging for so long with the vB4 - PHP5 compatibility issues. Running PHP 5.5 with Xenforo with NO issues.
Reply With Quote
  #2  
Old 16 May 2012, 12:45
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Plugin using hook location forumdisplay_complete:


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


Then edit your forumdisplay template and insert {vb:raw myadtemplate}.

Last edited by kh99; 16 May 2012 at 13:44. Reason: changed template name to all caps
Reply With Quote
  #3  
Old 16 May 2012, 13:26
Rich's Avatar
Rich Rich is offline
 
Join Date: Mar 2004
Real name: Rich
I appreciate the help kh99 but I attempted to use that code with no luck. I had used various deviations of that same code when I tried before as well.
__________________
Rich

Swapped 2 sites to Xenforo since vBulletin left me hanging for so long with the vB4 - PHP5 compatibility issues. Running PHP 5.5 with Xenforo with NO issues.
Reply With Quote
  #4  
Old 16 May 2012, 13:45
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
You're right, it doesn't work - the template name FORUMDISPLAY should be in all caps. I fixed the code above (which now seems to work for me).
Reply With Quote
  #5  
Old 16 May 2012, 17:04
Rich's Avatar
Rich Rich is offline
 
Join Date: Mar 2004
Real name: Rich
Thank you again. I can't believe I played with it for as long as I did and the entire time it was capitalization causing me problems. At least i had the code right at some point, lol.

That code works as expected but I am not certain I can actually use it now. lol It called my template as expected but when I added my conditionals based on forumid I didn't get any output. The conditional works fine within the forumdisplay template itself so I am guessing I need to either alter the condition since it is called from another template or I need to append the plugin to another hook.

This is the conditional:


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

That works great in the forumdisplay tem[plate but ceases to work when it is called via the custom template. since I have blocks of ads being called based on foum ids I wanted to call them outside the forumdisplay template because of how large the template will be. If it isn't one thing, its another! lol
__________________
Rich

Swapped 2 sites to Xenforo since vBulletin left me hanging for so long with the vB4 - PHP5 compatibility issues. Running PHP 5.5 with Xenforo with NO issues.
Reply With Quote
  #6  
Old 16 May 2012, 20:59
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
You need to register $foruminfo for use in your custom template, like this:


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

Reply With Quote
  #7  
Old 17 May 2012, 13:10
Rich's Avatar
Rich Rich is offline
 
Join Date: Mar 2004
Real name: Rich
Thanks kevin but that returns the following error.

Fatal error: Call to a member function register() on a non-object in /home/site/public_html/forumdisplay.php(1198) : eval()'d code on line 51

This is the exact plugin code I am using:


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

It is being executed at the forumdusplay_complete hook.

I am really starting to dislike how they changed things with vB.
__________________
Rich

Swapped 2 sites to Xenforo since vBulletin left me hanging for so long with the vB4 - PHP5 compatibility issues. Running PHP 5.5 with Xenforo with NO issues.
Reply With Quote
  #8  
Old 17 May 2012, 14:28
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Hmm...I don't see why you'd get that error. When I first posted the code I had a typo in it where that register line had $template instead of $templater, but I fixed it and the code you posted doesn't have that. Is it possible you used my code before it was fixed (because you probably got emailed the original version)? I tried what you posted above and it doesn't give an error even though I don't even have that template.

I know what you mean, I've been a programmer pretty much my entire life and I found it frustrating at first. It makes a lot of sense after a while, but unfortunately that doesn't help people who just want to get something done.
Reply With Quote
  #9  
Old 17 May 2012, 17:59
Rich's Avatar
Rich Rich is offline
 
Join Date: Mar 2004
Real name: Rich
It does appear that I may have run it with the unedited version. I copy and pasted the code you wrote and just swapped the myadtemplate with my actual stuff since thats all I did the first time. It is up and running. Thank you very much.
__________________
Rich

Swapped 2 sites to Xenforo since vBulletin left me hanging for so long with the vB4 - PHP5 compatibility issues. Running PHP 5.5 with Xenforo with NO issues.
Reply With Quote
Reply



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

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 10:49.

Layout Options | Width: Wide Color: