PHP Classes

very simple.

Recommend this page to a friend!

      Another simple MVC  >  All threads  >  very simple.  >  (Un) Subscribe thread alerts  
Subject:very simple.
Summary:Package rating comment
Messages:9
Author:Patrício dos Santos
Date:2010-02-25 07:42:37
Update:2011-02-14 04:47:49
 

Patrício dos Santos rated this package as follows:

Utility: Good
Consistency: Sufficient
Examples: Not sure

  1. very simple.   Reply   Report abuse  
Picture of Patrício dos Santos Patrício dos Santos - 2010-02-25 07:42:37
very simple... and good to undestand MVC concepts

  2. Re: very simple.   Reply   Report abuse  
Picture of lattuada lattuada - 2010-02-25 08:48:15 - In reply to message 1 from Patrício dos Santos
thank you, if i got time these days i'll try to add an authenticated controller example and some login functionalities

  3. Re: very simple.   Reply   Report abuse  
Picture of Patrício dos Santos Patrício dos Santos - 2010-02-25 09:13:04 - In reply to message 2 from lattuada
Hi,

when I access in the browser, where I put {header}, {content} and {footer} I see header, content,footer and not test.phtml content, test2.phtml and footer.phtml

see the output:

[quote]
Hello World!
header Olá Mundo---- content vamos ver no que vai dar footer
[/quote]

thanks

  4. Re: very simple.   Reply   Report abuse  
Picture of lattuada lattuada - 2010-02-25 09:23:11 - In reply to message 3 from Patrício dos Santos
are you accessing the right url (smth like http://localhost/mvc/www/ ) and did you set up the htaccess properly?

  5. Re: very simple.   Reply   Report abuse  
Picture of Patrício dos Santos Patrício dos Santos - 2010-02-25 09:37:00 - In reply to message 4 from lattuada
I have a folder project in my web root called "simple_mvc" and to access it I do type this url: http://localhost/simple_mvc

In simple_mvc I create this directory extruture:

simple_mvc/
- classes/
-- Base.php
-- Db.php
-- Front.php
-- Template.php
-- View.php
- config/
-- defines.php
-- startup.php
- models/
-- Employees.php
- modules/
-- index/
--- views/
---- main.phtml
---- test.phtml
---- test2.phtml
---Index.php
- templates/
-- hello.tpl
- index.php
- .htaccess


.htaccess content:
[quote]
RewriteEngine on
RewriteBase /simple_mvc/
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(foo|bar).* - [L]
SetEnv PHP_VER 5
[/quote]

config/defines.php content:
[quote]
<?php
//date_default_timezone_set('Africa/Luanda');
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
ini_set('error_reporting', E_ALL);

define('ALIAS','simple_mvc');
define('APP_DIR', realpath(''));
define('APP_URL','http://'.$_SERVER['SERVER_NAME'].'/'.ALIAS);
define('DS', DIRECTORY_SEPARATOR);
define('DB_DSN','mysql:dbname=mvc;host=localhost');
define('DB_USER','******');
define('DB_PASS', '******');
?>
[/quote]


templates/hello.tpl content:
[quote]
<h3>Hello World!</h3>

{header}
Olá Mundo---- <hr />
{content}
vamos ver no que vai dar
{footer}

<script>
abc = function(){ //alert('whatever');}
</script>
[/quote]


that is it...

thanks



  6. Re: very simple.   Reply   Report abuse  
Picture of lattuada lattuada - 2010-02-25 10:18:32 - In reply to message 5 from Patrício dos Santos
hi
i'm trying the same config on my server it works fine for me.
try debugging the Template::show method to see if the regex is successful on your config, may be a config of your server thing too.

  7. Re: very simple.   Reply   Report abuse  
Picture of Patrício dos Santos Patrício dos Santos - 2010-02-25 14:40:38 - In reply to message 6 from lattuada
I am not able to debug...

can you tell me what is the recomendad webserver configuration for this simple MVC work perfetly?

thanks

  8. Re: very simple.   Reply   Report abuse  
Picture of Philip James Philip James - 2010-02-25 16:15:17 - In reply to message 7 from Patrício dos Santos
use xampp, u'll have it working from start

  9. Re: very simple.   Reply   Report abuse  
Picture of Alexandra S Alexandra S - 2011-02-14 04:47:52 - In reply to message 1 from Patrício dos Santos
I have 2 modules - Index and Admin.

how do I access Admin?

typing .../mvc/www/admin doesn't work. with or without capitalization.

I have all the right files everywhere, running LAMP on Fedora 13.