PDA

View Full Version : Board Optimization - Plugin Based Template Cache


Pages : [1] 2

orban
04-13-2006, 10:00 PM
3.6 Thread for Support

https://vborg.vbsupport.ru/showthread.php?t=121876

PixelFx
04-14-2006, 03:56 PM
sounds cool

Gizmo5h1t3
04-14-2006, 04:14 PM
tried this, only concern is, as ppl browse the board, its adding files in the "templates" folder, of approx 250kb EACH...

is this a continuous thing, or does it clear itself after a while?
itll end up witrh the folder being massive??

**EDIT**

had this running for 10 minutes, and alreadfy the "template" folder is 6 mb in size????

MissKalunji
04-14-2006, 04:24 PM
my question

how is it compare to this other guys template cache system hack?

MissKalunji
04-14-2006, 05:08 PM
tried this, only concern is, as ppl browse the board, its adding files in the "templates" folder, of approx 250kb EACH...

is this a continuous thing, or does it clear itself after a while?
itll end up witrh the folder being massive??

**EDIT**

had this running for 10 minutes, and alreadfy the "template" folder is 6 mb in size????


Thats normal...it saves each template

DementedMindz
04-14-2006, 06:33 PM
i think i might try this one compared to the other one... i like how it clears out auto.. will check it out soon :) thanks... plus hes not even on no more and i dont think will be updating it

DementedMindz
04-14-2006, 06:35 PM
ok another question when we Create a directory templates... now is there a way we could add a index.html or .php to it... as i think it wouldnt be to wise to have it open to public

MissKalunji
04-14-2006, 07:25 PM
does it works for you?

DementedMindz
04-14-2006, 08:38 PM
does it works for you?
i didnt install it yet but im going to try it on my test board in a bit... you try it first :)... trying to make me the test dummy huh MissKalunji ????

MissKalunji
04-14-2006, 10:17 PM
i didnt install it yet but im going to try it on my test board in a bit... you try it first :)... trying to make me the test dummy huh MissKalunji ????

lol no *angel face* lol im gon try it

DementedMindz
04-14-2006, 10:27 PM
yeah im going to after i watch this game.. but if you do it first let me know how it goes :)

MissKalunji
04-14-2006, 10:39 PM
/me clicks installed and works well! very well! no error so far

orban
04-14-2006, 11:26 PM
had this running for 10 minutes, and alreadfy the "template" folder is 6 mb in size????

Well, it saves the all the templates used in one page, and if you have a lot of styles and templates it can easily get to 6mb. on my site with just the normal templates it goes to 3mb after a few hours.

Yes, it WILL stop eventually, when every possible page has been browsed to. It's normal that the files get created over time, because when you install it/clear the cache, it might take a while until a user goes to the FAQ page for example.

ok another question when we Create a directory templates... now is there a way we could add a index.html or .php to it... as i think it wouldnt be to wise to have it open to public

You should disable directory browsing anyway. I'll exclude index.php/index.html from the files to be deleted in the next update.

Also it's really no problem to have these files public because they just define variables, no output anyway.


--


The worst thing that can happen is that it won't create any files, and even if that happens you won't notice any errors. :)

Kihon Kata
04-14-2006, 11:28 PM
Installed! So, how big will the directory get? Mine is getting huge in 5 mins.

MissKalunji
04-15-2006, 12:07 AM
the same size that your template has

orban
04-15-2006, 08:20 AM
the same size that your template has

Actually it gets bigger. It doesn't save every template to a file, but it saves collections of templates to files. For example showthread.php uses (1,2,3,45,67,123,234,454) then all those get saved to a file and then if you call showthread.php a second time those get included.

It shouldn't get bigger than 10-20mb though I'd say. If it does there's something wrong.

Gizmo5h1t3
04-15-2006, 08:53 AM
mine went up to just short of 11 meg, then it cleaned itself out.......quality

orban
04-15-2006, 09:19 AM
Well, did you edit/insert a template?

beebi
04-15-2006, 11:07 AM
nice one

MissKalunji
04-15-2006, 11:42 AM
Actually it gets bigger. It doesn't save every template to a file, but it saves collections of templates to files. For example showthread.php uses (1,2,3,45,67,123,234,454) then all those get saved to a file and then if you call showthread.php a second time those get included.

It shouldn't get bigger than 10-20mb though I'd say. If it does there's something wrong.


you lost me a bit....

If you open showthread a second time...those get included???

orban
04-15-2006, 01:51 PM
you lost me a bit....

If you open showthread a second time...those get included???

Yes. The first time somebody opens showthread.php it grabs all the templates from the database and saves them to a file that is uniquely related to showthread.php. The second time somebody accesses showthread.php that file is include()ed (using that unique identifier) and there won't be any database calls.

MissKalunji
04-15-2006, 01:59 PM
Ohhh ok i understand it works a bit differently then the other template cache from the other template cache hack probably why it doesnt do any errors like the other one

Thanks working fine! and my site is hacked to death!

orban
04-15-2006, 02:05 PM
Ohhh ok i understand it works a bit differently then the other template cache from the other template cache hack probably why it doesnt do any errors like the other one

Thanks working fine! and my site is hacked to death!

Yeah I think it does work different from the other one (also you don't have to edit any vB files).

Glad to hear it works for you :)

There is actually no reason it shouldn't work for any vB 3.5 installation, except that the directory can get quite big. But it saves RAM from the cached MySQL queries or something I guess. And hard drives cheaper than RAM. Not like I'll ever use my 150GB hard drive :D

Kihon Kata
04-15-2006, 04:02 PM
FYI: Have had this running for one day and my templates directory is 14 megs.

We are a pretty busy site with 2,000 posts/day

Sped things up tho. I like this. Does it clean things up? of so, how and when?

orban
04-15-2006, 04:08 PM
FYI: Have had this running for one day and my templates directory is 14 megs.

We are a pretty busy site with 2,000 posts/day

Sped things up tho. I like this. Does it clean things up? of so, how and when?

You can just delete it. "rm *" or something. If you want.

What do you mean by "cleaning" up? All of the files are used (even though some might be used very rarely), there is no garbage.

By the way I'm working on a plugin cache system too :) Without file modification of course.

Kihon Kata
04-15-2006, 04:14 PM
^^ there Gizmo5h1t3 said "then it cleaned it self out"

You can just delete it. "rm *" or something. If you want.What does this mean?

BTW, I love this hack, it's working well. I don't really care that I have a 14 meg folder or a 150 meg folder. We are on a high speed dedicated server with a large HDD. :)

orban
04-15-2006, 04:20 PM
^^ there Gizmo5h1t3 said "then it cleaned it self out"

The only script bit that "cleans out" the folder is when you insert/update a template, so most likely he (or somebody else in his admincp) did that.

"rm *"What does this mean?

When you connect to your server with SSH you can change to the templates folder and remove all the files with "rm *". You can also delete them in your ftp program, but there's really no need to do that.

BTW, I love this hack, it's working well. I don't really care that I have a 14 meg folder or a 150 meg folder. We are on a high speed dedicated server with a large HDD. :)

I have the feeling too that it lowered the load a bit on our installation, but it's a bit hard to say tho. Great to hear it improved your performance then.

--

Is your whole site powered by vB? eg. global.php and all? that'd explain your 14mb cache folder. because I have only 4.1mb after 3 days.

Kihon Kata
04-15-2006, 05:46 PM
The only script bit that "cleans out" the folder is when you insert/update a template, so most likely he (or somebody else in his admincp) did that.



When you connect to your server with SSH you can change to the templates folder and remove all the files with "rm *". You can also delete them in your ftp program, but there's really no need to do that.



I have the feeling too that it lowered the load a bit on our installation, but it's a bit hard to say tho. Great to hear it improved your performance then.

--

Is your whole site powered by vB? eg. global.php and all? that'd explain your 14mb cache folder. because I have only 4.1mb after 3 days.
Thanks for the great support on your hack, nice to see the quick replies. Our site is semi vB powered with allot of hacks added on including vba gallery. lol We have completely custom coded beauty product review center and a beauty product swap center with wishlists etc. We have a large section outside our extremly modded up vB that isn't template driven but *IS* connected via global.php. I am assuming that since the only part of our site that is template driven is the forums, that this hack here only effects our forums. I'm also trying to figure out why it might be 14 megs, but really not too warried about it. We do cache php scripts plus we run MYSQL 4 caching

Maybe you can shed a little light or something. Thanks again for the hack

orban
04-15-2006, 05:54 PM
vba gallery. product review and swap center...if it uses templates, might be the reason too.

