![]() |
Php parsing in templates
Hello, i created my own little stars addon for my forums, a quite simple addon for when i do upgrades, i wont have to re-edit any of my vb files. The problem is not with the php or mysql, it is calling the php in the template. I added the variable '$stars' in the postbit template and it isent comming up. It worked on the earlier versions of vbulletin 2 but now that i try it now, it will not show up on my users posts. Basicly the problem im having is calling a php file in a template. I added the following line in my showthreads.php:
PHP Code:
Thank you for your time. |
just the template phpinclude will be executed and there phpcode can be used, in no other templates!
|
I still get nothin, i want to put the stars right under the usertitle in the postbit template, i have the phpcoding in showthreads.php and i added $stars in postbit. Is there anyway i can accually get them to show up? i even tried adding replacements and doing the coding in the phpinclude template
|
You virtually never can edit bit templates via phpinclude. You almost always have to hack.
|
this i know, i added my script in showthread.php and i cant figure out how to make the variable $stars come up. I never really had a problem with phpscripting but i cant quite figure this out
|
Make sure $stars is in a global scope (the scope in which all templates are eval'ed AFAIK).
|
a global scope? like eval()? and should this be done in showthread.php and do you have an example so i can understand exacly what you mean?
|
heh, nevermind, guess i will have to figure it out my self...
|
last time im asking a simple question here, thanks for nothing
|
by global scope he means right above where the file does it's final dooutput('postbit') for example
|
I also need to do the same thing... add a php code in a specific place in showthread template but I don't know how.
What do you use phpinclude template for? |
Quote:
You'll never get any help here with that attitude. These people are using their own personal time to help you with your problem, the least you could do is show some gratitude. |
I guess it could work this way (I haven't tried it actually), but it looks little messy. All you need to do is to split a template on two templates at the point you want to insert your php code... ie. from first part of showthread template make showthread1 and from the rest showthread2.
Then edit showthread.php and replace the following line PHP Code:
PHP Code:
|
Or there is another way I just tried... Right in front of the following line in showthread.php
eval("dooutput(\"".gettemplate("showthread")."\"); "); make a line of of text you wish to appear somewhere on the showthread page. Just put everything you want in one variable, i.e $myvariable. All you need to do then is to put $myvariable somewhere in the showthread template... |
Quote:
Edit /admin/functions.php insted. Search for this: PHP Code:
|
All times are GMT. The time now is 04:43 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:
|