The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
newthread -- template hooking before message area
Hey all.
I have finally finished my product and am trying to make sure that I am following all of the vBulletin standards prior to release. I have a template that I want to insert prior to the "messagearea" in the "newthread" template. Here is the code I have thus far: Code:
$newTemplate = vB_Template::create('qma'); //my custom template $rendered = $newTemplate->render(); $find = "{vb:raw messagearea}"; $vbulletin->templatecache['newthread'] = str_replace($find, $rendered . "\n" . $find, $vbulletin->templatecache['newthread']); ' . $message . ' So, I tried searching for that as well, and no luck. Of course, there is no pre-defined vBulletin hook in this position, so this is the only way to do it that I know of without doing actual template edits with the newthread template, which I definitely want to stay away from. Any help on what to use for the "$find" condition would be greatly appreciated! |
#2
|
||||
|
||||
What hook location are you using? And you tried just using $find = $message; ?
|
#3
|
|||
|
|||
I am trying to put my template ('qma') right before the message area. I want it to look like this:
http://img408.imageshack.us/i/armoryposition.png/ Right now, I actually have the HTML block of code in the 'newthread' template as I cannot figure out how to get it into that position without doing it that way. I tried searching for the message are with the following code: Code:
global $vbulletin; $is_qma_enabled = false; if($vbulletin->options['qma_onoff'] == 1){ $forums_enabled = explode(',', $vbulletin->options['qma_forumid']); $is_qma_enabled = in_array($vbulletin->GPC['forumid'], $forums_enabled); } if($is_qma_enabled == true){ $show['qma_enabled'] = true; $newTemplate = vB_Template::create('qma'); $rendered = str_replace( "<", "<", $newTemplate->render() ); $find = "messagearea"; $vbulletin->templatecache['newthread'] = str_replace("messagearea", "", $vbulletin->templatecache['newthread']); $vbulletin->templatecache['newthread'] = str_replace("' . $ . '", $rendered, $vbulletin->templatecache['newthread']); } Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/maskedcrusader/includes/class_core.php(4414) : eval()'d code on line 141 It is having a problem with the 'eval' for the template and I cannot seem to find any PHP errors in my code that would cause that error. |
#4
|
||||
|
||||
Have you tried commenting out some lines so you can narrow down exactly which one is causing the error? My guess is the last line but best to know for sure before speculating.
|
#5
|
||||
|
||||
I always start with something that works and then build from there. This works:
PHP Code:
|
#6
|
|||
|
|||
Alright, I figured out where the problem is occuring, but the question is how the heck to correct it.
On this line of PHP code: $newTemplate = vB_Template::create('qma'); $add = $newTemplate->render(); The render is causing the issue. So, when it goes to 'eval' the template, it is causing the issue. Here is what my template code looks like: HTML Code:
<vb:if condition="$show['qma_enabled']"> <div class="blockrow"> <label class="full">Quick Masked Armory:</label> <div style="padding-top: 5px;"> <select id="locale" name="char_1_locale" class="primary" style="width: 75px;"> <option value="US">US</option> <option value="EU">EU</option> </select> <input type="text" id="server_1" value="Server Name" name="char_1_server" size="25" class="primary textbox" /> <input type="text" id="char_name_1" value="Character Name" name="char_1_name" size="25" class="primary textbox" /> <a style="cursor: pointer;" onClick="createArmory(document.vbform.char_1_server.value, document.vbform.char_1_name.value, document.vbform.char_1_locale.value, 1);">Create</a> </div> <div style="padding-top: 5px; padding-bottom: 10px; display: none; color: orange;" id="char_1_error"></div> <br/> <div style="font-size: 11px;">Boxes above are reusable to add as many characters as you want to your post!</div> <div style="font-size: 11px;">More Masked Armory features available at <a href="http://www.maskedarmory.com" target="_blank">MaskedArmory.com</a>. -- Copyright © 2010</div> </div> <div class="blockrow"></div> </vb:if> HTML Code:
<div class="blockrow">
|
#7
|
||||
|
||||
If you remove the <vb:if> conditional from the template do you still get the error?
|
#8
|
|||
|
|||
I got it all fixed. Man, vB4 templating is a pain in the butt!
New question -- is there a guide on how to make template groups for installation with the product? I have a CSS file and two template files that I want to put into a template group that will install with the product hooks. --------------- Added [DATE]1293423347[/DATE] at [TIME]1293423347[/TIME] --------------- Figured it all out. Have a completed product that installs perfectly! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|