you can open the files by the way, and just check what's inside, there's the names of the templates.

just check that the cache for the php scripts is large enough to hold all the template cache files.

DementedMindz
04-15-2006, 07:21 PM
Thanks working fine! and my site is hacked to death!

:banana: about time to have a nice working cache... works great thanks

MissKalunji
04-18-2006, 03:21 AM
Yeah I think it does work different from the other one (also you don't have to edit any vB files).

Glad to hear it works for you :)

There is actually no reason it shouldn't work for any vB 3.5 installation, except that the directory can get quite big. But it saves RAM from the cached MySQL queries or something I guess. And hard drives cheaper than RAM. Not like I'll ever use my 150GB hard drive :D

Yes and i thank you for that!

:banana: about time to have a nice working cache... works great thanks

lol tell me about it!

DementedMindz
04-18-2006, 11:21 AM
ok quick question will this cache every thread and all cause it seems like when i jump to a new thread it caches that.... am i correct on that?

orban
04-18-2006, 11:23 AM
No?

It caches all the templates needed for showthread.php, one time, and that's it.

DementedMindz
04-18-2006, 11:31 AM
also it would be nice if when updating a template only that one template was erased cause if not it will erase every template

orban
04-18-2006, 06:16 PM
also it would be nice if when updating a template only that one template was erased cause if not it will erase every template

Can't do that, because there is no way I can find out on what pages that template is used. The saved files aren't templates, they are collections of templates.

orban
04-18-2006, 06:43 PM
I added template cache.beta.php. Read the green text on how to use that file.

Greatly improved the performance of my board.

MissKalunji
04-18-2006, 07:15 PM
using the beta forum seems to be loading faster and 1 query less

orban
04-18-2006, 07:17 PM
Are you using APC? And PHP 4 or 5? So I can make sure it works on different installations and put it out of beta.

MissKalunji
04-18-2006, 07:23 PM
Are you using APC? And PHP 4 or 5? So I can make sure it works on different installations and put it out of beta.

well i have zend optimizer and using php 4

MissKalunji
04-18-2006, 07:34 PM
Oh one thing! my welcome panel isnt showing anymore.....

orban
04-18-2006, 07:40 PM
Huh. Weird. Did it show with the other version?

And try to clear the cache. Any PHP errors in your logs?

MissKalunji
04-18-2006, 07:42 PM
Huh. Weird. Did it show with the other version?

And try to clear the cache. Any PHP errors in your logs?


Yep used to show with old version

Yep Clear Cache

No Php errors in logs

orban
04-18-2006, 07:45 PM
Is that welcome plugin an addon I can install to find out what happens?

MissKalunji
04-18-2006, 07:48 PM
Yep a plugin that one : https://vborg.vbsupport.ru/showthread.php?t=83124

orban
04-18-2006, 07:51 PM
Okay then I'll install it and find out what happens.

MissKalunji
04-18-2006, 07:58 PM
oki dokie

orban
04-18-2006, 08:05 PM
It's the way the cache works, it replaces the template with an include() statement.

The plugin replaces a certain string in a template with a new string, and because the template just consists of an include() it won't replace anything.

Sorry :( I don't think there is an easy way to fix this.

MissKalunji
04-18-2006, 08:06 PM
ohhh ok uhm

MissKalunji
04-18-2006, 08:08 PM
Theres More i had a BUMP thread Mod as well wich doesnt work either

orban
04-18-2006, 08:10 PM
I'll try to add an array of templates to be excluded from being replaced with an include() statement. You'd have to find out which ones you have to exclude though...

Well then downgrade again until I get that working, disable the product, clear templates/, upload the old template_cache.php and enable it again.

MissKalunji
04-18-2006, 08:14 PM
Thanks orban! you rock! They did that for template compressor to exclude some template to compress that would be fine!

orban
04-18-2006, 09:30 PM
Updated the template_cache.beta.php file.

KissKalunji:

$vbulletin->templatecache['FORUMHOME'] = str_replace('$navbar','$navbar ' . $vbulletin->templatecache[forumhome_welcomepanel],$vbulletin->templatecache['FORUMHOME']);

That's the problematic part of the Welcome Panel plugin. So you add FORUMHOME to $exclude. You know a bit of PHP?

Then check the other plugin for a smiliar line, just a template that gets modified, and exclude that one too.

I guess I should extend my plugin a bit and add two settings you can edit in the admincp instead of hardcoding it to the PHP file. Oh well.

MissKalunji
04-18-2006, 10:09 PM
Sweet thanks! yeah i know php :)

Let u know how everything worked out

MissKalunji
04-18-2006, 10:36 PM
works :) thanks!

Kihon Kata
04-19-2006, 12:57 PM
I guess I should extend my plugin a bit and add two settings you can edit in the admincp instead of hardcoding it to the PHP file. Oh well.
Let us know when you do this so I can install :)

orban
04-19-2006, 01:12 PM
Scared to edit the PHP file? ;)

Kihon Kata
04-19-2006, 01:17 PM
Scared to edit the PHP file? ;)
Well, since I don't know php well, yes. LOL I wouldn't know where and what to edit ;)

I already run your last version, seems to work good. What will this version do for my site? Would you be willing help me out a bit?

MissKalunji
04-19-2006, 01:19 PM
Well, since I don't know php well, yes. LOL I wouldn't know where and what to edit ;)

I already run your last version, seems to work good. What will this version do for my site? Would you be willing help me out a bit?


yeah it will make the board run faster i have it as well trust me it snot hard just adding the template thats IF you have mods that are messing up the forum

Kihon Kata
04-19-2006, 01:34 PM
yeah it will make the board run faster i have it as well trust me it snot hard just adding the template thats IF you have mods that are messing up the forum
Yeah, that could be the problem, we have MANY modifications. I'll wait to see what Orban says

MissKalunji
04-19-2006, 02:07 PM
so far only two has problems :) and my board is heavy moded

Kihon Kata
04-20-2006, 04:46 AM
knock knock, Orban, you there?

orban
04-20-2006, 08:14 AM
Sorry yeah. Can't live here 24/7 ;)

You're running the template_cache.beta.php? If it works, what exactly is your problem then?

orban
04-20-2006, 10:06 AM
Okay, I've added a few options that can be edited under "vBulletin Options".

Follow the green upgrade steps (you have to install both template_cache.php and product.xml, both files got updated).

template_cache.beta.php is now included in template_cache.php and can be enabled with the setting "Cache Templates Seperatly".

Please note that there is NO need to upgrade if it runs fine. There are no bugfixes/improvements included in this version. It's really just the few options I added that can be edited in the admincp. Nothing else.

SixteenOhNine
04-20-2006, 09:12 PM
Seems with 3.5.4 I get the following error:


Fatal error: Cannot redeclare cache_templates_with_file_cache() (previously declared in /home/*****/public_html/template_cache.php:2) in /home/*****/public_html/template_cache.php on line 2

orban
04-20-2006, 09:22 PM
Did you upgrade? Did you check Allow Overwrite?

You probably have all the plugins twice.

DementedMindz
04-20-2006, 09:50 PM
i get the same error i even removed the product and reinstalled it and the same thing...

SixteenOhNine
04-20-2006, 10:17 PM
Did you upgrade? Did you check Allow Overwrite?

You probably have all the plugins twice.

Clean install, checked it even though not installed, same error :).

MissKalunji
04-20-2006, 10:37 PM
mine still working fine *knocks on wood*

DementedMindz
04-20-2006, 10:38 PM
lol lucky you i tried to upgrade to the newest one and poof broke lol

Tulsa
04-20-2006, 10:50 PM
Fatal error: Cannot redeclare cache_templates_with_file_cache() in /home/*****/public_html/forums/template_cache.php on line 2


I just tried the install for the first time 3.5.3

MissKalunji
04-20-2006, 11:05 PM
lol lucky you i tried to upgrade to the newest one and poof broke lol

oh i didnt upgrade to the latest one it was kind of pointless :)

DementedMindz
04-20-2006, 11:33 PM
yeah i shouldnt have either lol... now it dont work... ill install the other one back in again till they fixes this

MissKalunji
04-20-2006, 11:41 PM
yeah i shouldnt have either lol... now it dont work... ill install the other one back in again till they fixes this

tssss you should read more often :bunny: :banana: it didnt say if everything was working fine not to upgrade tsss

DementedMindz
04-20-2006, 11:44 PM
tssss you should read more often :bunny: :banana: it didnt say if everything was working fine not to upgrade tsss

