vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Board Optimization - Plugin Based Template Cache (https://vborg.vbsupport.ru/showthread.php?t=113002)

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

Quote:

Originally Posted by orban
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

Quote:

Originally Posted by Urban
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

Code:

$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

Quote:

Originally Posted by orban
Code:

$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

Quote:

Originally Posted by orban
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

Quote:

Originally Posted by orban
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

Quote:

Originally Posted by TECK
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

Quote:

Originally Posted by orban
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

Quote:

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.

Quote:

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

Quote:

Originally Posted by orban
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

Quote:

Originally Posted by orban
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

Quote:

Originally Posted by orban
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

Quote:

Originally Posted by orban
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.

Quote:

Originally Posted by TECK
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

Quote:

Originally Posted by Boofo
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.

Quote:

Originally Posted by TECK
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).

Quote:

Originally Posted by Paul M
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

Quote:

Originally Posted by orban
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

Quote:

Originally Posted by orban
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

Quote:

Originally Posted by Paul M
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?


All times are GMT. The time now is 11:03 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
  • Page Generation 0.01498 seconds
  • Memory Usage 1,846KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (20)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete