/    Sign up×
Community /Pin to ProfileBookmark

mini CMS trouble

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[/SIZE]

[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
}
?>
[/code]

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);
?>
[/code]

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.

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @Deepinit spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...