lol yeah i just wanted to try out the new features lol... but really the other one seems like my site loads faster now... hmmm ill have to test both when they fix this one

nix
04-21-2006, 05:32 PM
any word on a fix?

orban
04-21-2006, 05:34 PM
Sorry, I'm not getting thread notifications.

Import to product.xml again, overwrite: yes.

It must be because my error reporting doesn't work or something, because I tried this plugin of course on a vanilla 3.5.4 installation before uploading.

orban
04-21-2006, 05:51 PM
*send notify emails*

nix
04-21-2006, 06:37 PM
nope, same error.

Fatal error: Cannot redeclare cache_templates_with_file_cache() in

orban
04-21-2006, 06:41 PM
GREAT vbulletin.org didn't overwrite the old product.xml.

I think I'll scream now.

Try again, I'm really sorry about this mess. :(

nix
04-21-2006, 06:48 PM
new error

Fatal error: Call to undefined function: clear_template_cache() in options.php(843) : eval()'d code on line 6

orban
04-21-2006, 06:50 PM
This plugin works on my installation I swear to god!

Try downloading and importing with overwrite the product.xml again.

If you want to make sure, check there is an include_once in the plugin "include template_cache.php & clear template cache".

DementedMindz
04-21-2006, 06:57 PM
working great now.. and i think this oneis much faster then the other one now that im able to test them both out :)

DementedMindz
04-21-2006, 06:58 PM
lol just trying to figure out which templates i need to Exclude :(

orban
04-21-2006, 06:58 PM
Aye, I had the impression too. I take you're also using a PHP cache of some sorts?

lol just trying to figure out which templates i need to Exclude

Yeah can't help that. I don't know what the plugin authors thought with modifying templates on run time.

DementedMindz
04-21-2006, 07:02 PM
yeah im using a php cache... is there a easy way to tell which templates to exclude?

orban
04-21-2006, 07:04 PM
Hmmm, check your plugins for lines that modify "$vbulletin->templatecache". Not sure if that covers all of it though.

DementedMindz
04-21-2006, 07:08 PM
yeah i had to add FORUMHOME is there any way to get around that so it will cache it but not remove the plugins?

orban
04-21-2006, 07:14 PM
FORUMHOME will get cached to a file, just not to a seperate file.

I don't think that is possible, because the whole point of caching to a seperate file is to to avoid the eval(). But to do that, you can't modifiy the template at run time.

What plugin is it anyway? Maybe it's possible to realize it without the template modification at run time...

DementedMindz
04-21-2006, 07:19 PM
yeah i may remove them plugins anyway lol this way it dont have that problem... but i can tell a big difference from the other cache

nix
04-21-2006, 07:39 PM
working now. Just downloaded it again right now and worked this time.

orban
04-21-2006, 07:42 PM
Haha, I'm so glad xD

MissKalunji
04-21-2006, 08:37 PM
Very satisfied!

orban
04-21-2006, 08:44 PM
*Phew

DementedMindz
04-21-2006, 08:54 PM
Very satisfied!


about time right orban

Tulsa
04-21-2006, 10:46 PM
Greased lightening now!

Thanks! :)

orban
04-21-2006, 10:51 PM
about time right orban

:cool:

Greased lightening now!

Thanks! :)

glad to hear

Kihon Kata
04-21-2006, 10:58 PM
So...Orban...with all this greased lightning talk, I wanted to just check again that upgrading from 1.0.0 to 1.0.2 WONT give me more performance?

MissKalunji
04-21-2006, 10:59 PM
So...Orban...with all this greased lightning talk, I wanted to just check again that upgrading from 1.0.0 to 1.0.2 WONT give me more performance?

i think it does but its just ME

orban
04-21-2006, 11:00 PM
If you used template_cache.beta.php there won't be any performance improvements.

If you used template_cache.php there might be ;)

Kihon Kata
04-22-2006, 02:05 AM
If you used template_cache.beta.php there won't be any performance improvements.

If you used template_cache.php there might be ;)
I just checked, Orban. I have a template_cache.php in my forum root and a folder called "templates". So I don't need to upgrade then? Sorry for the confusion.

MissKalunji
04-22-2006, 02:07 AM
I just checked, Orban. I have a template_cache.php in my forum root and a folder called "templates". So I don't need to upgrade then? Sorry for the confusion.


go to plugin look at template cache and check the version ;) then ull know wich one you have

Kihon Kata
04-22-2006, 03:20 AM
go to plugin look at template cache and check the version ;) then ull know wich one you have
eh? I looked at the template_cache.php and there is no version in that php file.

Now, I did look in the product manager and found that I am at 1.0.0

Let me know what you think

Tulsa
04-22-2006, 03:31 AM
The latest is 1.0.2

Kihon Kata
04-22-2006, 03:36 AM
The latest is 1.0.2
I know that. That is why I am asking if I should upgrade.

MissKalunji
04-22-2006, 03:44 AM
eh? I looked at the template_cache.php and there is no version in that php file.

Now, I did look in the product manager and found that I am at 1.0.0

Let me know what you think


Well yeah much more faster then 1.0.0

Worth upgrading

Kihon Kata
04-22-2006, 03:52 AM
Well yeah much more faster then 1.0.0

Worth upgrading
Which one are you using Kalunji?

MissKalunji
04-22-2006, 03:53 AM
1.0.2

www.dancehallareaz.com/forum :)

Kihon Kata
04-22-2006, 03:56 AM
1.0.2

www.dancehallareaz.com/forum :)
no, I mean beta or the other?

nix
04-22-2006, 04:10 AM
Haha, I'm so glad xD
Me too. Love this hack.

MissKalunji
04-22-2006, 04:12 AM
no, I mean beta or the other?

the same one attached to this thread (i upgraded today)

Beta is done its full version now

Kihon Kata
04-22-2006, 05:31 AM
Ok so I finally did it, I upgraded to 1.0.2 but I have a few questions. (imagine that! lol) I am trying to figure out which setting is better. I am running MySQL 4 (with caching) and ALSO caching PHP with eAccelerator. I have tried it with both settings of "Cache Templates Seperately" on and off. Seems that when I turn it off, it's much faster. Could be my imagination though.

Which way should I run this?

EDIT: Sorry I originally said I did NOT run eAccelerator....I was wrong, I do

Zia
04-22-2006, 05:40 AM
hmm hello...
its template cache system.......

maybe a dumb question..what it do/
remove query? speed up forum? saving bandwidth ?
any one can say ?
thnx

orban
04-22-2006, 09:29 AM
Zia: It saves one query per page, in addition, if you're using "Cache Templates Seperately" it might save a few eval() calls if you're using a PHP cache.

Kihon Kata
04-22-2006, 03:58 PM
Thanks ORBAN for helping me in a private message. Ok, so back to my post ^^ there regarding which way should I run it?

orban
04-22-2006, 04:32 PM
It's impossible for me to say what's better for you. It depends on so many things, just try it out. Can also try to increase the 4500 to 10000 for example, or 2000...can you try to find out if the files in the template folder actually get picked up by your template cache?

Kihon Kata
04-22-2006, 04:37 PM
How can one do this? can you try to find out if the files in the template folder actually get picked up by your template cache?

orban
04-22-2006, 04:44 PM
from the eAccelerator readme

Control panel and disassembler
------------------------------

If you want to use the control-panel you need to compile eAccelerator with
--with-eaccelerator-info which is the default value.
You need to copy the control.php file to your webroot and set the path to it
in the php.ini or eaccelerator.ini in the eaccelerator.allowed_admin_path
directive. If you don't do this you wont be able to see much information and
can't control eAccelerator.
You can set the username and password needed to access the control-panel in
the control.php file.

I *guess* that's the one.

Kihon Kata
04-22-2006, 05:46 PM
Ok, I can view the ecc caching. I see that the /templates/ folder is being cached. What else did you need to know?

It's impossible for me to say what's better for you. It depends on so many things, just try it out. Can also try to increase the 4500 to 10000 for example, or 2000...can you try to find out if the files in the template folder actually get picked up by your template cache?

orban
04-22-2006, 05:47 PM
Both the files like 3d60b0358a7f117e7ee1c30e123ef0f3.php and 132.php? If you turn on seperate caching...

Then it doesn't really make sense that it's slower or not faster when you turn on seperate caching..mmmh.

Kihon Kata
04-22-2006, 05:59 PM
Yep, I see files like 3d60b0358a7f117e7ee1c30e123ef0f3.php, about 10 megs of them. So, sorry to bug, but what kind's of advantages will setting it up so that it uses files like 123.php?

