RE: Smarty 2.0 prototype snapshot available
| From: | Duncan Forrest | Date: | Sat, 02 Mar 2002 16:41:52 +0000 |
| Subject: | RE: Smarty 2.0 prototype snapshot available | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2918@lists.php.net to get a copy of this message | ||
On 2 Mar 2002 at 13:41, Maciej Uhlig <muhlig@us.edu.pl> wrote:
> > Duncan, I *will* get your new overlib updates in before the public 2.0, I
> promise ;-)
>
> As far as I can see, overlib.js is the same as in previous Smarty
> (31.08.2001). Is this the 'fixed' overlib or not fixed in fact? :-)
None of the changes I contributed affects overlib.js itself. That's
maintained by Erik Bosrup - see http://www.bosrup.com/web/overlib/ -
and the latest version is still 3.50. I only made changes to the
HTML which Smarty generates in order to call the overlib JavaScript
function.
Specifically:
* Because overlib.js does no type casting, it doesn't like quotes
around numeric parameters, so smarty_func_overlib no longer wraps
numeric arguments in single quotes.
* For some numeric parameters, smarty_func_overlib was preventing the
use of 0 where it would have been a valid parameter.
* There were a few minor typos in parameter names that prevented them
from being echoed correctly.
Here's a line that illustrates those three changes.
Before:
if (!empty($offsety)) { echo ",OFFSETY,'$offsetxy'"; }
After:
if (isset($offsetx)) { echo ",OFFSETY,$offsety"; }
* smarty_func_overlib didn't previosuly allow you to use overlib's
INARRAY feature to define frequently-used popup content just once in
an array, or the FUNCTION feature which allows you to generate popup
content through a JavaScript function. If you're using either of
these features a text attribute isn't required, so Smarty's error
checking now accepts any one of text, inarray & function as a minimum
attribute.
* Finally, I altered smarty_func_overlib_init so that {popup_init}
can take an optional src attribute, allowing you to reference
overlib.js as an external JavaScript file rather than including all
43kB of it in all your HTML pages. I was already doing that manually
and just ignoring Smarty's {popup_init} but I thought it would make
{popup_init} far more useful to others to have the option available.
So, {popup_init src="/foo/overlib.js"} now echoes
<script language="JavaScript" src="/foo/overlib.js"></script>
in your HTML page, instead of including the whole source of
overlib.js. As a further optimisation, I recommend downloading the
overlib code from bosrup.com and using the smaller 25kB, commentless
and indentless version of overlib.js instead of the full 43kB version
distributed with Smarty.
If you're still having problems using overlib from Smarty, drop me a
line and I'll see what I can do to help.
Regards,
Duncan Forrest