The Arcive of vBulletin Modifications Site. |
|
Details »»
|
|||||||||||||||||||||||||
Is there a way to write PHP code within a template?
I would like to execute a javascript animiation when a user's postcount is equal to (or is a multiple of) 100 posts. <? if ($userpostcount==100){ do this; ?> But it doesn't work. I'm wondering if it's dute to me being green in PHP or if the templates don't allow for coding within. I tested with <? if (1==1) {echo ("hello");}?> and it didn't work. Is there a way to accomplish this within a template? TIA! Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
|||
|
|||
|
You'll have to edit the php files. Just find the place the template is being called, add your code before it, and call the needed variables in the template.
Should work |
|
#3
|
|||
|
|||
|
Hi Menno,
I know it's doable somehow, but I don't think your suggestion will work, since I cannot use php if statements in the templates to check the variables I assigned in the php code. My initial attempt was to write something like this in a template: if ($variable==this) {run javascript/animation} Since this cannot be done (thanks for clarifying this), next I wonder if I can pass those vB variables to the javascript itself. Is there a way of doing that? <SCRIPT language=JavaScript1.2> <!-- var jsvar=$vBvar; <-- ?? .. // --> </SCRIPT> |
|
#4
|
|||
|
|||
|
if the variables are set in the php code (not the templates itself), this shold work.
Not sure though |
![]() |
|
|