Re: [SMARTY] {include} problem?
| From: | Eric C. Pollitt | Date: | Mon, 23 Sep 2002 18:41:58 +0000 |
| Subject: | Re: [SMARTY] {include} problem? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6012@lists.php.net to get a copy of this message | ||
Please send more information on performing this type of include based on
file path...a complete list of code and implementation.
I'm trying to achieve a similar result (conditionally include files based on
file path) with the following INCOMPLETE code:
----------------------------------------------------------------------------
<?php
switch ($DOCUMENT_URI) {
case '/home/globalhemp/www/':
include("/home/globalhemp/www/includes/apple.inc");
break;
case '/home/globalhemp/www/Archives/':
include("/home/globalhemp/www/includes/quicktime.inc");
break;
case '/home/globalhemp/www/Archives/Essays/':
include("/home/globalhemp/www/includes/quicktime_download.inc");
break;
}
?>
----------------------------------------------------------------------------
Perhaps $DOCUMENT_URI is not correct...perhaps it should be $PATH_INFO? Or
should I have some sort of return or print statement?
----------------------------------------------------------------------------
WHAT ITS SUPPOSED TO DO
----------------------------------------------------------------------------
If DOCUMENT_URI is "/" (home) then the following file included:
URL: <http://www.globalhemp.com/includes/apple.html>
If DOCUMENT_URI is "/quicktime/" then the following file included:
URL: <http://www.globalhemp.com/includes/quicktime.html>
If DOCUMENT_URI is "/quicktime/download/" then the following file included:
URL: <http://www.globalhemp.com/includes/quicktime_download.html>
----------------------------------------------------------------------------
ERROR CHECKING
----------------------------------------------------------------------------
This should also include an "else" statement for error checking logic would
be for child directories that don't have their own include file and thus
would use a parent directory include file. If a parent directory file
doesn't exist, it would include the top-level (home) include file.
Thanks,
Eric C. Pollitt, Founder
401 E. Illinois Ave.
Peoria, IL 61603
Global Hemp - Portal to the hemp community
http://www.globalhemp.com/
"[N]either the wisest constitution nor the wisest laws will secure the
liberty and happiness of a people whose manners are universally corrupt. He
therefore is the truest friend of the liberty of his country who tries most
to promote its virtue."
-- Samuel Adams
> From: Mitch Vincent <mitch@unixprogramming.net>
> Date: Mon, 23 Sep 2002 11:16:44 -0700
> To: smarty-general@lists.php.net
> Subject: [SMARTY] {include} problem?
>
> I'm having a problem with a fairly simple {include}
>
> {include file=$std_header}
>
> - $std_header contains the full path to the file, assigned like this :
>
> $this->assign("std_header", FILE_ROOT . "pageheader.html");
>
> Seems to give this error :
>
> PHP Fatal error: Call to undefined function: () in
> e:\smarty\Smarty.class.php on line 1039
>
>
> This is on a friends box and I'm asking for him - Line 1039 is a blank
> line in my smarty.class.php file so I'm at a loss as to what no-
> name function is being called.. He says that there is no other smarty
> than that on any of the pages.
>
> If anyone has any suggestions about what to take a look at I'd
> appreciate it.
>
> Thanks!
>
> -Mitch
>
> Better to light a candle than to curse the darkness.
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>