orban
04-22-2006, 07:49 PM
It saves the eval(template). eval() is kind of "bad", because it can't be cached by a PHP cache.

Kihon Kata
04-25-2006, 12:46 AM
I'm coming back to post that this hack has sped up my site sooo much faster! Thanks ORban

Boofo
04-28-2006, 10:10 PM
I don't know what the plugin authors thought with modifying templates on run time.

Not having to edit templates and making installs easier for the end user. ;)

orban
04-28-2006, 10:14 PM
Uhm, you can add templates to product.xmls?

Also you might have modified the templates so the str_replace doesn't even work anymore.

Boofo
04-28-2006, 10:17 PM
Hum, you can add templates to product.XML?

You can do it with search and replace. Check out my Last 15 Searches hack. I did it in there. More products are being released that do this now. I do it whenever I can for the reasons stated above. ;)

orban
04-28-2006, 10:50 PM
$vbulletin->templatecache['search_forums'] = str_replace('$navbar', '$navbar' . ' $last15searches', $vbulletin->templatecache['search_forums']);

Somebody might not have a $navbar.

Boofo
04-28-2006, 10:56 PM
$vbulletin->templatecache['search_forums'] = str_replace('$navbar', '$navbar' . ' $last15searches', $vbulletin->templatecache['search_forums']);

Somebody might not have a $navbar.

So far, that hasn't happened yet and really shouldn't unless they are REALLY screwing with their templates. That is standard in alot of templates for vb. When I do search and replaces, I only work from the Master Template set (the default one) and no other products or hacks that I know of use that spot in that certain template. ;)

orban
04-28-2006, 11:01 PM
Why not add $last15searches to the navbar template?

Like $vbulletin->templatecache['navbar'] = $vbulletin->templatecache['navbar'].'.$last15searches'; or something, because would work with the template cache too.

Boofo
04-28-2006, 11:09 PM
Why not add $last15searches to the navbar template?

Like $vbulletin->templatecache['navbar'] = $vbulletin->templatecache['navbar'].'.$last15searches'; or something, because would work with the template cache too.

Because the replace for that is a template edit. You would then have to manually edit the template. With the way I did it, you don't have to touch the template and it will be better on ungrades where vb adds to or changes to the template. ;)

orban
04-28-2006, 11:11 PM
No you don't? That's PHP code to be run in the plugin, instead of your str_replace.

Boofo
04-28-2006, 11:16 PM
No you don't?

Ok, I think I see what you are saying. Instead of coming from the bottom up you go from the top down sort of thing. Yes, that would probably work for that one hack, unless, like you stated before, someone didn't have a navbar. But in the User CP Signature hack I just released yesterday, although it is in almost the same spot, you couldn't do it like you are saying.

vBShout is another one that wouldn't work like you mentioned. A lot of authors are doing the search and replace now so alot of the future hacks won't work. One way you could do it is check a hack and see what template needs to be excluded and add that in your hack as a default setting if they have that hack installed. But then, that would mean more work for you. ;)

orban
04-29-2006, 10:11 AM
Okay you're right. But I don't see what's so bad about adding a $whatever_plugin_name to some template, you can even choose then where exactly you want to add the plugin.

But to be honest, this plugin is actually for bigger boards (you probably won't notice any different on smaller ones anyway) and on bigger boards you aren't going to install those hack that add several new queries to every page. And a lot of plugins I see here are awful for bigger boards. And if you own a bigger board you most likely know PHP and then it's no problem to fix it or rewrite it. I am more concerned about optimization that a new feature X that slows down my board.

In your new plugin there, why is the signature between new PMs and new subscribed posts? If you added a variable $plugin_signature, a user could choose where to add it, at the top, at end, after new subscribed posts...well, that's my opinion. It will for sure not break anything after a vB upgrade, there is a new feature to compare updated templates to old ones, so you can see what you added, in the worst case you have to add it again.

vBShout uses comments to for its str_replace. Ouch. What about all those template optimizers (they're all usesless anyway if you use gzip, by the way, but that's not the point here ;)) that remove comments? The comments might be renamed, or removed, or there might be a second one named "<!-- main -->" from your own templates...I just don't think that's too smart. I don't understand why not just add to the installation a template edit where you can add $vbshoutbox wherever you want it to have.

TECK
04-29-2006, 02:07 PM
I installed this mod, looks good. Thanks. :)
However, I renamed the template_cache file to functions_template_cache.php and made it to be used in /includes folder.
That's where it should be... I could post the changes here, if you want.

I'm new with VB3, kind of old school VB2.
Can you post a Cron Job to delete the eval templates? Or they are supposed to stay there.
Thanks for explaining...

Thanks for this great hack. eAccelerator loves it... :)

orban
04-29-2006, 03:38 PM
I installed this mod, looks good. Thanks. :)
However, I renamed the template_cache file to functions_template_cache.php and made it to be used in /includes folder.
That's where it should be... I could post the changes here, if you want.

I'm new with VB3, kind of old school VB2.
Can you post a Cron Job to delete the eval templates? Or they are supposed to stay there.
Thanks for explaining...

Thanks for this great hack. eAccelerator loves it... :)

Because it saves several templates in one file, and on some pages it might exceed the 255/230 filename lenght.

Boofo
04-29-2006, 04:42 PM
Okay you're right. But I don't see what's so bad about adding a $whatever_plugin_name to some template, you can even choose then where exactly you want to add the plugin.

But to be honest, this plugin is actually for bigger boards (you probably won't notice any different on smaller ones anyway) and on bigger boards you aren't going to install those hack that add several new queries to every page. And a lot of plugins I see here are awful for bigger boards. And if you own a bigger board you most likely know PHP and then it's no problem to fix it or rewrite it. I am more concerned about optimization that a new feature X that slows down my board.

In your new plugin there, why is the signature between new PMs and new subscribed posts? If you added a variable $plugin_signature, a user could choose where to add it, at the top, at end, after new subscribed posts...well, that's my opinion. It will for sure not break anything after a vB upgrade, there is a new feature to compare updated templates to old ones, so you can see what you added, in the worst case you have to add it again.

vBShout uses comments to for its str_replace. Ouch. What about all those template optimizers (they're all usesless anyway if you use gzip, by the way, but that's not the point here ;)) that remove comments? The comments might be renamed, or removed, or there might be a second one named "<!-- main -->" from your own templates...I just don't think that's too smart. I don't understand why not just add to the installation a template edit where you can add $vbshoutbox wherever you want it to have.

Well, it's the same thing with the plug-ins, before they came along. You had to hack a file for the smallest change on your site. Upgrades took forever, especially on bigger boards. Now, upgrades are a breeze for the most part, and even better for larger boards.

Myself, I agree with you on the versatility of adding a line to the template for all of the reasons you stated above and more. But we are getting more and more members here that don't know coding and don't really care to learn. And we are all spoiled now by the plug-in system and we want to do even less to our sites manually. Everything is going automatic, my friend. LOL

Doing the search and replace is more of a learning tool for me than anything else. I'm still new at it and have a lot to learn. But I think it's great when you can install a product in about 2 seconds that used to take you anywhere up to an hour to do the files and template edits, if it was a major hack. Remember Lesane's Store hack? ;)

Sooner or later I expect the template system to get a overhaul just like vb did when we got the plug-in capability added to it. And you have to admit, it does make life a lot easier and less complicated in adding things to your site and upgrading. ;)

orban
04-29-2006, 05:14 PM
Upgrades are mainly a breeze because you don't have to edit files anymore, we still have about 10 templates that are edited from the default, even if I moved as much of it to plugins (attaching stuff to existing variables). About 2 of those change after an update but with the new template history things it's easy to update.

I agree that lots of users come here who don't have a clue, but I still don't think that just the "click and forget about it" mentality is good. You should at least check every link in the admincp and try to understand what's going on, and that includes the template system, when you get yourself a copy of vB. Just read the help forums of vb.com, I mean...uh.

If you don't have a clue about anything vB then you shouldn't come here on vB.org because the attitude of certain members is really awful, they except everything they click on to work without any extra work. And then if it breaks you get pages of awful error reports and whines (this is not aimed towards this thread at all, but check some of the more popular addons).

And also I don't care how easy it if for my addon to install or how many users install it, I want to share something I wrote for my own board that was useful for myself. (I'm still using my first version of this plugin by the way, without the admincp options and all that clutter, I just don't need it.)

