Jump to content

How to use require or include php functions


franco.pentangeli

Recommended Posts

Hi,

I need to use require or include functions into tpl files. I have already change PHP_TAGS to true and $php_handling to PHP_ALLOW, but I obtain this error:

 

 

Fatal error: require() [function.require]: Failed opening required 'http://********.com/themes/myriam/prova.php' (include_path='.:/usr/lib64/php/pear/PEAR:/usr/lib64/php:/usr/share/pear') in /var/www/*************/tools/smarty/plugins/block.php.php(23) : eval()'d code on line 2

 

 

why?

can you help me?

 

thanks!

 

F

Link to comment
Share on other sites

Hi,

 

open config/smarty.config.inc.php and add $smarty->allow_php_tag = true; after $smarty->deprecation_notices = false;

 

Now you can use PHP Tags like <?php include 'functions.php'; ?>. B)

 

Cheers

 

Hi! thanks for help! I add your code into config/smarty.config.inc.php but I obtain the same error...

 

[/size][/font][/color]
Fatal error: require() [function.require]: Failed opening required 'http://*******/themes/mio/prova.php' (include_path='.:/usr/lib64/php/pear/PEAR:/usr/lib64/php:/usr/share/pear') in /var/www/***********/tools/smarty/compile/98492ccaf869414691e5bfefe8f6a983b9fedc42.file.authentication.tpl.php on line 130

can you help me?? :unsure:

Link to comment
Share on other sites

It would appear that you're not giving the require function the correct path. I believe you need to use a relative path to you file based on the actual file system, not a web address. It cannot be "http://www.example.com/myphpfile.php". It would have to be something like "/myphpfile.php" or "classes/myphpfile.php".

 

Perfect! thank you very much!!! :D

Link to comment
Share on other sites

  • 1 month later...
I have already change PHP_TAGS to true and $php_handling to PHP_ALLOW, but I obtain this error:

 

Hi, I'm also trying to use php include on my website and am browsing the forum for instructions. I managed to find "$php_handling" in the tools/smarty/Smarty.class.php file, but where do I find the PHP_TAGS option?

 

Thanks for your help,

 

Michelle

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...