mam dwa pliki.
Plik body.php
Kod
<?php
define('OPT_DIR', 'opt/lib/');
require('opt/lib/opt.class.php');
/*
Klasa odpowiedzialna za wyświetlenie treści strony dotyczącej wyboru i pobrania pliku
*/
class selectFile{
function __construct($file){
try{
$tpl = new optClass;
$tpl -> root = './tpl/';
$tpl -> compile = './templates_c/';
$tpl -> gzipCompression = 1;
$tpl -> httpHeaders(OPT_HTML);
$tpl -> assign('current_date',$file);
$tpl -> parse('example1.tpl');
}catch(optException $exception){
optErrorHandler($exception);
}
}
}
?>
define('OPT_DIR', 'opt/lib/');
require('opt/lib/opt.class.php');
/*
Klasa odpowiedzialna za wyświetlenie treści strony dotyczącej wyboru i pobrania pliku
*/
class selectFile{
function __construct($file){
try{
$tpl = new optClass;
$tpl -> root = './tpl/';
$tpl -> compile = './templates_c/';
$tpl -> gzipCompression = 1;
$tpl -> httpHeaders(OPT_HTML);
$tpl -> assign('current_date',$file);
$tpl -> parse('example1.tpl');
}catch(optException $exception){
optErrorHandler($exception);
}
}
}
?>
oraz plik index.php
Kod
<?php
require('body.php');
class Content{
function __construct(){
$file = "<H2>Pobierz plik .css</H2>\n";
$file .= "<FORM action=\"upload.php\" enctype=\"multipart/form-data\" method=\"POST\">\n";
$file .= "<p><INPUT type=\"file\" name=\"load\"></p>\n";
$file .= "<H3>Dane w pliku oddzielone są:</H3>\n";
$file .= "<p><input type=\"radio\" name=\"section\" value=\"comma\" ID=\"comma\"><label for=\"comma\">przecinkiem</label></p>\n";
$file .= "<p><input type=\"radio\" name=\"section\" value=\"semicolon\" ID=\"semicolon\"><label for=\"semicolon\">średnikiem</label></p>\n";
$file .= "<p><INPUT type=\"submit\" value=\"Prześlij\" name=\"B1\"><INPUT type=\"reset\" value=\"Resetuj\" name=\"B2\"></p>\n";
$file .= "</FORM>";
$this -> file = $file;
}
function display(){
new selectFile($this ->file);
}
}
$pokaz = new Content();
$pokaz -> display();
?>
require('body.php');
class Content{
function __construct(){
$file = "<H2>Pobierz plik .css</H2>\n";
$file .= "<FORM action=\"upload.php\" enctype=\"multipart/form-data\" method=\"POST\">\n";
$file .= "<p><INPUT type=\"file\" name=\"load\"></p>\n";
$file .= "<H3>Dane w pliku oddzielone są:</H3>\n";
$file .= "<p><input type=\"radio\" name=\"section\" value=\"comma\" ID=\"comma\"><label for=\"comma\">przecinkiem</label></p>\n";
$file .= "<p><input type=\"radio\" name=\"section\" value=\"semicolon\" ID=\"semicolon\"><label for=\"semicolon\">średnikiem</label></p>\n";
$file .= "<p><INPUT type=\"submit\" value=\"Prześlij\" name=\"B1\"><INPUT type=\"reset\" value=\"Resetuj\" name=\"B2\"></p>\n";
$file .= "</FORM>";
$this -> file = $file;
}
function display(){
new selectFile($this ->file);
}
}
$pokaz = new Content();
$pokaz -> display();
?>
Problem polega na tym że nie działa mi funkcja require() ani include() i wyświetla mi sie biała strona. Nie wczytuje się kod z pliku body.php. Gdy zamiast funkcji include wstawie zawartość pliku body.php wszystko działa ok. Przy kodzie strukturalnym zarowno include jak i require dziala ok.
HELP