Yeah I agree, a few "hooks" in the templates would be nice, like $template_hook_GLOBAL_1 or something under the menu, etc, would be awesome and solve this problem. I also honestly thought that vB seperated all different sections into different templates, eg. one for new PMs, one for new threads, one for subs. forums, and so on. Didn't know it was all stuffed in one template.

Well that's my opinion, not saying anybody else must have it.

Boofo
04-29-2006, 05:38 PM
If you don't have a clue about anything vB then you shouldn't come here on vB.org because the attitude of certain members is really awful, they except everything they click on to work without any extra work. And then if it breaks you get pages of awful error reports and whines (this is not aimed towards this thread at all, but check some of the more popular addons).

That's my point. You are going to get the whining and error reports no matter what you do, if they have to edit one single template even. By doing it for them, that cuts out at least part of the problem. If you'll notice, a lot of the error reports in hacks that search and replace template code is for php coding problems, not install and template problems as much anymore. I'm a firm believer that getting rid of part of the problem is better than not getting rid of any of it at all.

I agree that lots of users come here who don't have a clue, but I still don't think that just the "click and forget about it" mentality is good. You should at least check every link in the admincp and try to understand what's going on, and that includes the template system, when you get yourself a copy of vB. Just read the help forums of vb.com, I mean...uh.


And no matter how much you say it to them, they're not going to change. We have spoiled them along the way and now we have to deal with it, I guess. ;)

orban
04-29-2006, 05:40 PM
Okay I guess I understand what you mean and I have to agree with you there. This was a nice thread hijack :D

Boofo
04-29-2006, 05:53 PM
Okay I guess I understand what you mean and I have to agree with you there. This was a nice thread hijack :D

Didn't mean to hijack it, sorry. :(

orban
04-29-2006, 05:56 PM
Haha it's fine, at least it looks now as if this plugin was very popular with 10 pages of comments! And I made the comment about the plugin authors here too, so it's your right :D

Boofo
04-29-2006, 07:24 PM
Haha it's fine, at least it looks now as if this plugin was very popular with 10 pages of comments! And I made the comment about the plugin authors here too, so it's your right :D

I would like to try this when my board starts getting active. Or when you make a setting for templates to exclude (unless you've already done that). ;)

orban
04-29-2006, 07:28 PM
Done it of course, with one of these neat vB options you can add to your product.xml

And you only need them to exclude when you're using the option to save certain templates in a seperate file anyway.

Boofo
04-29-2006, 07:33 PM
Done it of course, with one of these neat vB options you can add to your product.xml

And you only need them to exclude when you're using the option to save certain templates in a seperate file anyway.

Are the default settings the recommended way to go then?

TECK
04-29-2006, 10:01 PM
Because it saves several templates in one file, and on some pages it might exceed the 255/230 filename lenght.
You did not reply to my question.
Can you give me more details? Thanks.

I'm new with VB3, kind of old school VB2.
Can you post a Cron Job to delete the eval templates? Or they are supposed to stay there.
Thanks for explaining...

Paul M
04-30-2006, 12:29 PM
I'm not sure what the problem with [template] search and replace plugins is supposed to be, but I have this installed on my test forum atm, and all my plugins seem to work fine.

orban
04-30-2006, 12:33 PM
Are the default settings the recommended way to go then?

There are no default settings ;)

Can either turn the template cache on or off, and saving to seperate files for bigger templates on or off.

You did not reply to my question.
Can you give me more details? Thanks.

You don't have to clear the folder, it clears itself when you edit templates. There is no clutter in the folder, no need to clear it. Every file in that folder is being used, even if some are used rarely (like not all people visit faq.php).

I'm not sure what the problem with [template] search and replace plugins is supposed to be, but I have this installed on my test forum atm, and all my plugins seem to work fine.

Did you activate the "save templates to seperate files" option?

TECK
04-30-2006, 04:21 PM
Thanks Orban. :)

Paul M
04-30-2006, 04:34 PM
Did you activate the "save templates to seperate files" option?No.
.
.

orban
04-30-2006, 04:36 PM
Only that option can cause problems with addons that use str_replace($template...)

Paul M
04-30-2006, 04:46 PM
Only that option can cause problems with addons that use str_replace($template...)Oh okay. I'm not planning to use that option, without going through 10+ pages I'm not really sure why it's there.

BamaStangGuy
04-30-2006, 11:28 PM
Well I use APC cache and I use Paul M's visitors today hack and if I use save templates to seperate files it doesnt show his hack.... anyway around it or is it being worked on?

Paul M
04-30-2006, 11:35 PM
1. Don't use the save to seperate files option.
or
2. Add FORUMHOME to the exceptions list.

BamaStangGuy
04-30-2006, 11:36 PM
1. Don't use the save to seperate files option.
or
2. Add FORUMHOME to the exceptions list.
Alright thanks

orban
05-02-2006, 11:10 AM
Why doesn't vB.org send thread email notifications? :(

I'll keep this thread open now and try to check it every day manually.

MissKalunji
05-02-2006, 11:12 AM
perhaps you didnt tick it in your options?

orban
05-02-2006, 11:13 AM
Oh I did, I just got a notification about your post, but not about BamaStangGuy's.

vampireus
05-03-2006, 02:49 AM
I have problem logging in and out after using this mod a day, get blank page while doing that. Other activities are fine. Plz advise, thanks.

orban
05-03-2006, 08:42 AM
normal login/logout or admincp/modcp login/logout?

Any PHP errors? Might be a problem with a PHP error that prevents cookies being set. Check your logs if possible. And are you still running 3.5.2? Maybe upgrade to 3.5.4.

da420
05-04-2006, 01:57 PM
With this enabled my new posts are not showing up. New posts are not bold, and when I click on New Posts, it doesn't show any new posts even when there are new ones. Any way to fix this?

orban
05-04-2006, 03:40 PM
Got any plugins installed? Any that modify the new post behaviour?

vampireus
05-07-2006, 03:55 AM
normal login/logout or admincp/modcp login/logout?

Any PHP errors? Might be a problem with a PHP error that prevents cookies being set. Check your logs if possible. And are you still running 3.5.2? Maybe upgrade to 3.5.4.

I'm using vB 3.5.4. Now I get blank pages randomly after using the mod for a while. Clear the cache will fix it, no PHP errors.

orban
05-07-2006, 08:28 AM
Has your board heavy traffic? Shared hosting? PHP version? Are you using a PHP cache?

vampireus
05-07-2006, 07:45 PM
Yes my board has heavy traffic. Dedicated hosting. PHP 5.0.5. I'm using APC

DementedMindz
05-07-2006, 07:46 PM
i have heavey traffic also with no problems at all and i have alot of mods installed..

orban
05-07-2006, 07:49 PM
You *should* run PHP 5.1, PHP 5.0 is not recommended by PHP I think.

Blank page? That usually sounds like a parsing error or something. Can you check all the files in the templates/ folder if they are empty? Or somehow corrupted? APC cache too small?

FiX
05-07-2006, 08:00 PM
I installed it without any problems, but it does not cache anything. The /templates folder ist chmode 777, but no files appear when browsing the forums

any ideas?

(yes it is enabled)

vampireus
05-08-2006, 12:05 AM
I would like to upgrade PHP too, but my board's webmaster don't want to cuz the database is over 5GB.

Here is APC conifg, anything I should change? apc.max_file_size 1M is too small, maybe?

apc.cache_by_default On On
apc.enable_cli Off Off
apc.enabled On On
apc.file_update_protection 2 2
apc.filters no value no value
apc.gc_ttl 3600 3600
apc.max_file_size 1M 1M
apc.mmap_file_mask no value no value
apc.num_files_hint 1000 1000
apc.optimization Off Off
apc.shm_segments 1 1
apc.shm_size 64 64
apc.slam_defense Off Off
apc.ttl 0 0
apc.user_entries_hint 100 100
apc.user_ttl 0 0

Nothing's wrong with files in folder templates.

orban
05-08-2006, 09:42 AM
I installed it without any problems, but it does not cache anything. The /templates folder ist chmode 777, but no files appear when browsing the forums

any ideas?

(yes it is enabled)

Mmhh, that's a tough one. Is the templates/ folder in your forums/ directory?

If you know PHP you could try to change the relative paths in the template_cache.php to absolule paths?

Running safe mode? Or SuEXEC PHP or something similar? Seems like it's a permission problem to be honest...

I would like to upgrade PHP too, but my board's webmaster don't want to cuz the database is over 5GB.

Here is APC conifg, anything I should change? apc.max_file_size 1M is too small, maybe?

