![]() |
"new" vbTemplate help
Its been a long time for me and I'm trying to get my forum back up and going.
I have upgraded to vb4.2 and am trying to get an old mod working again. Its pretty simple just one issue. It uses fetch_template which I understand is deprecated. The new format is: $templater = vB_Template::create('forumhome_event'); $templater->register('callink', $callink); $templater->register('daysevents', $daysevents); $templater->register('eventdate', $eventdate); $templater->register('eventdates', $eventdates); $upcomingevents = $templater->render(); My mod searchs for a BB element in a post and replaces it with the template using the hook postbit_display_complete: eval('$newvaluetodisplay= "' . fetch_template("postbit_mytemplate") . '";'); It then does a search and replace on $newpostmessage = preg_replace("@\[myelement$i\]@i", "$newvaluetodisplay", $post['message']); I've temporarily fixed it by just by moving the contents of the template into the code itself but I'd like it to be cleaner. :) Any suggestions? |
Sorry, I'm not sure what you're asking - you seem to have it figured out. Just replace your eval line with:
Code:
$templater = vB_Template::create('postbit_mytemplate'); and you only need one or more register() calls if your postbit_mytemplate uses variables. Oh, and you'd also need to convert your template to vb4 format, if it uses any <if> tags or includes any variables. |
wow I feel stupid now, only thing I was missing is
$newpostmessage = $templater->render(); It just wasn't sinking in no matter how many times I stared at it :) Thanks, though I feel foolish now! lol |
All times are GMT. The time now is 01:07 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|