diff --git a/NEWS b/NEWS
index bfbe6e49..a8df07fd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+ - fixed bug with resource testing, and include_path (Monte)
+
Version 2.1.0
-------------
diff --git a/Smarty.class.php b/Smarty.class.php
index 576a023d..b32f7d12 100644
--- a/Smarty.class.php
+++ b/Smarty.class.php
@@ -804,13 +804,18 @@ function _generate_debug_output() {
if ($resource_type == 'file') {
$readable = false;
- $include_paths = preg_split('![:;]!', ini_get('include_path'));
- foreach ($include_paths as $path) {
- if (@is_file($path . DIRECTORY_SEPARATOR . $resource_name)) {
- $readable = true;
- break;
- }
- }
+ if(@is_file($resource_name)) {
+ $readable = true;
+ } else {
+ // test for file in include_path
+ $include_paths = preg_split('![:;]!', ini_get('include_path'));
+ foreach ($include_paths as $path) {
+ if (@is_file($path . DIRECTORY_SEPARATOR . $resource_name)) {
+ $readable = true;
+ break;
+ }
+ }
+ }
} else if ($resource_type != 'file') {
$readable = true;
$resource_func = $this->_plugins['resource'][$resource_type][0][0];
diff --git a/docs/designers.sgml b/docs/designers.sgml
index 32f75bf5..8e527902 100644
--- a/docs/designers.sgml
+++ b/docs/designers.sgml
@@ -1393,6 +1393,120 @@ s m o k e r s a r e p. . .
</table>
</body>
</html>
+
+
+
+ foreach,foreachelse
+
+
+
+
+
+
+
+
+
+ Attribute Name
+ Type
+ Required
+ Default
+ Description
+
+
+
+
+ from
+ string
+ Yes
+ n/a
+ The name of the array you are looping through
+
+
+ item
+ string
+ Yes
+ n/a
+ The name of the variable that is the current
+ element
+
+
+ key
+ string
+ No
+ n/a
+ The name of the variable that is the current key
+
+
+ name
+ string
+ No
+ n/a
+ The name of the foreach loop for accessing
+ foreach properties
+
+
+
+
+
+ foreach loops are an alternative to
+ section loops. foreach is
+ used to loop over a single associative array. The syntax for
+ foreach is much easier than
+ section, but as a tradeoff it can only be used
+ for a single array. foreach tags must be
+ paired with /foreach tags. Required parameters
+ are from and item. The
+ name of the foreach loop can be anything you like, made up of
+ letters, numbers and underscores. foreach
+ loops can be nested, and the nested foreach names must be unique
+ from each other. The from variable (usually an
+ array of values) determines the number of times
+ foreach will loop.
+ foreachelse is executed when there are no
+ values in the from variable.
+
+
+foreach
+
+
+{* this example will print out all the values of the $custid array *}
+{foreach from=$custid item=curr_id}
+ id: {$curr_id}<br>
+{/foreach}
+
+OUTPUT:
+
+id: 1000<br>
+id: 1001<br>
+id: 1002<br>
+
+
+
+foreach key
+
+{* The key contains the key for each looped value
+
+assignment looks like this:
+
+$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
+ array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
+
+*}
+
+{foreach name=outer item=contact from=$contacts}
+ {foreach key=key item=item from=$contact}
+ {$key}: {$item}<br>
+ {/foreach}
+{/foreach}
+
+OUTPUT:
+
+phone: 1<br>
+fax: 2<br>
+cell: 3<br>
+phone: 555-4444<br>
+fax: 555-3333<br>
+cell: 760-1234<br>
@@ -2407,120 +2521,6 @@ e-mail: jane@mydomain.com<p>
-
- foreach,foreachelse
-
-
-
-
-
-
-
-
-
- Attribute Name
- Type
- Required
- Default
- Description
-
-
-
-
- from
- string
- Yes
- n/a
- The name of the array you are looping through
-
-
- item
- string
- Yes
- n/a
- The name of the variable that is the current
- element
-
-
- key
- string
- No
- n/a
- The name of the variable that is the current key
-
-
- name
- string
- No
- n/a
- The name of the foreach loop for accessing
- foreach properties
-
-
-
-
-
- foreach loops are an alternative to
- section loops. foreach is
- used to loop over a single associative array. The syntax for
- foreach is much easier than
- section, but as a tradeoff it can only be used
- for a single array. foreach tags must be
- paired with /foreach tags. Required parameters
- are from and item. The
- name of the foreach loop can be anything you like, made up of
- letters, numbers and underscores. foreach
- loops can be nested, and the nested foreach names must be unique
- from each other. The from variable (usually an
- array of values) determines the number of times
- foreach will loop.
- foreachelse is executed when there are no
- values in the from variable.
-
-
-foreach
-
-
-{* this example will print out all the values of the $custid array *}
-{foreach from=$custid item=curr_id}
- id: {$curr_id}<br>
-{/foreach}
-
-OUTPUT:
-
-id: 1000<br>
-id: 1001<br>
-id: 1002<br>
-
-
-
-foreach key
-
-{* The key contains the key for each looped value
-
-assignment looks like this:
-
-$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
- array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
-
-*}
-
-{foreach name=outer item=contact from=$contacts}
- {foreach key=key item=item from=$contact}
- {$key}: {$item}<br>
- {/foreach}
-{/foreach}
-
-OUTPUT:
-
-phone: 1<br>
-fax: 2<br>
-cell: 3<br>
-phone: 555-4444<br>
-fax: 555-3333<br>
-cell: 760-1234<br>
-
-
strip
diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php
index 576a023d..b32f7d12 100644
--- a/libs/Smarty.class.php
+++ b/libs/Smarty.class.php
@@ -804,13 +804,18 @@ function _generate_debug_output() {
if ($resource_type == 'file') {
$readable = false;
- $include_paths = preg_split('![:;]!', ini_get('include_path'));
- foreach ($include_paths as $path) {
- if (@is_file($path . DIRECTORY_SEPARATOR . $resource_name)) {
- $readable = true;
- break;
- }
- }
+ if(@is_file($resource_name)) {
+ $readable = true;
+ } else {
+ // test for file in include_path
+ $include_paths = preg_split('![:;]!', ini_get('include_path'));
+ foreach ($include_paths as $path) {
+ if (@is_file($path . DIRECTORY_SEPARATOR . $resource_name)) {
+ $readable = true;
+ break;
+ }
+ }
+ }
} else if ($resource_type != 'file') {
$readable = true;
$resource_func = $this->_plugins['resource'][$resource_type][0][0];