apc.cache_by_default On On
apc.enable_cli Off Off
apc.enabled On On
apc.file_update_protection 2 2
apc.filters no value no value
apc.gc_ttl 3600 3600
apc.max_file_size 1M 1M
apc.mmap_file_mask no value no value
apc.num_files_hint 1000 1000
apc.optimization Off Off
apc.shm_segments 1 1
apc.shm_size 64 64
apc.slam_defense Off Off
apc.ttl 0 0
apc.user_entries_hint 100 100
apc.user_ttl 0 0

Nothing's wrong with files in folder templates.

Mine is 64mb too and that's enough...hm. My max_file_size is 1mb too. What is the full http request on the blank page? Just "HTTP/1.x 200 OK" and "Content-Length: 0"? Or some error?

Do you log PHP errors to a file?

Coast to Coast
05-09-2006, 10:17 PM
Installed for the Travel Adventures community

dbembibre
05-09-2006, 11:11 PM
Is posible add a new param in ACP->Forum Options->Template cache to change the standard dir templates to another dir ??
I wont change the standard dir /forum/templates to another drive to gain in speed.

Another question, is recommended disable the vBulletin datastore cache with this hack or not ?

Excuse my broken English

orban
05-10-2006, 08:21 AM
Is posible add a new param in ACP->Forum Options->Template cache to change the standard dir templates to another dir ??
I wont change the standard dir /forum/templates to another drive to gain in speed.

Another question, is recommended disable the vBulletin datastore cache with this hack or not ?

I am running it with vBulletin datastore cache and it works fine.

Uploaded a new version 1.0.3 with this option added. No other changes were made, if it's running fine for you there is no need to upgrade.

Kihon Kata
05-11-2006, 02:53 AM
////////////// Hotm \\\\\\\\\\\\\\

MissKalunji
05-11-2006, 03:47 AM
what its up? danm i'll be voting for that hack for sure!

orban
05-11-2006, 01:32 PM
EoTM more like! Extension of the month! :D

Jafo232
05-11-2006, 05:07 PM
Installed today. Have a site that gets some heavy traffic from time to time. Installed APC which speeds things up greatly, then installed your hack which made that sites forum fly.

Using the separate files option.

Does save the 1 mysql call per page as advertised.

CLICKED INSTALL.

orban
05-11-2006, 05:27 PM
Happy to hear!

Benedict
05-11-2006, 05:50 PM
Hello,

I love the idea of this mod :)

I have zend installed would you advise that I switch on the "Cache Templates Seperatly" feature

Many thanks

Ben

orban
05-11-2006, 08:43 PM
I don't know, it depends on too many factors. Just try it out.

Living in music
05-14-2006, 12:02 AM
i love it! Installed for my site ;)

HuangA
05-15-2006, 06:06 AM
Can't do that, because there is no way I can find out on what pages that template is used. The saved files aren't templates, they are collections of templates.
Can you at least make sure it doesn't delete the index.* pages? I've got it setup so that if anyone who tries to go there will be forwarded back to forum home and long and behold, it was deleted before I know it :X

DementedMindz
05-15-2006, 07:14 AM
i dont have a problem at all wth it erasing my index.php file opps had it backwards my index.html

orban
05-15-2006, 10:39 AM
It doesn't remove a index.html. I can add index.php to the list of files not to be removed if you want.

You can edit template_cache.php:105 to fix it right now.

There is no security problem with people accessing templates/ or even one of the files directly. The files are just

<?php
$variable = ".....alot of stuff.....";
?>

and nothing else.

goyo
05-15-2006, 09:12 PM
Sounds great...unfortunately it's not compatible with Plugin Accelerator plugin. It screws up my main page (no shoutbox, weird who's online) when using them combined...

:cross-eyed: :tired:

Correction: even using it alone the shoutbox (vbshout (https://vborg.vbsupport.ru/showthread.php?t=93097)) goes away :(

orban
05-15-2006, 09:33 PM
Yes, you have to exclude FORUMHOME (I think?) when using it. Read the instructions ;) Or disable the save as seperate file option.

Can you link me the plugin acc plugin?

orban
05-16-2006, 11:21 AM
You can nominate this extension by clicking "Nominate this mod" in the "Mod Options" section on this page. (For June I think.)

https://vborg.vbsupport.ru/showthread.php?t=115685

TECK
05-17-2006, 12:58 AM
Sounds great...unfortunately it's not compatible with Plugin Accelerator plugin. It screws up my main page (no shoutbox, weird who's online) when using them combined...

:cross-eyed: :tired:

Correction: even using it alone the shoutbox (vbshout (https://vborg.vbsupport.ru/showthread.php?t=93097)) goes away :(
Use eAccelerator. The mix between the 2 components rocks my vBulletin forums.

PennylessZ28
05-17-2006, 01:25 AM
I tried to unistall this, it doesn't mix with the plugin accelator, now all my pages are blank white. I had to manually disable plugins, can't turn them back on or else.

orban
05-17-2006, 08:51 AM
I tried to unistall this, it doesn't mix with the plugin accelator, now all my pages are blank white. I had to manually disable plugins, can't turn them back on or else.

Try to clear the templates/ folder and edit global.php and remove

cache_templates_with_file_cache($globaltemplates, $style['templatelist']);
$globaltemplates = array();

Can somebody link me that plugin accelerator? Is it the one that edits your .php files?

With all due respect, that's an awful hack.

MissKalunji
05-17-2006, 12:01 PM
i like that hack its been working and speeding up my site :S why everyone complainning about it?

DementedMindz
05-17-2006, 01:04 PM
Can somebody link me that plugin accelerator? Is it the one that edits your .php files?

With all due respect, that's an awful hack.

here you go

https://vborg.vbsupport.ru/showthread.php?t=107315

TECK
05-17-2006, 01:37 PM
While looking at the code fast ... Basically, the plugin accelerator writes all exististing installed plugins to files. Then, it reads TWICE(instead of once) ALL(instead of only the needed) newly created hook/plugin files, every time you access a forum page. In other words, you process a lot of unnecesary data. Since when reading many files in block is faster then reading a small piece of data from a database table? I might be wrong, since I only examined the class included in the plugin files... Feel free to comment on this, we are here to learn, not to put down other coders.

Why not just leave it the way it is made by vBulletin and install eAccelerator or APC?
eAccelerator, on top of caching the queries, it optimizes the PHP code also...

orban
05-17-2006, 01:41 PM
Well, I see several problems with that addon, don't even know where to start. I would not recommend using that at all since it can essentially ++++ up your installation. What happens if you insert some bad code in for example the global hook? You can't even disable that addon anymore then. Then you have to make all your files world writable. I'll add a note that using this plugin is not recommended with this extension.

TECK: As far as I can see, the plugin accelerator plugin writes the plugins INTO the official vBulletin files INSTEAD of the hook calls. So you basically end up hacking the offcial vBulletin files. Meaning when something goes wrong you can reinstall vBulletin. The problem is that APC/eAcc doesn't cache eval().

What I DO recommend is when you're having a lot of plugins move the code to an external .php file and include that one at the global hook. I have a 20kb plugin.php with all my php code in it, I only add if's and function calls to the actual plugins.

MissKalunji
05-17-2006, 02:31 PM
Well, I see several problems with that addon, don't even know where to start. I would not recommend using that at all since it can essentially ++++ up your installation. What happens if you insert some bad code in for example the global hook? You can't even disable that addon anymore then. Then you have to make all your files world writable. I'll add a note that using this plugin is not recommended with this extension.

TECK: As far as I can see, the plugin accelerator plugin writes the plugins INTO the official vBulletin files INSTEAD of the hook calls. So you basically end up hacking the offcial vBulletin files. Meaning when something goes wrong you can reinstall vBulletin. The problem is that APC/eAcc doesn't cache eval().

What I DO recommend is when you're having a lot of plugins move the code to an external .php file and include that one at the global hook. I have a 20kb plugin.php with all my php code in it, I only add if's and function calls to the actual plugins.


Ive been using it with yours and everything seems fine


explain external.php ?

orban
05-17-2006, 02:38 PM
Well just see this extension, instead of putting all the PHP code into a plugin I move it to template_cache.php and just add a few lines to the plugins.

dbembibre
05-17-2006, 03:33 PM
I am running it with vBulletin datastore cache and it works fine.

Uploaded a new version 1.0.3 with this option added. No other changes were made, if it's running fine for you there is no need to upgrade.

Thanks for the update Orban, your hack work really fine ;)
Thanks for your great job :)

