Holsey Posted August 23, 2008 Share Posted August 23, 2008 Hello, i am fairly new to php and i'm working on my site, I'm installing a new poster to my site but I'm trying to install it into a template... this is the entire php script (except the admin.php part) <?php function getNewsList(){ $fileList = array(); if ($handle = opendir("news")) { // Read all file from the actual directory while ($file = readdir($handle)) { if (!is_dir($file)) { $fileList[] = $file; } } } rsort($fileList); return $fileList; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <body> <div id="main"> < <table width="100%"> <?php $list = getNewsList(); foreach ($list as $value) { $newsData = file("news/".$value); $newsTitle = $newsData[0]; $submitDate = $newsData[1]; unset ($newsData['0']); unset ($newsData['1']); $newsContent = ""; foreach ($newsData as $value) { $newsContent .= $value; } echo "<div class=\"title\">". $newstitle ."</div><div class=\"date\">" . $submitDate . "</div>"; echo "<div class=\"newsarea\">".$newsContent."</br></hr size='1'></div>"; } ?> </table> </div> </body> the first div: title is where the title goes on the template,however on the template it is just regular so i would have to edit index.php to update the news, and if i don't have much time i want to be able to just login to a admin.php page and change the news and have the template still looking good. The date div is where the date is and the news area is whre the news goes, then theres the $newscontent $newstitles and $submitdate all that jazz. and when i run the page i get an error that says:Parse error: syntax error, unexpected T_CLASS, expecting ',' or ';' in /thisiswheremywebsitepagesare/ on line 105. line 105 is: echo "<div class=\"newsarea\">".$newsContent."</br></hr size='1'></div>"; please tell me what to do, im so confused Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted August 23, 2008 Share Posted August 23, 2008 can you use tags , as it makes the code easier to read. Quote Link to comment Share on other sites More sharing options...
Holsey Posted August 23, 2008 Author Share Posted August 23, 2008 <?php function getNewsList(){ $fileList = array(); if ($handle = opendir("news")) { // Read all file from the actual directory while ($file = readdir($handle)) { if (!is_dir($file)) { $fileList[] = $file; } } } rsort($fileList); return $fileList; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <body> <div id="main"> < <table width="100%"> <?php $list = getNewsList(); foreach ($list as $value) { $newsData = file("news/".$value); $newsTitle = $newsData[0]; $submitDate = $newsData[1]; unset ($newsData['0']); unset ($newsData['1']); $newsContent = ""; foreach ($newsData as $value) { $newsContent .= $value; } echo "<div class=\"title\">". $newstitle ."</div><div class=\"date\">" . $submitDate . "</div>"; echo "<div class=\"newsarea\">".$newsContent."</br></hr size='1'></div>"; } ?> </table> </div> </body> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.