At this step, all is done to get the index action showing the list. Make sure you pointed your virtual host to the www directory. the conf directory contains a virtual host sample that allows you to do that. Here is the steps to do that :
$ sudo cp conf/virtual-host-sample.conf /etc/apache2/sites-enabed/simplemvc.conf$sudo vi /etc/apache2/sites-enabed/simplemvc.conf// put your ServerName and the path to the DocumentRoot and Directory<VirtualHost *:80>ServerName www.simplemvc.devDocumentRoot /var/www/simpleMVC/www<Directory /var/www/simpleMVC/www>AllowOverride AllOrder allow,denyallow from all</Directory></VirtualHost>// save the file and exit.$ sudo vi /etc/hosts// add the following line to your hosts file127.0.0.1 www.simplemvc.dev// save the file and exitType now http://www.simplemvc.dev/?controller=Feed&action=index you should see a page like : http://jquerymobile.demo.simplemvc.berejeb.com!
Pretty cool no?
A question that I see coming is : why should I add /?controller=Feed&action=index if This is my first page? You are absolutely right. This can be solved either by a rewrite rule, or by 2 lines added in the bootstrap file. Let’s add them right now. Open the www/index.php file and add the following as the first lines in your try block :
$_REQUEST['controller'] = Toolbox::getArrayParameter($_REQUEST, 'controller', 'Feed'); $_REQUEST['action'] = Toolbox::getArrayParameter($_REQUEST, 'action', 'index');
This should add a default action and controller names if nothing is provided from the request.
You can see the rendering on the iphone, it is really good.
This is all for the indexAction. When clicking on the feed title, we are redirected to the detail page, which we will start implementing right now!
Leave a comment
Simple MVC in action
Type this URL from your iphone, ipad or ipod touch to see the application: