Version: , by Mike Sullivan
Developer Last Online: Nov 2023
Version: 2.0.x
Rating:
Released: 05-13-2001
Last Update: Never
Installs: 1
No support by the author.
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.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
i don't know, gossamer threads does this sort of thing for their links based templates and it works very very well. It saves having to have 10 million options for everything like how many links to display here, there and everywhere else because you can set it as part of the template, and in that case it is a display thing because displaying 10 links as opposed to 20 is a display issue. I am not sure the idea transfers over so well to vb but it is still interesting idea anyway.
Location: Amsterdam, The Netherlands, currently living in Cape Town, South Africa
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
Quote:
Originally posted by chrispadfield i don't know, gossamer threads does this sort of thing for their links based templates and it works very very well. It saves having to have 10 million options for everything like how many links to display here, there and everywhere else because you can set it as part of the template, and in that case it is a display thing because displaying 10 links as opposed to 20 is a display issue. I am not sure the idea transfers over so well to vb but it is still interesting idea anyway.
I don't say it's not usefull; In most cases it actually saves alot of vbcode to accomplish certain things. But again: Templates are meant to separate code from layout (for designs sake and to make it friendly for non-coders). Bringing back the code into it just makes no sense.
Originally posted by Ed Sullivan Then you add that fact that you regex any template that you want to use with it
How are replacement variables handled then? Isn't every template parsed for these things anyway? Can't you just have a special type of replacement variable that has it's replaced value treated as a block of code?
Oversimplified I know, but is it feasible?
This is definately something I'd like though. Even if it only handled a simple if then construct it would be great.
Location: Amsterdam, The Netherlands, currently living in Cape Town, South Africa
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
Quote:
Originally posted by fastforward
How are replacement variables handled then? Isn't every template parsed for these things anyway? Can't you just have a special type of replacement variable that has it's replaced value treated as a block of code?
Oversimplified I know, but is it feasible?
This is definately something I'd like though. Even if it only handled a simple if then construct it would be great.
Regexing text is far more resource-intensitive then using str_replace (like replacement vars are parsed)
bbcodeparse2() is completely unrelated to replacement variables... it's the general post parsing routine. You can't do str_replace()'ment on anything there...
The one in dovars() is most likely for the pm popup and only processed when there's a PM popup.
Replacement variables are done with str_replace() which is faster than preg_replace which is faster than ereg_replace()...