Page 1 of 1

php warning can't resolve

Posted: Tue May 01, 2007 2:05 pm
by Thorax
Warning: main(carp_gpl/carp/carp.php) [function.main]: failed to open stream: No such file or directory in /home/offshore/public_html/newsfeeds/news.php on line 3

Fatal error: main() [function.require]: Failed opening required 'carp_gpl/carp/carp.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/offshore/public_html/newsfeeds/news.php on line 3

Don't understand why there's no file or directory in that location even though it exist.

Posted: Tue May 01, 2007 2:16 pm
by guitarlvr
Can you post your code so we can take a look at it?

Wayne

Posted: Tue May 01, 2007 2:23 pm
by Thorax
Jcart | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I'm using smarty and i call the php file sing this in category_index.tmpl:

[syntax="html"]<div id="rssblue" class="rssblue-location">
              {php} include '../newsfeeds/news.php'; {/php}
   	 </div>
news.php code:[/syntax]

Code: Select all

<?php 

require_once "carp_gpl/carp/carp.php";

CarpConf('cborder','');
CarpConf('bcb','<strong>');
CarpConf('acb','</strong>');
CarpConf('iorder','link, desc');
CarpConf('poweredby','');
CarpConf('maxitems',1);
CarpConf('maxidesc',30);
CarpCacheShow('http://www.forrester.com/rss/feed/0,,0,00.xml');
echo "<br />";
CarpConf('cborder','');
CarpConf('bcb','<strong>');
CarpConf('acb','</strong>');
CarpConf('iorder','link, desc');
CarpConf('poweredby','');
CarpConf('maxitems',1);
CarpConf('maxidesc',30);
CarpCacheShow('http://finance.yahoo.com/rss/MarketingServices');
echo "<br />";
CarpConf('cborder','');
CarpConf('bcb','<strong>');
CarpConf('acb','</strong>');
CarpConf('iorder','link, desc');
CarpConf('poweredby','');
CarpConf('maxitems',1);
CarpConf('maxidesc',30);
CarpCacheShow('http://news.google.com/news?ned=us&topic=h&output=rss');
echo "<br />";
CarpConf('cborder','');
CarpConf('bcb','<strong>');
CarpConf('acb','</strong>');
CarpConf('iorder','link, desc');
CarpConf('poweredby','');
CarpConf('maxitems',1);
CarpConf('maxidesc',30);
CarpCacheShow('http://www.dabcc.com/rss.aspx?channelid=14');
?>
it works in index.html but when included in smarty error occurs.


Jcart | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue May 01, 2007 2:41 pm
by guitarlvr
are these the tags your using to open php?

Code: Select all

{php} include '../newsfeeds/news.php'; {/php}
Wayne

Posted: Tue May 01, 2007 2:49 pm
by Thorax
yes.

using html this is the location and how i call the php code and it works:
public_html/index.html
<?php include 'newsfeeds/news.php'; ?>

in smarty this the location but won't work it gives a warning:
public_html/consolidate/templates/category_index.tmpl
{php} include '../newsfeeds/news.php'; {/php}

Posted: Tue May 01, 2007 3:52 pm
by arturm
do you have a file:
/home/offshore/public_html/newsfeeds/carp_gpl/carp/carp.php ?

maybe you have to modify news.php

Code: Select all

require_once "carp_gpl/carp/carp.php";
to

Code: Select all

require_once "../carp_gpl/carp/carp.php";
or something like that depends on file location

Posted: Tue May 01, 2007 4:21 pm
by Thorax
Thanks for pointing out the problem... the include location is the problem but if i change it path to include_once "../carp_gpl/carp/carp.php"; the problem would then be with index.html because the path has been change... any better idea to make the include in news.php flexible in both path?

Posted: Tue May 01, 2007 4:49 pm
by RobertGonzalez
You could move the included file to a location that is can be found in. I do have to ask though, why are you including PHP in a smarty template?

Posted: Tue May 01, 2007 4:54 pm
by Thorax
index.html and category_index.tmpl have the same content the difference is that in category_index.tmpl there s a dynamic code that generates resource directory but the rest of the content are the same...