PDA

View Full Version : Need Help - Why can't I put VBCode in templates


Mutt
03-07-2003, 07:32 PM
I posted this in the wrong forum and can't delte it there, sorry

sometimes when I'm making a hack, I want to have the hack make a post and I'd like to use a template to format that post so it's easy to change later. I always seem to have to make the template / post an html post. When I try to set up the template using vbcode, I get errors.

example template
Offending User: $postusername
Offending Post: Go directly to post #$postid ($bburl/showthread.php?postid=$postid#post$postid)
Original Post Date : $postdate $posttime
Thread: $posttitle ($bburl/showthread.php?threadid=$threadid)[hr]$message[hr]The offending post has been copied below


now this seems like a perfectly fine template but if I try and use it I get this error

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /path/to/forum/report.php(61) : eval()'d code on line 2


it's caused by the brackets in the template. If I remove the brackets and leave everything else, it works. If I add a backslash before the brackets it works, but the backslashes get printed. I'm sure this is something real simple but I don't know what. I'd like to use

I'm calling the template like this
eval("\$message = \"".gettemplate("reportbadpost_post",1,0)."\";");


thanks in advance and sorry again for the double post

Mutt
03-07-2003, 09:47 PM
of course, the site is parsing the vbcode in my example template above so you can't really see what my template looked like.

here's an example
[ url=$bburl/showthread.php?postid=$postid#post$postid ]$threadtitle[ /url ]
without the spaces

anyway, I found out what was wrong

it would come on someing like this

$message[hr]

and instead of seeing a var with a vbtag after it, it saw just a var from an array. by adding a space between them, the problem was solved

$message [hr]

I don't really like this solution since it would be too easy for someone to edit the template and get an error. Is there anyway to fix this? How can I let it know that the [hr] in this example is just text and not part of the var?

Xenon
03-08-2003, 10:34 AM
hmm, you can use the bbcodeparse2 function where the template is caleld to convert the vbcode into html, then it should work :)

Boofo
03-08-2003, 11:20 AM
Shouldn't that be <hr> instead of [hr]?

Mutt
03-08-2003, 05:04 PM
no, i have an [hr] vb tag that inserts a <hr>