php warning can't resolve

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Thorax
Forum Newbie
Posts: 6
Joined: Tue May 01, 2007 2:01 pm

php warning can't resolve

Post 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.
User avatar
guitarlvr
Forum Contributor
Posts: 245
Joined: Wed Mar 21, 2007 10:35 pm

Post by guitarlvr »

Can you post your code so we can take a look at it?

Wayne
Thorax
Forum Newbie
Posts: 6
Joined: Tue May 01, 2007 2:01 pm

Post 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]
User avatar
guitarlvr
Forum Contributor
Posts: 245
Joined: Wed Mar 21, 2007 10:35 pm

Post by guitarlvr »

are these the tags your using to open php?

Code: Select all

{php} include '../newsfeeds/news.php'; {/php}
Wayne
Thorax
Forum Newbie
Posts: 6
Joined: Tue May 01, 2007 2:01 pm

Post 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}
User avatar
arturm
Forum Commoner
Posts: 86
Joined: Fri Apr 13, 2007 8:29 am
Location: NY
Contact:

Post 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
Thorax
Forum Newbie
Posts: 6
Joined: Tue May 01, 2007 2:01 pm

Post 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?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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?
Thorax
Forum Newbie
Posts: 6
Joined: Tue May 01, 2007 2:01 pm

Post 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...
Post Reply