wutske 0 Report post Posted July 13, 2006 For the new version of my website I'm trying to make a very simple newssytem based on php.Each newsitem will get it's own html page, something like this: <html><head><title>Welkom</title><link rel="stylesheet" type="text/css" href="../style.css" /></head><body><p>HERE COMES THE TXT</p> </body></html> All other data will be stored in a file called news.inc<?php$news = array();$news[] = '110706_jovolka.html';$news[] = '110706_lorum.html';$news[] = '090706_welkom.html';$title = array();$title[] = 'Over JoVolKa';$title[] = 'Lorum Ipsum';$title[] = 'Welkom';$date = array();$date[] = '11/07/06';$date[] = '11/07/06';$date[] = '09/07/06';?> And the main news page is something like this:<html><head><title>JoVolKa Unofficial News</head><link rel="stylesheet" type="text/css" href="../style.css" /></head><body><?phpinclude ("news.inc");$iVariabele = 0;foreach( $news as $id => $file ){ if ($iVariabele < 8) { echo '<div class="title"><table width="100%"><tr class="title"><td class="title">'; echo $title[$id]; echo '</td><td class="date">'; echo $date[$id]; echo '</td></tr></table></div><div class="news">'; include ("$news[$id]"); echo '</div>'; $iVariabele++; }}?> </body></html> Now, the problem is that it does show the first newsitem (0 in the array) completely wrong. It does not show the title, date, but only the news, but it also ignores the lay-out, only for that first item, the rest is okay.I've been doing some test:<html><head><title>JoVolKa Unofficial News</head></head><body><?phpinclude "news.inc";print_r($news);echo ' Date 0 = ' . $date[0] . ' Title 0 = ' . $title[0] . ' File 0 = ' . $news[0]; ?></body></html> results in:Array ( [0] => 110706_jovolka.html [1] => 110706_lorum.html [2] => 090706_welkom.html ) Date 0 = 11/07/06 Title 0 = Over JoVolKa File 0 = 110706_jovolka.htmlWhen I change that to<html><head><title>JoVolKa Unofficial News</head></head><body><?phpinclude "news.inc";print_r($news);echo ' Date 0 = ' . $date[0] . ' Title 0 = ' . $title[0] . ' File 0 = ' . $news[0]; echo '<div class="title"><table width="100%"><tr class="title"><td class="title">'; echo $title[0]; echo '</td><td class="date">'; echo $date[0]; echo '</td></tr></table></div><div class="news">'; include ("$news[0]"); echo '</div>';?> </body></html> then it in fact only does the include thing.Who can help me ??? Share this post Link to post Share on other sites
TavoxPeru 0 Report post Posted July 14, 2006 For the new version of my website I'm trying to make a very simple newssytem based on php.Each newsitem will get it's own html page, something like this: <html><head><title>Welkom</title><link rel="stylesheet" type="text/css" href="../style.css" /></head><body><p>HERE COMES THE TXT</p> </body></html> All other data will be stored in a file called news.inc<?php$news = array();$news[] = '110706_jovolka.html';$news[] = '110706_lorum.html';$news[] = '090706_welkom.html';$title = array();$title[] = 'Over JoVolKa';$title[] = 'Lorum Ipsum';$title[] = 'Welkom';$date = array();$date[] = '11/07/06';$date[] = '11/07/06';$date[] = '09/07/06';?> And the main news page is something like this:<html><head><title>JoVolKa Unofficial News</head><link rel="stylesheet" type="text/css" href="../style.css" /></head><body><?phpinclude ("news.inc");$iVariabele = 0;foreach( $news as $id => $file ){ if ($iVariabele < 8) { echo '<div class="title"><table width="100%"><tr class="title"><td class="title">'; echo $title[$id]; echo '</td><td class="date">'; echo $date[$id]; echo '</td></tr></table></div><div class="news">'; include ("$news[$id]"); echo '</div>'; $iVariabele++; }}?> </body></html>...then it in fact only does the include thing.Who can help me ???Hi there, your problem is caused by the title tag in your main news page, simply replace with </title> your close tag.<html><head><title>JoVolKa Unofficial News</title><link rel="stylesheet" type="text/css" href="../style.css" /></head><body>... Best regards, Share this post Link to post Share on other sites