Version: , by Kier
Developer Last Online: May 2011
Version: 2.0.x
Rating:
Released: 02-14-2001
Last Update: Never
Installs: 1
No support by the author.
UPDATED 28-02-2001
This hack for vB2.0 Beta 2 will allow you to edit a single template set, or all of them at the same time, is dramatically less bandwidth-hungry than the current system, and allows quick searches through the templates by clicking in the <select> element and pressing a key; for example, if you want to find the 'header' template, just click in the select and press 'h' on your keyboard...
To install, follow the following instructions:
First, open the file forums/admin/adminfunctions.php and find the line
Finally, upload the attached file to your forums/admin/ folder, rename it to ktemplate.php and you're all ready to go.
19th Feb 2001 Additions:
The hack will now auto-select the last template you edited when you return to the list from submitting an edit, or adding a new custom template.
Cookie functions can be disabled for users who do not use output_buffering
Lots of minor bug fixes (this one actually works )
Please note: if you do not have output_buffering=On in your php.ini, you should comment out the '$usecookies' line at the top of ktemplate.php 28th Feb 2001 Additions:
I have now restored the original template.php's 'view original' functionality through the use of a little javascript. I have tested the script with browsers going back to Nutscrape 4.6, and they all work fine.
Just as an added extra, the hack now tells you how many global and custom templates you have... 28th Feb 2001 Additions: (more )
I just modified the code a little so that you can double-click in the menus for a default event:
Double-clicking a global template name will activate the 'add' function, giving you the option to create a customized template.
Double-clicking a customized/added template will open the edit page for the selected template.
Right-clicking a customized template will display the original template of that name. (Right-click functionality is IE only.)
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
Originally posted by dwh Can you explain the meaning of the error, why it happens? Just so we can learn php while we're at it...
Sure.
The script stores the $templatesetid of the template set you are working on in a cookie called $bbadmin_templatesetid.
Cookies are set through the PHP function setcookie(..), which sets the cookie by sending an HTTP header to your browser (like any other cookie-setting mechanism).
Here comes the problem: HTTP headers have to be sent to the browser before any display output has been sent to the browser. My cookie-setting system doesn't abide by that rule at the moment, as I tried to make as few modifications to the original template.php as possible, in order to make installation as easy as possible for all you guys and galls.
Therefore, when you run the script, the setcookie(..) function is actually called after PHP has output stuff to the browser, causing it to fail...
u n l e s s . . .
you have output_buffering enabled in your php.ini file. This has the effect of preventing any output being sent to the browser until the PHP script has completely finished its execution. Therefore, the setcookie function is still valid, even though it's being called at an illegal point in the script. Using vB2's GZip compression system will have the same effect.
If you do not use output_buffering or gzip compression, or if you are using PHP3, then you should comment out the line in ktemplate.php that says $usecookies = "yes";. This will prevent the setcookie(..) function from being called.
Originally posted by dwh I thot I set my gzip stuff to on in the options? Gotta double check that but I'm pretty sure...
To be honest, I haven't looked that closely at vBulletin's implementation of gzip compression... most implementations employ some form of output buffering, which would allow the cookie to be set, but if the control panel doesn't use the compression, or if vB's gzipping doesn't buffer the output, then setting output_buffering = On in php.ini is going to be the only way to allow the cookie to be set.
Once vB2 goes gold, I will revisit the hack and recode it so that the cookie can be set on any system.
This functionality is still there, just click the 'remove' button. It does the same thing as the original 'revert to original' hyperlink.
Quote:
2) view original
Yes, this function is currently not available. If any javascript gurus can tell me how to read the yyy part from this: <option value=xxx>yyy</option> then I can put the functionality back in very easily... but I don't know how to pull out that info at the moment. I'm sure it's possible though.
If they click the view default button, run an extra query to get the name of the template known by its templateid and then just grab that template where templatesetid=-1.