![]() |
Hi,
maybe you know that problem, just checking if $foo isset, if not dont display option $bar. this is kinda nasty cuz you gotta edit the .php file and the template. i've thought about conditional templates and wrote that extremly short hack: ./admin/functions.php before PHP Code:
PHP Code:
from now on you can use the iif() function: Template: Code:
... this user has ? . iif($userposts == 1, ?one post?, ?$userpost posts?) . ? since ... Code:
... this user has " . iif($userposts > 0, "not a single post", "$userpost posts") . " since ... well thats not easy to explain, i hope you got then point :rolleyes: note this isnt tested very well, use with care! |
Awesome! This is just what I've been looking for for a long time. Fantastic work! From my quick-and-dirty testing, this appears to be the answer to my conditional templates dreams... :D
|
what is the point of this :S?
|
It allows you to include conditional statements in your templates. For example, on my site which is PDA-oriented, I want to display a different layout if a visitor is using a PDA browser (e.g. Pocket Internet Explorer), which obviously has a lot less screen space to play with.
Therefore, I would include a conditional check to see whether a PDA browser is detected or not before deciding which elements of the template to display, and what the layout should be. |
Conditional templates will be a feature of vb3....
|
I still don't get it. Any examples of this in use? :)
Quote:
|
I'm still checking, but it appears that the conditional check doesn't work correctly in the postbit templates - the result always comes up as false. :(
|
Anyone know what's so special about the postbit templates that they set all variables to null?
For example, if I set a variable $mobile to 1, it will be recognised as such in the showthread template. In the postbit template, however, it always comes up as null (even if I include a php file in the postbit template that specifically sets it to 1). |
Quote:
|
it's because getpostbit is a real function, so it doesn't use variables from showthread.php
you have to globalize your variable first ;) |
All times are GMT. The time now is 08:04 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:
|