MissKalunji
05-17-2006, 03:44 PM
Well just see this extension, instead of putting all the PHP code into a plugin I move it to template_cache.php and just add a few lines to the plugins.


oh ok *scratches head*

DementedMindz
05-17-2006, 06:13 PM
oh ok *scratches head*


me too :confused:

TECK
05-17-2006, 07:10 PM
It's pretty easy.
He's having a master code static page, probably separated in functions.
Then, he calls the specific functions in plugin, with one line of code. Faster.

orban
05-17-2006, 09:42 PM
Yes exactly.

MissKalunji
05-17-2006, 09:43 PM
It's pretty easy.
He's having a master code static page, probably separated in functions.
Then, he calls the specific functions in plugin, with one line of code. Faster.


easy when you understand :confused: *feeling blond*

orban
05-18-2006, 12:24 AM
Well, instead of adding


if ($badfadf)
{
$post['blabdfd'] = '234324'324'324234'34;
$do
$some
$very
$complicated
$stuff
}
else
{
$more stuff
}


to, for example, the hook "post_display_complete", you move the code to a function and just call the function "do_very_complicated_things()" in the hook "post_display_complete". The function itself is in the file plugins.php and gets include('plugins.php'); in the hook "global_start"

Robbed
05-18-2006, 12:47 AM
How does it compare to this hack

https://vborg.vbsupport.ru/showthread.php?t=107615

Would it have to be unistalled?

orban
05-18-2006, 11:18 AM
If you are using gzip the template compression hack is near to useless I think.

But it *should* work with it (you should be able to use both at the same time).

MissKalunji
05-18-2006, 11:25 AM
Ok i get it orban
Thanks

Still chineese for me tho :(

orban
05-18-2006, 11:31 AM
Hehehe :)

almqdad
05-18-2006, 02:26 PM
Hello

thanks orban

I have instaled the plugin

I also have Vbulletin Template Compressor

no problem so far

Robbed
05-18-2006, 03:27 PM
If you are using gzip the template compression hack is near to useless I think.

But it *should* work with it (you should be able to use both at the same time).

OK, I will give it a try

Zia
05-20-2006, 09:50 AM
Hello Orban,

We need a real urgent help...
The folder "Template's" chmood needed to be 777.
But our host (http://www.powweb.com) doesnt allow 777.They are allowing 755 instead of 777.

Could we have an alternate way to install this hack using chmood 755.

Waiting for ur help.

orban
05-20-2006, 10:29 AM
Is he running SuEXEC? Then even 700 is fine.

The problem is that usually PHP runs as a different user than the script is, so to write in folders they have to writeable by world.

You could also ask him to chown the templates/ folder "to PHP" so PHP can write files there.

Zia
05-21-2006, 02:57 AM
Is he running SuEXEC? Then even 700 is fine.

Here Is our System :
System :FreeBSD clust07-www02.powweb.com 4.11-RELEASE FreeBSD 4.11-RELEASE #0: Thu Ma i386

The problem is that usually PHP runs as a different user than the script is, so to write in folders they have to writeable by world.
You could also ask him to chown the templates/ folder "to PHP" so PHP can write files there.

In our host, the host provider does'nt allow ssh. We use Flash FXP for ftp..
would u mind to provide lil.bit more help..how could we do that "to PHP" using FlashFXP ?

Waiting for ur help..

Thnx.

Edit:I search host's forum

http://forum.powweb.com/showpost.php?p=355355&postcount=5
As PowWeb uses SuEXECed CGI/PHP, you don't need to use these unsafe permissions of 666/777,
unless the script is badly written and checks the permission explicitly even they are not required.
Reasonable vendors should be able to correct their code without ptoblem.
Using these unsafe permissions on shared hosting is a suicidal act, with the current situation of the internet.

Can we step forward now?

orban
05-21-2006, 08:50 AM
Yes. You can skip the "777" part, just create the folder and you should be fine.

Zia
05-22-2006, 05:45 AM
Thanx Orban...

Its working.in the folder */templates.
there are lots of "0236aa96292f9f5152491448c0274cb8.php" this kinda names of file are there..yet not checkd the size(mb)...
can them be deleted or i should keep them?

btw can u tell me...how could i check 1 query per page is saved..?
only see in forum home 1 query saved..(it was 22 now 21) but in the other page..? any way to check that 1 query is saved ?

orban
05-22-2006, 10:30 AM
You can turn the extension off (in the vBulletin Options), refresh the page, check the number of queries, then turn it on again, refresh, and check the number again. :)

All the "0236aa96292f9f5152491448c0274cb8.php" type of files are in use and should not be deleted. But it won't break anything if you do, because they just will be recreated.

TomasDR
05-23-2006, 04:12 AM
I will keep it marked installed to see if there is a solution but I am having one issue with this hack so I do have it disabled since my members enjoy the following hack so much.

It breaks the "Who has read" hack: https://vborg.vbsupport.ru/showthread.php?t=112192

Any thoughts?

orban
05-23-2006, 10:50 AM
Yeah, you have to add SHOWTHREAD to "Exclude Templates".

orban
05-24-2006, 09:11 PM
Worked?

Zia
05-25-2006, 02:02 AM
Helo Orban,

we gor it installed.Its working...Thnx Man.
Need lil.bit help..
Like: whenever is there any change in template,we have cache the template again ,right?? But How ?
Every time uninstall ,delete all the ***.php file in */forum/templates ??
its really compliccated...

so if y added a acp option of uncaching..it will be really nice...

plz give a thought on it..

orban
05-25-2006, 09:31 AM
It's automatically removing all the files in templates/ folder when you edit/add any templates.

If this doesn't work for you let me know...!

Kihon Kata
05-25-2006, 01:13 PM
Hey...just wanted to pop in and update everyone who uses this hack. We run a semi active site (1,500-2,200 posts/day). I am running MySQL 4 (with caching) and ALSO caching PHP with eAccelerator. We are Caching Templates Seperately with this hack. The hack is one of the best ones I have ever seen for performance. It seriously sped things up for our site. Our templates folder runs at about 20mbs at any one time.

~Thanks Orban

Zia
05-27-2006, 03:18 AM
It's automatically removing all the files in templates/ folder when you edit/add any templates.

If this doesn't work for you let me know...!

helo Orban,

nop it does'nt remove all the *************.php files in */forum/templates
we had to del all the files manually..we un-install this & re-install again for cache again...after template edit.

one more point:
to cache all template separately- php acclerator needed to be installed
In our host
the Zend Optimizer info is there. So your PHP processes 'are' being accelerated.

so we can cache template separately using this zend optimizer?

waiting for ur early reply..

Thnx.

orban
05-27-2006, 07:55 AM
Thank you Kihon Kata!

nop it does'nt remove all the *************.php files in */forum/templates
we had to del all the files manually..we un-install this & re-install again for cache again...after template edit.

Can you check if the plugin "include template_cache.php & clear template cache" in the hook "admin_global" is installed in your installation?

That hook holds the function to clear the templates/ folder if either a new template is added or a template is edited.

This works for me and I hope for the other customers in here because if it was an issue I'm sure it would have come up. It's maybe a special problem with your PHP environment. What versions are you running? It's really hard to debug such things over a web forum if you really want it fixed you might need to let somebody on it who knows PHP and all that stuff and can check it over FTP on your installation or something.

one more point:
to cache all template separately- php acclerator needed to be installed
In our host

so we can cache template separately using this zend optimizer?

