![]() |
vb4 custom template problem
Hi,
I want to use misc.php file to display my custom template. Example: misc.php?do=page&template=my_template And everything works fine except that I cannot find a way to eval my own variable which is inside that template = {vb:raw HTML} All other vars such as {vb:raw header} and {vb:raw footer} looks okay. I tried to use parse_template hook to do something like: global $HTML; $HTML = "test"; But still HTML is null. Any idea? |
Quote:
Anyway, like for any other template, you need to properly register your variables for use in the template. I did an article on that: https://vborg.vbsupport.ru/showthread.php?t=228078 |
I shouldn't have to do it. All that is in misc.php file. One thing that it is missing, is how to eval vars in custom templates. I'm sure there must be a way to do it.
|
Well, the misc.php code creates the template, registers some standard variables to it, then renders it, but if you're trying to use other variables then you need to deal with that. You could try using {vb:raw GLOBALS.HTML}, but if that doesn't work you could use vB_Template::preRegister() where $HTML is created, like:
PHP Code:
|
Quote:
|
Quote:
Thx guys for help. |
Making a dirty global trick is not a solution, but a workaround. Of course, I thought you were looking for the correct way to do it in vB. Clearly my mistake, sorry.
|
Quote:
|
BTW, quick and dirty is what I meant above - dirty alone does not catch it. Sorry, english is not my mother tongue ;)
|
Quote:
Thx again. |
All times are GMT. The time now is 04:59 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:
|