|
|
|
|
![]() ![]() |
Jul 13 2006, 12:41 PM
Post
#1
|
|
|
Way Out Of Control - You need a life :) Group: [HOSTED] Posts: 1,043 Joined: 2-August 05 From: Kapellen (Antwerp, Belgium) Member No.: 7,585 |
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: CODE <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 CODE <?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: CODE <html> <head> <title>JoVolKa Unofficial News</head> <link rel="stylesheet" type="text/css" href="../style.css" /> </head> <body> <?php include ("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: CODE <html> <head> <title>JoVolKa Unofficial News</head> </head> <body> <?php include "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.html When I change that to CODE <html> <head> <title>JoVolKa Unofficial News</head> </head> <body> <?php include "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 ??? |
|
|
|
Jul 14 2006, 09:43 AM
Post
#2
|
|
|
Super Member Group: [HOSTED] Posts: 760 Joined: 8-April 06 From: Lima - Peru Member No.: 12,579 |
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: CODE <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 CODE <?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: CODE <html> <head> <title>JoVolKa Unofficial News</head> <link rel="stylesheet" type="text/css" href="../style.css" /> </head> <body> <?php include ("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. CODE <html> <head> <title>JoVolKa Unofficial News</title> <link rel="stylesheet" type="text/css" href="../style.css" /> </head> <body> . . . Best regards, |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 7th October 2008 - 06:01 AM |