More efficient fetch?
| From: | Peter Bowyer | Date: | Sat, 19 Jan 2002 20:07:45 +0000 |
| Subject: | More efficient fetch? | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-2549@lists.php.net to get a copy of this message | ||
Hi,
I think there may be a need for a Smarty function that will fetch the template the first time, and then reference it as a string for the next 'n' requests for the template, where n is an integer. I have come across situations that could make use of it such as when I have templates like the following:
<table width="160" align="{$article_image_align}">
<tr>
<td bgcolor="#e9f0f7"><img src="{$_GALLERY_THUMBNAIL_PATH_}{$article_image_owner_id}/{$article_image_id}.{$article_image_type}"><br>{$article_image_caption}</td>
</tr>
</table>
that are referenced 10+ times in each page. To read the template from disk each time is more overhead than I want.
Why do I have such a small repeating templates? Well, I'm writing a CMS, and people use tags such as {img id=45 align=left} in it when writing the articles. These are then translated to show the image in the above template. I translate into the template rather than straight to HTML in my PHP script so that it is easier for people to customize the look of the CMS.
While on the subject of efficiency, can anyone tell me whether calling GetImageSize ~15-30 times per page would be more or less efficient than storing the image sizes in the database, and extracting them? I'm guessing it would be less efficient, but I don't know of any reliable way to test it. And then what about 5 times per page?
Thanks,
Peter.
---oOo---
sendcard - *The* PHP e-card solution as used by Excite
http://www.sendcard.f2s.com/
---oOo---