diff --git a/Smarty.addons.php b/Smarty.addons.php index b6b27828..a64cb0a0 100644 --- a/Smarty.addons.php +++ b/Smarty.addons.php @@ -634,830 +634,9 @@ function smarty_func_assign_debug_info($args, &$smarty_obj) { Purpose: initialize use of overlib \*======================================================================*/ function smarty_func_overlib_init($args, &$smarty_obj) { - -?> - - - - - - 'smarty_func_fetch', 'counter' => 'smarty_func_counter', 'assign' => 'smarty_func_assign', - 'overlib_init' => 'smarty_func_overlib_init', - 'overlib' => 'smarty_func_overlib', + 'popup_init' => 'smarty_func_overlib_init', + 'popup' => 'smarty_func_overlib', 'assign_debug_info' => 'smarty_func_assign_debug_info' ); @@ -764,7 +771,7 @@ function _generate_debug_output() { \*======================================================================*/ function _compile_template($tpl_file, $template_source, &$template_compiled) { - include_once $this->compiler_class . '.class.php'; + include_once SMARTY_DIR.$this->compiler_class . '.class.php'; $smarty_compiler = new $this->compiler_class; diff --git a/docs.sgml b/docs.sgml index 86c9d670..6072d97b 100644 --- a/docs.sgml +++ b/docs.sgml @@ -238,6 +238,19 @@ chmod 700 cache There are several variables that are at the top of the Smarty.class.php file. The default settings work for all of the examples and tutorials. + + Constants + + + SMARTY_DIR + + This should be the full system path to the location of the Smarty + class files. If this is not defined, then the include_path will be + used to locate the files. If defined, the path must end with a + slash. + + + Configuration variables @@ -2173,6 +2186,29 @@ OUTPUT: The name of the variable to determine # of loop iterations + + start + integer + No + 0 The index + position that the section will begin looping. If the + value is negative, the start position is calculated + from the end of the array. For example, if there are + seven values in the loop array and start is -2, the + start index is 5. Invalid values (values outside of the + length of the loop array) are automatically truncated + to the closest valid value. (Added to Smarty 1.4.4.) + + + step + integer + No + 1 + The step value that will be used to traverse the + loop array. For example, step=2 will loop on index + 0,2,4, etc. If step is negative, it will step through + the array backwards. (Added to Smarty 1.4.4.) + show boolean @@ -2369,8 +2405,14 @@ e-mail: jane@mydomain.com<p> index - index is used to display the current loop iteration, - starting with zero. + index is used to display the current loop index, starting with zero + (or the start attribute if given), and incrementing by one (or by + the step attribute if given.) + + + TECHNICAL NOTE: If the step and start section properties are not + modified, then this works the same as the iteration section + property. section property index @@ -2392,7 +2434,7 @@ OUTPUT: index_prev - index_prev is used to display the previous loop iteration. + index_prev is used to display the previous loop index. on the first loop, this is set to -1. @@ -2422,8 +2464,9 @@ OUTPUT: index_next - index_next is used to display the next loop iteration. On the last - loop, this is still one more than the current index. + index_next is used to display the next loop index. On the last + loop, this is still one more than the current index (respecting the + setting of the step attribute, if given.) section property index_next @@ -2446,6 +2489,46 @@ OUTPUT: 2 id: 1002<br> The customer id will change<br> + + + + + iteration + + iteration is used to display the current loop iteration. + + + NOTE: This is not affected by the section properties start, step and + max, unlike the index property. + + + This was added to Smarty 1.4.4. + + +section property iteration + +{section name=customer loop=$custid start=5 step=2} + current loop iteration: {%customer.iteration%}<br> + {%customer.index%} id: {$custid[customer]}<br> + {* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *} + {if $custid[customer.index_next] ne $custid[customer.index]} + The customer id will change<br> + {/if} +{/section} + + +OUTPUT: + +current loop iteration: 1 +5 id: 1000<br> + The customer id will change<br> +current loop iteration: 2 +7 id: 1001<br> + The customer id will change<br> +current loop iteration: 3 +9 id: 1002<br> + The customer id will change<br> + @@ -2543,9 +2626,8 @@ OUTPUT: loop - loop is used to display the total number - of iterations this section is looped. This can be used - inside or after the section. + loop is used to display the last index number that this section + looped. This can be used inside or after the section. section property index @@ -2599,6 +2681,35 @@ OUTPUT: the section was shown. + + + + + total + + total is used to display the number of iterations that this section + will loop. This can be used inside or after the section. + + + This was added to Smarty 1.4.4. + + +section property total + +{section name=customer loop=$custid step=2} + {%customer.index%} id: {$custid[customer]}<br> +{/section} + +There were {%customer.total%} customers shown above. + +OUTPUT: + +0 id: 1000<br> +2 id: 1001<br> +4 id: 1002<br> + +There were 3 customers shown above. + @@ -3513,6 +3624,435 @@ OUTPUT: 9.44 + + + + + popup_init + + popup is an integration of overLib, a library used for popup + windows. These are used for context sensitive information, such as + help windows or tooltips. popup_init must be called once at the + top of any page you plan on using the popup function. overLib + was written by Erik Bosrup, and the homepage is located at + http://www.bosrup.com/web/overlib/. + + + This was added to Smarty 1.4.4. + + + + popup + + + + + + + + + + Attribute Name + Type + Required + Default + Description + + + + + text + string + Yes + n/a + the text/html to display in the popup window + + + trigger + string + No + onMouseOver + What is used to trigger the popup window. Can be + one of onMouseOver or onClick + + + sticky + boolean + No + false + Makes the popup stick around until closed + + + caption + string + No + n/a + sets the caption to title + + + fgcolor + string + No + n/a + color of the inside of the popup box + + + bgcolor + string + No + n/a + color of the border of the popup box + + + textcolor + string + No + n/a + sets the color of the text inside the box + + + capcolor + string + No + n/a + sets color of the box's caption + + + closecolor + string + No + n/a + sets the color of the close text + + + textfont + string + No + n/a + sets the font to be used by the main text + + + captionfont + string + No + n/a + sets the font of the caption + + + closefont + string + No + n/a + sets the font for the "Close" text + + + textsize + string + No + n/a + sets the size of the main text's font + + + captionsize + string + No + n/a + sets the size of the caption's font + + + closesize + string + No + n/a + sets the size of the "Close" text's font + + + width + integer + No + n/a + sets the width of the box + + + height + integer + No + n/a + sets the height of the box + + + left + boolean + No + false + makes the popups go to the left of the mouse + + + right + boolean + No + false + makes the popups go to the right of the mouse + + + center + boolean + No + false + makes the popups go to the center of the mouse + + + above + boolean + No + false + makes the popups go above the mouse. NOTE: only + possible when height has been set + + + below + boolean + No + false + makes the popups go below the mouse + + + border + integer + No + n/a + makes the border of the popups thicker or thinner + + + offsetx + integer + No + n/a + how far away from the pointer the popup will show + up, horizontally + + + offsety + integer + No + n/a + how far away from the pointer the popup will show + up, vertically + + + fgbackground + url to image + No + n/a + defines a picture to use instead of color for the + inside of the popup. + + + bgbackground + url to image + No + n/a + defines a picture to use instead of color for the + border of the popup. NOTE: You will want to set bgcolor + to "" or the color will show as well. NOTE: When having + a Close link, Netscape will re-render the table cells, + making things look incorrect + + + closetext + string + No + n/a + sets the "Close" text to something else + + + noclose + boolean + No + n/a + does not display the "Close" text on stickies + with a caption + + + status + string + No + n/a + sets the text in the browsers status bar + + + autostatus + boolean + No + n/a + sets the status bar's text to the popup's text. + NOTE: overrides status setting + + + autostatuscap + string + No + n/a + sets the status bar's text to the caption's text. + NOTE: overrides status and autostatus settings + + + inarray + integer + No + n/a + tells overLib to read text from this index in + the ol_text array, located in overlib.js. This + parameter can be used instead of text + + + caparray + integer + No + n/a + tells overLib to read the caption from this index + in the ol_caps array + + + capicon + url + No + n/a + displays the image given before the popup caption + + + snapx + integer + No + n/a + snaps the popup to an even position in a + horizontal grid + + + snapy + integer + No + n/a + snaps the popup to an even position in a + vertical grid + + + fixx + integer + No + n/a + locks the popups horizontal position Note: + overrides all other horizontal placement + + + fixy + integer + No + n/a + locks the popups vertical position Note: + overrides all other vertical placement + + + background + url + No + n/a + sets image to be used instead of table box + background + + + padx + integer,integer + No + n/a + pads the background image with horizontal + whitespace for text placement. Note: this is a two + parameter command + + + pady + integer,integer + No + n/a + pads the background image with vertical + whitespace for text placement. Note: this is a two + parameter command + + + fullhtml + boolean + No + n/a + allows you to control the html over a background + picture completely. The html code is expected in the "text" + attribute + + + frame + string + No + n/a + controls popups in a different frame. See the + overlib page for more info on this function + + + timeout + string + No + n/a + calls the specified javascript function and takes + the return value as the text that should be displayed in + the popup window + + + delay + integer + No + n/a + makes that popup behave like a tooltip. It will + popup only after this delay in milliseconds + + + hauto + boolean + No + n/a + automatically determine if the popup should be to + the left or right of the mouse. + + + vauto + boolean + No + n/a + automatically determine if the popup should be + above or below the mouse. + + + + + + popup is used to create javascript popup windows. + + +popup + + +{* popup_init must be called once at the top of the page *} +{popup_init} + +{* create a link with a popup window when you move your mouse over *} +<A href="mypage.html" {popup text="This link takes you to my page!}>mypage</A> + +{* you can use html, links, etc in your popup text *} +<A href="mypage.html" {popup sticky=true caption="mypage contents" +text="<UL><LI>links<LI>pages<LI>images</UL>" snapx=10 snapy=10}>mypage</A> + +OUTPUT: + +(See the Smarty official web site for working examples.) + @@ -3897,7 +4437,7 @@ no title 1 string No - html,url + html,url,quotes html This is the escape format to use. @@ -3905,8 +4445,9 @@ no title - This is used to html or url escape a variable. By default, - the variable is html escaped. + This is used to html escape, url escape, or escape single quotes on + a variable not already escaped. By default, the variable is html + escaped. escape @@ -3916,13 +4457,15 @@ no title {$articleTitle|escape} {$articleTitle|escape:"html"} {$articleTitle|escape:"url"} +{$articleTitle|escape:"quotes"} OUTPUT: -Stiff Opposition Expected to Casketless Funeral Plan -Stiff%20Opposition%20Expected%20to%20Casketless%20Funeral%20Plan -Stiff%20Opposition%20Expected%20to%20Casketless%20Funeral%20Plan -Stiff+Opposition+Expected+to+Casketless+Funeral+Plan +'Stiff Opposition Expected to Casketless Funeral Plan' +'Stiff%20Opposition%20Expected%20to%20Casketless%20Funeral%20Plan' +'Stiff%20Opposition%20Expected%20to%20Casketless%20Funeral%20Plan' +'Stiff+Opposition+Expected+to+Casketless+Funeral+Plan' +\'Stiff Opposition Expected to Casketless Funeral Plan\' @@ -4353,7 +4896,7 @@ s m o k e r s a r e p. . . for the current page. To disable the debugging console, set $debugging to false. You can also temporarily turn on the debugging console by putting SMARTY_DEBUG in the URL if you enable this option with $debugging_ctrl. + linkend="setting.debugging.ctrl">$debugging_ctrl. TECHNICAL NOTE: The debugging console does not work when you use the fetch() diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 8704ccf4..8e727b5f 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -40,7 +40,14 @@ * */ -require_once 'Smarty.addons.php'; +// set SMARTY_DIR to absolute path to Smarty library files. +// if not defined, include_path will be used. + +if(!defined("SMARTY_DIR")) { +define("SMARTY_DIR",""); +} + +require_once SMARTY_DIR.'Smarty.addons.php'; define("SMARTY_PHP_PASSTHRU",0); define("SMARTY_PHP_QUOTE",1); @@ -132,8 +139,8 @@ class Smarty 'fetch' => 'smarty_func_fetch', 'counter' => 'smarty_func_counter', 'assign' => 'smarty_func_assign', - 'overlib_init' => 'smarty_func_overlib_init', - 'overlib' => 'smarty_func_overlib', + 'popup_init' => 'smarty_func_overlib_init', + 'popup' => 'smarty_func_overlib', 'assign_debug_info' => 'smarty_func_assign_debug_info' ); @@ -764,7 +771,7 @@ function _generate_debug_output() { \*======================================================================*/ function _compile_template($tpl_file, $template_source, &$template_compiled) { - include_once $this->compiler_class . '.class.php'; + include_once SMARTY_DIR.$this->compiler_class . '.class.php'; $smarty_compiler = new $this->compiler_class; diff --git a/overlib.js b/overlib.js new file mode 100644 index 00000000..d1049817 --- /dev/null +++ b/overlib.js @@ -0,0 +1,820 @@ + +