Simpel.
<?php
$talen = array('NL' => array('titel' => 'Welkom beste bezoeker',
'tekst' => 'Dit is een tekst om te testen',
'taal' => 'Nederlands',
'menulink' => 'menunederlands.php'),
'ENG' => array('titel' => 'Welcome dear visitor',
'tekst' => 'This text is for testing only',
'taal' => 'Englisch',
'menulink' => 'menuengels.php')
);
include($talen[$language]['menulink']);
?>
Link gekopieerd
Helemaal goed! super bedankt voor alle inzet aan jullie zijde!
Stef
het resultaat komt binnenkort op
www.dejavureportage.nl
Link gekopieerd
Hey San,
Ik heb nog even een vraagje.... Ik heb een php scriptje gemaakt welke ik in een apart bestand geplaatst heb. Dit is een directory listing scriptje.
Ik heb dit dirlist.php genoemd.
Ik heb nu de include toegevoegd zoals je hierboven omschreven hebt, maar dat werkt niet. Ik krijg dat de inhoud van het script te zien ipv dat hij heb uitvoerd.
Ik heb daarom dan de echo een include of require geprobeerd, maar dat geeft hetzelfde probleem.
Ik hoop dat het wel mogelijk is een extern php script aan te roepen?
Stef
Link gekopieerd
uhm.... include je hem wel juist? dus dan...
<?php
include("dirlist.php");
?>
tenzij het in een mapje staat dan
<?php
include("/mapnaam/dirlist.php");
?>
Link gekopieerd
wat voor bestand roep je op ?
CSS word door PHP inderdaad als tekst weergegeven, maar daar voor bestaat <link> of bij css file import.
Link gekopieerd
Hey San,
Ik heb inderdaad een .php bestandje gemaakt van het script.
dmv de include zoals je m omschreef heb ik m toegevoegd..
Hier mijn code..
dirlisting.php
function getFiles($path) {
//Function takes a path, and returns a numerically indexed array of associative arrays containing file information,
//sorted by the file name (case insensitive). If two files are identical when compared without case, they will sort
//relative to each other in the order presented by readdir()
$files = array();
$fileNames = array();
$i = 0;
if (is_dir($path)) {
if ($dh = opendir($path)) {
while (($file = readdir($dh)) !== false) {
if ($file == "." || $file == "..") continue;
$fullpath = $path . "/" . $file;
$fkey = strtolower($file);
while (array_key_exists($fkey,$fileNames)) $fkey .= " ";
$a = stat($fullpath);
$files[$fkey]['size'] = $a['size'];
if ($a['size'] == 0) $files[$fkey]['sizetext'] = "-";
else if ($a['size'] > 1024) $files[$fkey]['sizetext'] = (ceil($a['size']/1024*100)/100) . " K";
else if ($a['size'] > 1024*1024) $files[$fkey]['sizetext'] = (ceil($a['size']/(1024*1024)*100)/100) . " Mb";
else $files[$fkey]['sizetext'] = $a['size'] . " bytes";
$files[$fkey]['name'] = $file;
$files[$fkey]['type'] = filetype($fullpath);
$fileNames[$i++] = $fkey;
}
closedir($dh);
} else die ("Cannot open directory: $path");
} else die ("Path is not a directory: $path");
sort($fileNames,SORT_STRING);
$sortedFiles = array();
$i = 0;
foreach($fileNames as $f) $sortedFiles[$i++] = $files[$f];
return $sortedFiles;
}
$files = getFiles("./NEW");
foreach ($files as $file) print "<a href=\"new.php?naam=$file[name]\">$file[name]</a><br>\n";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>DejaVu Reportage</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="/includes/fotofadein.js"></script>
</head>
<body>
<?php
$arrStr = explode("/", $_SERVER['SCRIPT_NAME'] );
$arrStr = array_reverse($arrStr );
?>
<?php
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);
$talen = array('NL' => array('titel' => '<div id="tekst_rechts"><h2 align="right">Nieuwe foto´s</h2>',
'menu' => 'menu_nl.php'),
'ENG' => array('titel' => '<div id="tekst_rechts"><h2 align="right">New pictures</h2>',
'menu' => 'menu_eng.php'),
);
if(isset($_GET['LANG']) and isset($talen[$_GET['LANG']]))
{
$language = $_GET['LANG'];
}
else
{
$language = 'NL';
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>DejaVu Reportage</title>
<link href="/css/dejastyle2.css" rel="stylesheet" type="text/css" media="screen" />';
include('../includes/metatags.inc');
echo '<script type="text/javascript" src="/includes/fotofadein.js"></script>
</head>
<body>
<div id="distance"></div>
<div id="container">
<div id="language"><a href="';
echo $arrStr[0];
echo '?LANG=NL">nederlands</a> / <a href="';
echo $arrStr[0];
echo '?LANG=ENG">english</a></div>
<div align="center"><table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td id="content_cell">';
echo $talen[$language]['titel'];
require "dirlisting.php";
echo '</div><div id="NEW">';
if(!isset($_GET["naam"])){;
echo '<img src="/images/intro_new.jpg" width="400" height="300" />';
} else {;
echo '<iframe style="border: medium none ; background-color:FFFFFF;" src="/NEW/<?php PRINT $_GET["naam"]; ?>/iframe.html" title="Slideshow" frameborder="0" height="370" width="500" scrolling="no"></iframe>';
};
echo '</div>';
include($talen[$language]['menu']);
echo '</div>
</td>
</tr>';
include('footer.inc');
echo '
</table>
</div>
</body>
</html>
';
?>
Link gekopieerd