Re: [SMARTY] Smarty and Internet Explorer issue

Howard Katz <[email protected]> Mon, 29 Jan 2007 12:02:25 -0800 (PST)
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
Peggy,

I assume that you took a "View Source" copy and paste into another
HTML web page and tried to load this non-dynamic web page. If this
works OK in IE6 then I would assume that you are correct about there
is something not working with how PHP presents the web page via
smarty.

I would also try the following to help:

<?php

// smarty code here

ob_start();
// ob_start("ob_gzhandler"); // this is the same, but compresses HTML
$smarty->display('this_template.html');
ob_end();

?>

This way the output is forced to come all at the same time and will
be treated just the same as a static HTML page. If you use the
compression option it may also force the page not to be cached as
well.

Also, preventing caching is also what you may wish to do:

<?php

// prevent page caching with HTTP headers, put this at top of web
page
header("Pragma: no-cache"); 
header("Cache-Control: no-cache, must-revalidate"); 
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 


?>

I would give those a try. I would guess that the problem is not
smarty per-se but some quirk in how IE 6 displays webpages when all
of the information is not passed at the same time.

Howard

--- Peggy Schatz <[email protected]> wrote:

> Hello,
> 
> I've built a complex site (using various included templates) with
> form 
> fields and data coming from various database tables.
> 
> One drop-down-field is causing problems in IE6. It contains about
> 17.000 
> values (I know, that's not very fancy). IE is capable of
> dynamically 
> creating and displaying this drop-down-list by using smarty's
> built-in 
> function {html_options} or a customized function as follows:
> 
> function smarty_function_make_options($params, &$smarty)
> {
> $options = '<select name="' . $params['name'] . '" class="' . 
> $params['class'] . '" style="' . $params['style'] .'" onchange="' .
> 
> $params['onchange'] . '">';
> $options .= '<option>' .
> join('</option><option>',$params['options']) . 
> '</option>';
> $options .= '</select>';
> $options = str_replace(">". $params['selected']," selected>" . 
> $params['selected'], $options);
> echo $options;
> }
> 
> But combined with all the other selects and features smarty won't
> load 
> the page in IE. Firefox loads quick and withaut fault. I've cached
> the 
> options-array using PEAR::CACHE_Lite, but this makes no difference
> in IE.
> 
> If I try to display the options as array {$pn_options}, no problem.
> But 
> neither way of manipulating an assigned array (of that size) in
> order to 
> get the select-box works, nor does writing the entire string 
> (<select>...</select>) in PHP and assigning as is...
> 
> I also checked wheter the size of the resulting page would be to
> big for 
> that certain browser by loading it in Firefox and saving as
> html-file. 
> This way I could open it in IE.
> 
> That's why I assume it is a smarty-related problem...
> 
> Thanks for any advise,
> Peggy
> 
> -- 
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 



 
____________________________________________________________________________________
TV dinner still cooling? 
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php