Problem with include in PHP
Posted by guillom
Problem with include in PHP October 01, 2009 03:18AM |
Registered: 15 years ago Posts: 6 |
Hello,
l use phorum in my html website . But my new site is in php and l don't arrive to integrate Phorum with include. l have the following errors:
Warning: include_once(./common.php) [function.include-once]: failed to open stream: No such file or directory in /home/lestrain/www/forum/index.php on line 21
Warning: include_once() [function.include]: Failed opening './common.php' for inclusion (include_path='.:/usr/share/php5') in /home/lestrain/www/forum/index.php on line 21
Warning: include_once(./include/format_functions.php) [function.include-once]: failed to open stream: No such file or directory in /home/lestrain/www/forum/index.php on line 23
Warning: include_once() [function.include]: Failed opening './include/format_functions.php' for inclusion (include_path='.:/usr/share/php5') in /home/lestrain/www/forum/index.php on line 23
Fatal error: Call to undefined function phorum_check_read_common() in /home/lestrain/www/forum/index.php on line 25
Is it possible to do it with an include?
Thank you very much,
Guillaume.
www.lestrainsdeguillaume.com for the old site
www.lestrainsdeguillaume.com/default.php for the new site.
l use phorum in my html website . But my new site is in php and l don't arrive to integrate Phorum with include. l have the following errors:
Warning: include_once(./common.php) [function.include-once]: failed to open stream: No such file or directory in /home/lestrain/www/forum/index.php on line 21
Warning: include_once() [function.include]: Failed opening './common.php' for inclusion (include_path='.:/usr/share/php5') in /home/lestrain/www/forum/index.php on line 21
Warning: include_once(./include/format_functions.php) [function.include-once]: failed to open stream: No such file or directory in /home/lestrain/www/forum/index.php on line 23
Warning: include_once() [function.include]: Failed opening './include/format_functions.php' for inclusion (include_path='.:/usr/share/php5') in /home/lestrain/www/forum/index.php on line 23
Fatal error: Call to undefined function phorum_check_read_common() in /home/lestrain/www/forum/index.php on line 25
Is it possible to do it with an include?
Thank you very much,
Guillaume.
www.lestrainsdeguillaume.com for the old site
www.lestrainsdeguillaume.com/default.php for the new site.
Re: Problem with include in PHP October 01, 2009 03:32AM |
Admin Registered: 22 years ago Posts: 9,240 |
October 01, 2009 04:34AM |
Moderator Registered: 18 years ago Posts: 1,301 |
One problem you will run into is that including Phorum into your existing page will cause css/html errors (as the header/footer templates will insert new tags like <html>,<head>,<body>, etc.
Your first problem is that you are calling the Phorum code outside its working directory. You will want to save the current working directory, move to Phorum's directory, include Phorum, then move back to your original working directory.
Looking at your site, you may be better off including your site's code in your Phorum templates header.tpl and footer.tpl without trying to include it from your default.php page. Another problem you will run into with the include method is the need to rewrite every url in Phorum to use your default.php page. The more I think about it, the more I would suggest a custom template with your site's look wrapped around Phorum through the header and footer files.
Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Your first problem is that you are calling the Phorum code outside its working directory. You will want to save the current working directory, move to Phorum's directory, include Phorum, then move back to your original working directory.
Language: PHP$cwd = getcwd() chdir(';/your/phorum/directory';); Include Phorum chdir($cwd);
Looking at your site, you may be better off including your site's code in your Phorum templates header.tpl and footer.tpl without trying to include it from your default.php page. Another problem you will run into with the include method is the need to rewrite every url in Phorum to use your default.php page. The more I think about it, the more I would suggest a custom template with your site's look wrapped around Phorum through the header and footer files.
Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Problem with include in PHP October 01, 2009 04:37AM |
Registered: 15 years ago Posts: 6 |
Re: Problem with include in PHP October 01, 2009 04:39AM |
Admin Registered: 22 years ago Posts: 9,240 |
October 01, 2009 04:53AM |
Moderator Registered: 18 years ago Posts: 1,301 |
One of the great things about Phorum is that you can use PHP in the template files. So, in the header.tpl file you can use blocks of code placed in the relevant areas in that file to pull in your site's custom css and custom menus just before the Phorum content begins. So you might change:
Then in the footer.tpl file you would use similar code to include the file(s) used in your default.php script to close the mainContent div and finish the page.
Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
{HEAD_TAGS} </head> <body onload="{IF FOCUS_TO_ID}var focuselt=document.getElementById('{FOCUS_TO_ID}'); if (focuselt) focuselt.focus();{/IF}"> {! Please leave this div in your template you can alter anything above this line } <div id="phorum">To:
{HEAD_TAGS} </head> <body onload="{IF FOCUS_TO_ID}var focuselt=document.getElementById('{FOCUS_TO_ID}'); if (focuselt) focuselt.focus();{/IF}"> <?php $cwd = getcwd(); chdir('/your/site's/directory'); include_once("your_menu_file"); // this would be the file(s) called in your default.php script up to the "<div id="mainContent">" chdir($cwd); ?> {! Please leave this div in your template you can alter anything above this line } <div id="phorum">
Then in the footer.tpl file you would use similar code to include the file(s) used in your default.php script to close the mainContent div and finish the page.
Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Problem with include in PHP October 01, 2009 05:21AM |
Registered: 15 years ago Posts: 6 |
Sorry, only registered users may post in this forum.