Mam napisany dosc duzy program na zasadzie MVC. Dlatego nie moge wkleic wam kodu bo to nic nie da. Sensowna jest tylko calosc. Zreszta nie chodzi o problem w kodzie tylko ustawienia serwera.
Dlatego pytam, czy ktos mial taki problem ze nie mogl wywolac modulu przy pomocy smarty. Ewidentnie jest to wina ustawien linuxa lub php lub apache tylko gdzie to skonfigurowac. Na zasadzie prob i bledow zmienilem ponizsze ustawienia i jednez modulow zaczol dzialac:
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
# The Options directive is both complicated and important. Please see
#
http://httpd.apache.org/docs-2.0/mod/core.html#options# for more information.
Options Indexes FollowSymLinks MultiViews#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit Indexes
AllowOverride all# Controls who can get stuff from this server.
Order deny,allow
Deny from all
Allow from 127.0.0.1
Oto ten ktory dziala:?php
<?php
class index extends action
{
public function preExecAction()
{
view::create("index");
}
public function indexAction()
{
//echo "metoda index!";
$content = "Witaj!";
view::assign("content", $content );
}
}
?>
ten juz np nie dziala<?php
class users extends action
{
public function indexAction()
{
//utworz domyslny widok modulu
$users_widok = new element("mod_users_index.tpl");
//stworz kolekcje uzytkownikow
$kolekcja = new users_collection();
$kolekcja -> setSortBy(frontcontroller::getParam("srtfield"),frontcontroller::getParam("srttype"));
$filtr_form = new form("Filtr");
$filtr_form -> add
(new element
("text.tpl"),array('name' => 'filtrlogin', 'caption' => 'login',
'value' => session::getVar("usersFiltrLogin",$_POST['filtrlogin']),
'error' => 'Błędny login',
));
$filtr_form -> add
(new element
("text.tpl"),array('name' => 'filtremail', 'caption' => 'email',
'value' => session::getVar("usersFiltrEmail",$_POST['filtremail']),
'error' => 'Błędny email',
));
$filtr_form -> add
(new element
('button_submit.tpl'), array('name' => 'submit', 'value' => "Szukaj",
));
//gdy poprawne dane
if ($filtr_form -> validate() === true || frontcontroller::getParam("page") != "")
{
$_f_login = $filtr_form -> getVal('filtrlogin',session::getVar("usersFiltrLogin"));
if ($_f_login != "")
{
$kolekcja -> addFiltr("login", $_f_login, "REGEXP");
session::setVar("usersFiltrLogin", $_f_login);
}
$_f_email = $filtr_form -> getVal('filtremail',session::getVar("usersFiltrEmail"));
if ($_f_email != "")
{
$kolekcja -> addFiltr("email", $_f_email, "REGEXP");
session::setVar("usersFiltrEmail", $_f_email);
}
}
else
{
session::setVar("usersFiltrLogin", "");
session::setVar("usersFiltrEmail", "");
}
//$kolekcja -> addFiltr("id", '1', "=");
$users_widok -> assign("filtr", $filtr_form);
$kolekcja -> makeCollection(frontcontroller::getParam('page'));
$users_widok -> assign("intPages", $kolekcja -> getPages());
$users_widok -> assign("intPage", $kolekcja -> getPage());
$users_widok -> assign("arrUsers", $kolekcja );
view::assign('content',$users_widok);
}
public function editAction()
{
//utworz domyslny widok modulu
$users_widok = new element("mod_users_edit.tpl");
//utworz usera
$user = new user(frontcontroller::getParam('userid'));
//utworz formularz edycji
$form_user_edit = new form("Edycja użytkownika");
//dodaj pole: login
$form_user_edit -> add
(new element
('text.tpl'), array('name' => 'login', 'caption' => 'login',
'value' => $user -> login,
'valid' => 'isAlpha;notNull;<10',
'error' => 'Błędny login',
));
//dodaj pole email
$form_user_edit -> add
(new element
('text.tpl'), array('name' => 'email', 'caption' => 'email',
'value' => $user -> email,
'valid' => 'isAlpha;notNull;email',
'error' => 'Błędny email',
));
//dodaj przycis submit
$form_user_edit -> add
(new element
('button_submit.tpl'), array('name' => 'submit', 'value' => 'Zapisz',
));
if ($form_user_edit -> validate() === true)
{
$user -> login = $_POST['login'];
$user -> email = $_POST['email'];
$users_widok -> assign("users_content", "Zapisano");
}
else
{
$users_widok -> assign("users_content", $form_user_edit);
}
view::assign('content', $users_widok);
}
public function createAction()
{
//utworz domyslny widok modulu
$users_widok = new element("mod_users_create.tpl");
//utworz formularz edycji
$form_user_edit = new form("Dodawanie użytkownika");
//dodaj pole: login
$form_user_edit -> add
(new element
('text.tpl'), array('name' => 'login', 'caption' => 'login',
'value' => '',
'valid' => 'isAlpha;notNull;<10',
'error' => 'Błędny login',
));
//dodaj pole haslo
$form_user_edit -> add
(new element
('password.tpl'), array('name' => 'password', 'caption' => 'hasło',
'value' => '',
'valid' => 'notNull',
'error' => 'Błędne hasło',
));
//dodaj pole: email
$form_user_edit -> add
(new element
('text.tpl'), array('name' => 'email', 'caption' => 'eamil',
'value' => '',
'valid' => 'isAlpha;notNull;email',
'error' => 'Błędny adres e-mail',
));
//dodaj przycis submit
$form_user_edit -> add
(new element
('button_submit.tpl'), array('name' => 'submit', 'value' => 'zapisz',
));
//gdy poprawne dane to zapisz
if ($form_user_edit -> validate() === true)
{
$arrNewUser = array('login' => $_POST['login'], 'password' => $_POST['password'],
'email' => $_POST['email'],
'group' => 2);
$user = new user($arrNewUser);
$users_widok -> assign("users_content", "Zapisano");
}
else
{
$users_widok -> assign("users_content", $form_user_edit);
}
//wyswietl formularz
view::assign('content', $users_widok);
}
public function deleteAction()
{
//utworz usera
$user = new user(frontcontroller::getParam('userid'));
if ($user -> del())
{
view::assign("content", "Usunięto");
}
else
{
view::assign("content", "Wystąpił problem z usuwaniem...");
}
}
}
?>
<Directory "/var/www/html">
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
</Directory>
i zaczęło działać...
/var/www/html <- katalog stron apacha