As far as I know Zend Optimizer does not cache PHP code, it just optimizes it. So the option to cache templates seperately is probably not recommended for you (I'd only recommend using it when you use a PHP cache like APC/eAccelerator/...

Zia
05-27-2006, 08:18 AM
oh..okay then.....

if i send u our php.ini can u understand the situation?

orban
05-27-2006, 08:23 AM
A phpinfo() would be enough, I'll try to find something out but can't guarantee anything :(

Zia
05-27-2006, 08:50 AM
helo Orban,

PHP Version 4.4.2
Build Date Feb 22 2006 18:00:44
Configure Command:'./configure' '--prefix=/usr/local/php4' '--with-pear=/usr/local/lib/php' '--with-pspell' '--with-t1lib' '--with-mime-magic' '--enable-force-cgi-redirect' '--enable-safe-mode' '--enable-versioning' '--with-mysql=/usr/local' '--with-enabled-local-infile' '--with-dbase' '--enable-ftp' '--with-openssl' '--with-imap' '--with-imap-ssl' '--enable-sysvsem' '--enable-sysvshm' '--enable-shmop' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-freetype-dir' '--with-jpeg-dir=/usr/local' '--with-zlib' '--enable-libgcc' '--enable-mbstring' '--enable-xslt' '--with-xslt-sablot' '--with-gettext' '--with-curl' '--with-mcrypt' '--with-dom' '--with-dom-xslt' '--with-mhash' '--with-zip' '--with-bz2' '--with-iconv' '--enable-exif' '--enable-bcmath' '--enable-calendar' '--enable-xslt' '--with-xslt-sablot' '--enable-sockets' '--enable-wddx'

Server API : CGI
PHP API : 20020918
PHP Extension: 20020429
Zend Extension : 20050606

Zend Memory Manager : enabled
Registered PHP Streams : php, http, ftp, https, ftps, compress.bzip2, compress.zlib

Optimization Pass 1 enabled
Optimization Pass 2 enabled
Optimization Pass 3 enabled
Optimization Pass 4 enabled
Optimization Pass 9 disabled
Zend Loader enabled

els that if u need any more info..i can give u..admin pass/ftp pass

plz have a look

Thnx man for ur support

Zia
05-27-2006, 09:05 AM
zend cache will do the work ?

orban
05-27-2006, 10:32 AM
zend cache will do the work ?

Yes, Zend Cache caches PHP scripts as far as I know.

dutchbb
05-28-2006, 03:14 PM
Wel, it seems to be working, but my plugins have no effect anymore. There just gone....

So is disables other hacks, too bad have to uninstall this then..

orban
05-28-2006, 03:16 PM
It doesn't disable anything.

What plugins do not work? Can you disable the "Cache Templates Seperatly" option and see if they work?

dutchbb
05-28-2006, 03:21 PM
When I disable that the plugins work again yes, however:

This option is only recommended if you use a PHP cache like APC/eAccelerator/etc. This can also decrease performance if you're not using a PHP cache.

I do use eAccelerator, so disabling it wouldn't be a good idea?

Besides that it does seem to make the board faster, lower the load and if i'm correct there is a query gone on every page, so nice hack.

orban
05-28-2006, 03:34 PM
Let me know with what plugins you have problems. It's just most likely due to the fact that they are not compatible with the "Cache Templates Seperatly" and you can partially fix that by excluding some templates.

dutchbb
05-28-2006, 04:01 PM
Let me know with what plugins you have problems. It's just most likely due to the fact that they are not compatible with the "Cache Templates Seperatly" and you can partially fix that by excluding some templates.
Well AFAICS

- Add PhotoPost Pro to each forum 1.0 Add PhotoPost Pro to each forum

- Bump Threads/Make Threads older 1.0.0 This Hack allows you to bump Threads or make them older


The rest seem to be working ok.

orban
05-28-2006, 05:35 PM
Add SHOWTHREAD and FORUMDISPLAY to the templates to be excluded.

Zia
05-29-2006, 04:04 AM
Yes, Zend Cache caches PHP scripts as far as I know.

Helo Orban,
I have send u am PW containing some information.
Plz check ur pm

dutchbb
06-01-2006, 10:56 AM
Well I uninstalled this now because it gave me nothing but problems, even with templates exccluded it doesn't work together with vBSEO!

Now still after it's uninstalled it screwed up my whole board, members get "page cannot be found" almost every 4 clicks and I have it too. It's very clear that this hack made this problem.

I'm so mad, don't even know where to search for the problem seems like my database is completely corrupt now :mad:

orban
06-01-2006, 11:09 AM
It's not my fault this doesn't work with vBSEO which is a commercial product that probably modifies vBulletin heavily, I have no way to get a copy of vBSEO to test this extension with it. This extension requires vBulletin 3.5.4.

What steps did you do to uninstall this extension?

If you remove the product.xml no traces are left in your installation except the template_cache.php and the templates folder which you can delete in your FTP program or SSH access.

This extension does not modify the database or any files.

If you are still experiencing problems please:
-Remove all products and plugins related to this extension (there's 4 plugins and 1 product)
-Clear the templates/ folder and make sure no new files are created
-Delete the templates/ folder
-Delete template_cache.php

dutchbb
06-01-2006, 11:35 AM
Thanks,

I cleaned out the eaccelerator cache and now all problems are over. But it doesn't work well with vbseo, so be warned if you use that.

MissKalunji
06-01-2006, 11:36 AM
Thanks

I cleaned out the eaccelerator cache and now all problems are over. But it doesn't work well with vbseo, so be warned if you use that.

I beg to differ i have vbseo and its working like a charm!

orban
06-01-2006, 11:51 AM
Thanks,

I cleaned out the eaccelerator cache and now all problems are over. But it doesn't work well with vbseo, so be warned if you use that.

Ah right, sorry, I'm using APC and it automatically removed them when I removed the templates/ folder on my test installation.

What errors were you getting? Is there a way to get a vBSEO trial or something so I can check that out? Are you using the latest vBSEO & vBulletin?

kellyandmike
06-02-2006, 12:36 AM
I am a newbie installing this and I get this error. Can someone help me?

Warning: Unknown(template_cache.php): failed to open stream: No such file or directory in /admincp/options.php(843) : eval()'d code on line 6

Warning: (null)(): Failed opening 'template_cache.php' for inclusion (include_path='.:/usr/local/lib/php') in /admincp/options.php(843) : eval()'d code on line 6

Fatal error: Call to undefined function: clear_template_cache() in /home/myusername/public_html/feedback/admincp/options.php(843) : eval()'d code on line 7

orban
06-02-2006, 12:45 AM
Did you follow the install steps?

Razasharp
06-02-2006, 02:12 AM
I'm not quite sure what this 'caches' (sorry bit of a nube!)..

Does it cache templates such as postbit, threadbit etc etc? Or does it cache whole pages?

In simple terms how does this save resources or speed things up?

What is the best thing to look out for once it's installed to 'see' if it's having any impact? Speed when server loads are up or speed in general?

Sorry for the newbie-type questions - and thanks for what seems like will be a very useful hack :)

kellyandmike
06-02-2006, 02:15 AM
Did you follow the install steps?

Yes. Can you help?

orban
06-02-2006, 09:43 AM
Yes. Can you help?

-/home/.../forums/templates/
-/home/.../forums/templates/index.html
-/home/.../forums/template_cache.php

Do you have this structure?

From your error messages it looks like template_cache.php is not found.

I'm not quite sure what this 'caches' (sorry bit of a nube!)..

Does it cache templates such as postbit, threadbit etc etc? Or does it cache whole pages?

In simple terms how does this save resources or speed things up?

What is the best thing to look out for once it's installed to 'see' if it's having any impact? Speed when server loads are up or speed in general?

Sorry for the newbie-type questions - and thanks for what seems like will be a very useful hack :)

It saves all the templates needed for one page (eg. showthread.php) in one file and saves the database query that would be needed to get them. You can also save certain sized templates seperately and thus avoid the eval() call. It both lowered page creation time and server load for me.

Razasharp
06-02-2006, 11:16 AM
Thanks Orban - I'm beginning to notice a speed difference now I guess the caching is happening.

Well done on a great hack!

kellyandmike
06-02-2006, 12:22 PM
[QUOTE=orban]-/home/.../forums/templates/
-/home/.../forums/templates/index.html
-/home/.../forums/template_cache.php

Do you have this structure?

Ok got it now! I had put the templates_cache.php file in my templates folder instead of just the forums folder. It was saved successfully when I turned it on. Now we will see what it does.

Thanks so much for this and your quick responses.

orban
06-02-2006, 12:26 PM
Yeah, it's not in the templates folder :)

BamaStangGuy
06-15-2006, 06:55 AM
I love this hack. It has helped my load times tremendously. I only wish I could use the option to seperate the files into smaller bits but I have to many hacks installed the add template info on the fly.

orban
06-15-2006, 09:18 AM
Yeah, it's just not possible then. Unless you know enough PHP to replace the str_replace with a $temp_variable = ... and then add $temp_variable to the template...

TECK
06-17-2006, 08:54 AM
Well I uninstalled this now because it gave me nothing but problems, even with templates exccluded it doesn't work together with vBSEO!

Now still after it's uninstalled it screwed up my whole board, members get "page cannot be found" almost every 4 clicks and I have it too. It's very clear that this hack made this problem.

I'm so mad, don't even know where to search for the problem seems like my database is completely corrupt now :mad:
The hack is working perfectly with vbSEO. :)

sduckie2k5
06-20-2006, 05:37 PM
Works great, thankyou! ^^