Caching templates if they exists.
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #14
RE: Caching templates if they exists.
(05-23-2012 05:57 PM)Sama34 Wrote:  they can just paste {$memprofile['agis']['8']} inside the member_profile template.
I just don't get why you want to do this though.
Do you need the extra flexibility of simply appending it to {$memprofile['agis']} ?

Again, why not add an extra column into the usergroups table which has custom HTML for the group image - do you absolutely have to do it through profiles?

Even if so, it's unlikely that a user will have that many groups, so just cache them using $templates->cache function will work:

PHP Code:
1
2
3
4
5
6
7
8
9
// $usergroups contains all groups' IDs user is a part of
$templates_to_cache = 'member_profile_groupimage_' . implode(',member_profile_groupimage_', $usergroups);
$templates->cache($templates_to_cache);

...

foreach($usergroups as $usergroup)
  if($templates->cache['member_profile_groupimage_'.$usergroup]) // weak condition: you may wish to change if you want 100% accuracy, but not that important
    eval('$booyah = "'.$templates->get_the_damn_thing('member_profile_groupimage_'.$usergroup).'";');


My Blog
05-23-2012 06:44 PM
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. - ZiNgA BuRgA - 05-23-2012 06:44 PM

 Standard Tools
Forum Jump: