|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Bjoern3003 Smarty Rookie
Joined: 22 Nov 2004 Posts: 7
|
Posted: Wed Nov 22, 2017 9:42 am Post subject: fetch optimization for multiple calls each page load |
|
|
Hi there,
I have to call the fetch function multiple times each Call (ajax) to search keys in the smarty result Template.
The Code looks like this:
Code: | $DataTableSmarty = DashboardSmarty::getInstance();
$DataTableSmarty->setCaching(Smarty::CACHING_OFF);
$cell = array();
foreach($_ret->options['columns'] AS $idx => $column)
{
$cell[] = $column['cValue'];
}
$tpl = $DataTableSmarty->createtemplate('string:' . implode(":::", $cell));
foreach($LizenzenArr AS $oLizenz)
{
$DataTableSmarty->assign('oLizenz', $oLizenz);
$fetched = $tpl->fetch();
if(($filter && strpos($fetched, $_ret->options['search']['value'])!==false) || !$filter)
{
$row[] = explode(":::", $fetched);
}
//echo microtime(true) - $start .'<br>';
} |
Is there a nice way, to optimize the fetch call? For 1200 rows, it would be need about 0.6724808216095 seconds. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Nov 22, 2017 6:07 pm Post subject: |
|
|
Why do you use Smarty in such a backward, unimaginable way? |
|
Back to top |
|
Bjoern3003 Smarty Rookie
Joined: 22 Nov 2004 Posts: 7
|
Posted: Thu Nov 23, 2017 2:08 pm Post subject: |
|
|
Because I have to search in the smarty compiled result. So I have to precompile all datasets. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Nov 23, 2017 4:36 pm Post subject: |
|
|
Why not search in the original dataset?… |
|
Back to top |
|
Bjoern3003 Smarty Rookie
Joined: 22 Nov 2004 Posts: 7
|
Posted: Thu Nov 23, 2017 7:11 pm Post subject: |
|
|
Because its a dynamic script, where the dataset is not known at this time. Its going about more than one object and user can set her own Smarty datatable script, so I have to set the search query after smarty compile. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|