Include komt boven code
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
<?
if (mysql_num_rows($resultaat)!= 0) {
$nieuws =
"<h2><img src=\"../images/ster_groot.gif\" class=\"centreren\" alt=\"\" /> " . $rij['titel'] . "</h2>
" . convert_date($rij['datum'], "d-m-Y") . "
" . $rij['content'] . "
";
}
?>
if (mysql_num_rows($resultaat)!= 0) {
$nieuws =
"<h2><img src=\"../images/ster_groot.gif\" class=\"centreren\" alt=\"\" /> " . $rij['titel'] . "</h2>
" . convert_date($rij['datum'], "d-m-Y") . "
" . $rij['content'] . "
";
}
?>
Gewijzigd op 01/01/1970 01:00:00 door DJ Lars
Edit: Mijn post is een reactie op je eerste (nog niet gewijzigde) post.
Gewijzigd op 01/01/1970 01:00:00 door - SanThe -
Het leek me alleen niet nodig om de hele code hier te posten.
Ik was in de veronderstelling dat error reporting aan stond, dit bleek niet zo te zijn. Ik krijg de volgende foutmelding:
Code (php)
1
2
3
2
3
Warning: include(nieuwsreacties.php ) [function.include]: failed to open stream: No such file or directory in /home/vhosting/q/vhost0008563/domains/dj-lars.com/htdocs/ww2/index.php on line 84
Warning: include() [function.include]: Failed opening 'nieuwsreacties.php ' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/vhosting/q/vhost0008563/domains/dj-lars.com/htdocs/ww2/index.php on line 84
Warning: include() [function.include]: Failed opening 'nieuwsreacties.php ' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/vhosting/q/vhost0008563/domains/dj-lars.com/htdocs/ww2/index.php on line 84
Terwijl als ik include ('nieuwsreacties.php') buiten $nieuws plaats hij het wel doet.
Ik zie zo snel een spatie achter nieuwsreacties.php staan, die ook in de foutmelding voorkomt. Gewoon een typo lijkt me....
include() op php.net.
Je wilt een include in een string zetten? Zie dan eerst de info van Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
$string = get_include_contents('somefile.php');
function get_include_contents($filename) {
if (is_file($filename)) {
ob_start();
include $filename;
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
return false;
}
?>
$string = get_include_contents('somefile.php');
function get_include_contents($filename) {
if (is_file($filename)) {
ob_start();
include $filename;
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
return false;
}
?>