![]() |
I threw this together in about 45 minutes today. It allows you to put stuff like this in your templates:
{if ($bbuserinfo[userid]) { <a href="usercp.php?s=$session[sessionhash]">User CP!</a> }else{ <a href="register.php?s=$session[sessionhash]&action=signup">Signup!</a> }endif} Of course, it requires a code edit for each template, so it's somewhat counter intuitive, but as I said, it's not exactly a release -- it's more a concept demo. :) Requires PHP4 as I use the /e modifier. Also, you'll want to have some decent PHP understanding. See attachment for more info. Feel free to ask questions, but I may not answer/support like I did past hacks. |
Thanks Mike, I needed something like this!
|
I like :cool:
|
If you're looking for a quick way to swap buttons, do what I did: use the phpinclude template, a one-line ternary operator that stores the HTML for either the register button, or the user cp button -- hold it in a variable name not used elsewhere, and call on it in the template.
Example: Code:
$the_button = (isset($bbuserid)) ? sprintf('<img src="images/top_register.gif">') : sprintf('<img src="images/top_usercp.gif">'); |
That was just an example :)
And if you wanna get technical, you should check $bbuserinfo[userid] instead of bbuserid for those who don't store their username/password. :p |
A competition now, eh? :) Well, it's just an extremely simple way to allow people to display the appropriate button. :)
|
Chris -
It isn't a competition. Look at where Mike said he put his conditional and look at where you put yours. Mike is talking about adding conditionals to any template where they are processed by keyword. This could be used by non-programmers to make things all over the system change based on various information. They wouldn't have to learn a whole new language just a few commands. Mike - This is a great concept and it should probably be pursued for later versions. This would greatly improved the functionality of vBulletin. |
Yes, I know -- I was making a joke. :)
|
Personally I don't see the point to give templates this functionality. Templates are meant to separate code from layout and now you're bringing back the code into the layout :confused:
It gives templates more flexibility: true, but also makes them harder to understand to newbies. This can be a great addon for some people, but I hope this won't be a standard in vb |
Would this version ever see an official release? No, it's physically impossible because it requires PHP4.
Then you add that fact that you regex any template that you want to use with it :( Using this system could eliminate a large amount of templates though... |
All times are GMT. The time now is 06:02 AM. |
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:
|