Caching templates if they exists.
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #9
RE: Caching templates if they exists.
Ok, I will try.

What my plugin does is show all additional usergroup images in profile, just like any other plugin already does, using the {$memprofile['agi']}.

The thing is, admins can put {$memprofile['agis']['1']}, {$memprofile['agis']['5']}, etc..

{$memprofile['agis']['1']} is suppose to work just like {$memprofile['agi']} but using the "member_profile_groupimage_1" template for GoupID = 1 (guest image).

If template "member_profile_groupimage_1" was no cached at global_start it means it was not created by the admin (doesn't exists), since the plugin doesn't create those additional templates automatically.


But if I do:

PHP Code:
eval("\$memprofile['agis'][$gid] = \"".$templates->get('member_profile_groupimage_'.$gid)."\";");


MyBB will try to re-get the template (since it was not cached at global_Start because it doesn't exists) and if it was not cached it will make a query to get it from the DB.

The thing is, we already know it doesn't exists, because, again, it was no cached at global_start, so I want to avoid MyBmaking that extra query.


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
(This post was last modified: 05-22-2012 02:23 PM by Sama34.)
05-22-2012 02:19 PM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Caching templates if they exists. - Sama34 - 05-07-2012, 01:50 PM
RE: Caching templates if they exists. - Sama34 - 05-22-2012 02:19 PM

 Standard Tools
Forum Jump: