Pulling my hair out!
| From: | Jeff Clark | Date: | Tue, 13 Aug 2002 18:38:12 +0000 |
| Subject: | Pulling my hair out! | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-5690@lists.php.net to get a copy of this message | ||
Config:
-------
LEFTBOXES = "special,specialbuy,security"
STORE = "test"
Template test #1:
-----------------
{assign_array var=leftboxes values=#LEFTBOXES#}
{foreach from=$leftboxes item=leftbox}
{include file="#STORE#/$leftbox.html"}
{/foreach}
test #1 errors:
-----------------
Warning: Smarty error: unable to read template resource: "#STORE#/.html" in
/test/includes/Smarty.class.php on line 589
Warning: Smarty error: unable to read template resource: "#STORE#/.html" in
/test/includes/Smarty.class.php on line 589
Warning: Smarty error: unable to read template resource: "#STORE#/.html" in
/test/includes/Smarty.class.php on line 589
Template test #2:
-----------------
{assign_array var=leftboxes values=#LEFTBOXES#}
{assign var=TESTSTORE value=#STORE#}
{foreach from=$leftboxes item=leftbox}
{assign var=leftboxfile value="$TESTSTORE/$leftbox.html"}
{include file=$leftboxfile}
{/foreach}
test #2 errors:
-----------------
Warning: Smarty error: unable to read template resource: "test/.html" in
/test/includes/Smarty.class.php on line 589
test #2 notes:
--------------
Following the warning, special.html and specialbuy.html templates included
correctly in the output. Why does the foreach insert and empty value for the
first element, and skip the last? This is very confusing.
Template test #3:
-----------------
{assign_array var=leftboxes values=#LEFTBOXES#}
{assign var=TESTSTORE value=#STORE#}
{section name=leftbox loop=$leftboxes}
{assign var=leftboxfile value="$TESTSTORE/$leftboxes[leftbox].html"}
{include file=$leftboxfile}
{/section}
test #3 errors:
---------------
Warning: Smarty error: unable to read template resource: "test/box_.html" in
/test/includes/Smarty.class.php on line 589
Warning: Smarty error: unable to read template resource: "test/box_.html" in
/test/includes/Smarty.class.php on line 589
Warning: Smarty error: unable to read template resource: "test/box_.html" in
/test/includes/Smarty.class.php on line 589
Conclusion:
-----------
I could really use some help here. The only thing I can think of is that the
tokenizer/parser/whatever does not support what I'm trying to do. In example
#2, it would appear there is a bug in the foreach function.
The reason for subdirectories in the templates directory is that we have various
developers with different access and responsibilities for each section of the
website.
Thanks
Jeff