View previous topic :: View next topic |
Author |
Message |
Hinrich Smarty Rookie
Joined: 18 Apr 2003 Posts: 33
|
Posted: Wed Apr 23, 2003 8:25 pm Post subject: html_image |
|
|
The plugin html_image should be split into two plugins: html_image and xhtml_image. After a closer look to the specs I realized, that on HTML 4.01 strict the trailing slash is not allowed, but on XHTML the argument border is invalid. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Apr 24, 2003 1:55 am Post subject: |
|
|
perhaps an attribute will suffice. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Apr 24, 2003 7:26 am Post subject: |
|
|
maybe there should be a central configuration for all html_* functions where they can lookup the standards'settings? |
|
Back to top |
|
Hinrich Smarty Rookie
Joined: 18 Apr 2003 Posts: 33
|
Posted: Thu May 01, 2003 5:37 pm Post subject: |
|
|
messju wrote: | maybe there should be a central configuration for all html_* functions where they can lookup the standards'settings? |
That's an idea. Property doctype = SMARTY_HTML; where some defines are needed:
SMARTY_HTML
SMARTY_XHTML
SMARTY_XML |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu May 01, 2003 5:43 pm Post subject: |
|
|
hmmm.
One could also create multiple plugin subdirs, one for HTML, one for XHTML, one for PDF etc.
Instead of html_image, html_table, ... use image, table, ....
Then, you set the plugin directory to the style you want. Set compile_id to style.
voila, depending on which library is selected, you get different compilations for each rendering library. |
|
Back to top |
|
Hinrich Smarty Rookie
Joined: 18 Apr 2003 Posts: 33
|
Posted: Fri May 02, 2003 11:14 am Post subject: |
|
|
boots wrote: | voila, depending on which library is selected, you get different compilations for each rendering library. |
In this case the programmer has to choose. Back to the root, I think different plugins (html_image, xhtml_image etc.) are the best solution. Once a site is set up, the core might never changed anymore, but the layout. It is against the structure to force the designer to change the core code or anything else. The only functions the designer should use are the plugins. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri May 02, 2003 6:17 pm Post subject: |
|
|
That's the point, it would be code driven. I like ALLOWING the user to select, but the idea is that it would be transparent. The user would always use "table" but the application decides which library renders it (ie. HTML, pdf, etc.)
I'm working on something similar: a library system for modifiers based on a plugin function block. Still toying, but it has promise.
{mod_lib type="html"}
{$Title|b}
{/mod_lib}
{mod_lib type="debug"}
{$Title|b}
{/mod_lib}
The mod_lib default is set by the application as are all the available choices to the template (so if "debug" doesn't exist, it uses the default rendering style).
The neat thing is that I can layer and aggregate these:
{mod_lib type="corporate myapp html"}
{$Title|b}
{mod_lib type="debug"}
{$WeirdOutput|MyStyle}
{/mod_lib}
{/mod_lib}
The "corporate myapp html" causes the modifier to be applied for each style type in order (conceptually [html [myapp [corporate] ] ] where the innermost item is applied first).
So far, it *mostly* works |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sun May 04, 2003 11:52 am Post subject: |
|
|
my suggestion:
we add two attributes to html_image:
omit_border (default: false)
omit_slash (default: true)
this makes html_image behave "HTML 4.0.1 strict".
then we can add the plugin xhtml_image:
[php:1:14212810df]
<?php
function smarty_function_xhtml_image($params, &$smarty)
{
require_once $smarty->_get_plugin_filepath('function','html_image');
$params['omit_border'] = true;
$params['omit_slash'] = false;
return smarty_function_html_image($params, $smarty);
}
?>
[/php:1:14212810df]
thoughts? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sun May 04, 2003 5:09 pm Post subject: |
|
|
How about the opposite logic:
include_border = true/false
include_slash = true/false
Monte |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sun May 04, 2003 7:14 pm Post subject: |
|
|
yes. positive logic is better than double negation. |
|
Back to top |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Fri Jul 09, 2004 9:38 am Post subject: |
|
|
Hi all,
what about some new parameters:
"maxwidth"
"maxheight"
if the current width is lower than the maxwidth take the current width.
if the current width is geater than the maxwidth take the maxwidth.
same to height-parameters.
Greetz |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Jul 09, 2004 1:44 pm Post subject: |
|
|
make your own modifier?
{html_table ... width=$width|max:200} |
|
Back to top |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Mon Jul 12, 2004 8:48 am Post subject: |
|
|
oh i dont know this possibility.
THX a lot
it`s something like this, isn`t it?
[php:1:053904e9ed]
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty max modifier plugin
*
* Type: modifier<br>
* Name: max<br>
* Purpose: correct a given number to the max if needed
*
* @param integer
* @param integer
* @return integer
*/
function smarty_modifier_max( $number, $max)
{
if( $number > $max) return $max;
return $number;
}
?>
[/php:1:053904e9ed] |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Jul 12, 2004 2:34 pm Post subject: |
|
|
That will work, but you also might do some error checking, be sure both values are integers, etc. See some other modifiers for examples. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Mon Jul 12, 2004 2:42 pm Post subject: |
|
|
one aspect is missing here. if you don't pass a width to html_image then the width is determined with GetImageSize(). with a modifier like above you cannot say "use the default imagesize but only up to 200px".
just my 2c. |
|
Back to top |
|
|