Okay I’m having a problem that is driving me up the freaking wall and maybe one of you gurus would be oh so kind to help I’m having problems in creating what I hope will be a blog. I have 4 files. a homepage (which doesn’t matter as right now it’s just holding an include file) ‘news.php’, ‘news_walker.php’ and the ‘editor.php’.
When I submit an update in the editor, the files are created in their specific directories (news and images) however, I can’t get the update to appear on screen.
The trouble is stemming from lines 7 and 9 of news. Aside from that everything else works perfect. Files are created, but not displayed.
[SIZE=”1″]Warning: file(/news/.php) [function.file]: failed to open stream: No such file or directory in C:wampwwwPHPmysitenews.php on line 7
Warning: implode() [function.implode]: Bad arguments. in C:wampwwwPHPmysitenews.php on line 9
[code=php]
<?php
include(“news_walker.php”);
function show_news($filename)
{
$newsfile = file($path . “/news/$filename.php”); //line 7
$newsfile = implode(“”, $newsfile); //line 9
$newsfile = explode(“]]]”, $newsfile);
$title = $newsfile[0];
$subtitle = $newsfile[1];
$date = $newsfile[2];
$news = $newsfile[3];
$image = $newsfile[4];
//below this is nothing but echos and some HTML tags
}
?>
This is the news_walker code that gets the file paths. I figured I’d throw it out there in case this problem is bigger than I realize
[code=php]
<?php
$path = dirname($_SERVER[“SCRIPT_FILENAME”]);
$dir = opendir($path . “/news”); // note reference to news folder
while($file = readdir($dir))
{
if($file == “..” || $file == “.”){continue;}
//echo $file. “<br>”;
}
show_news($file);
?>
I’ve been staring at this thing for hours now (can you tell I’m a rookie :p) and can’t figure it out. Thanks in advance.
Deepinit.