![]() |
Adding custom php/sql script into custom vb page
I've used the instructions found on this thread to add a custom page. Now I am trying to input php/html code from a sms script I have to make it work on that page. The problem I am getting is this
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/cell/public_html/includes/adminfunctions_template.php(3596) : eval()'d code on line 29 Is it even possible to add a script into the template file like this? Any help would be greatly appreciated. Thanks. |
You can't put PHP into a template. Templates are HTML (and if conditions) only. You must place PHP scripts in a PHP file and include a template into them. The thread you posted gives instructions on how to do so.
|
Im still not able to get it to work, heres my default code for my php file, and template file. I've messed around with it quite a bit, and nothing will show up. Can someone point me in the right direction?
Heres my php file code Code:
<?php Code:
$stylevar[htmldoctype] |
Read this: Understanding A Template-Based System.
vBs template system doesn't work the same as how you'd normally write PHP in scripts. You need to assign output to variables and then use these variables in your template. Also this line: PHP Code:
|
I got around it by creating two templates .. a header and a footer and calling them in the actual php file. Then just write your php code in the actual file between the header and footer calls. Makes life much easier IMO. So far no problems, but my code doesnt require me using vBulletin variables in my script. If I did have to tho, I think I would just create a new template and call the template from the page. Let me know if this works for you.
--------------- Added [DATE]1201307122[/DATE] at [TIME]1201307122[/TIME] --------------- actually I take that back. I have put the template directly into the php file with all variables surrounded by <?php echo ::code:: ;?>.. I did this for the header and footer .. and just did normal php/html in the middle. Works fairly well.. Except the title variable doesnt work, which makes me wonder was other variables arent working..... If theres a better way to output template variables in php pages instead of ECHO .. please let me know. |
All times are GMT. The time now is 03:52 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:
|