An MVC CMF written in PHP, following a tutorial written by github user mosbth.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Another MVC is a Model-View-Controller Content Managment Framework written in PHP, following the Lydia tutorial.

Table of Contents


You can download Another MVC from GitHub.

 git clone git://

You can review its source directly on GitHub:


After you have downloaded Another MVC you have to make the data directory writable. This is the place where Another MVC needs to be able to write and create files. On Linux you could use the chmod command to do this.

 chmod 777 another-mvc/site/data

Secondly, Another MVC used mod_rewrite. If you can see the Index Controller from your own installation, but no other links are working, that means your server has specific needs for .htaccess instructions. Contact your server admin for help on how to make your .htaccess file work with mod_rewrite.

If you can see the Index Controller in your own installation, it is better to follow the rest of the instructions from that page instead of this readme, because there will be links to help guide you through the steps. The paragraph below will mention modules/install, but the Index Controller of your own installation will have a link directly to it.

Finally, Another MVC has some modules that need to be initialized. You can do this through a controller. Point your browser to modules/install (i.e.


After installing Another MVC, you will of course need to configure it to suit your needs. The configuration file can be found in site/config.php and contains further instructions and information about all the settings.


To make your new site look like yours, you will need to configure the theme. Simple changes are made in site/config.php and more advanced theming (HTML and CSS) are made in themes/ or site/themes/. For more advanced theming it is recommended that you create a new directory in site/themes/ and specify a parent in site/config.php instead of modifying the original theme.


To change the site logo, first place the file in the theme root, then open up site/config.php in your text editor and change the filenames and the size specifications. The favicon and logo configs may point to different files.

 $amvc->config['theme'] = array(
   /* ... */
   'data' => array(
     /* ... */
     'favicon'    => 'logo_60x72.png',
     'logo'       => 'logo_60x72.png',
     'logo_width' => 60,
     'logo_height'=> 72,


To change the site title, open up site/config.php in your text editor and change the site_title config from Another MVC to whatever your site's title should be.

 $amvc->config['theme'] = array(
   /* ... */
   'data' => array(
     'site_title' => 'Another MVC',
     /* ... */


To change the site footer, open up site/config.php in your text editor and change the footer config from the Another MVC copyright notice to whatever your site's footer should be.

 $amvc->config['theme'] = array(
   /* ... */
   'data' => array(
     /* ... */
     'footer' => '<p>Another MVC &copy; pejg12 ( <br /> Fork of Lydia &copy; Mikael Roos (</p>',
     /* ... */


To change the site navigation menu, open up site/config.php in your text editor and locate the below code.

 $amvc->config['menus'] = array(
   /* ... */
   'my-navbar' => array(
     'name' => array('label'=>'Example', 'url'=>'controller/method'),

In the code above, the first my-navbar has to be identical to the second my-navbar, because this is where Another MVC is told which menu to display. There can be many menus defined, but only one of them is displayed at any given time. If you change the name of your menu, you will need to make sure to map the new name in the menu_to_region config.

Inside of the my-navbar array you may add any number of menu items, each with a unique name. The name can be anything as it is not used in the actual code and will not be seen by anyone except the developer. The label (defined to Example above) is what your website visitors will click on, and the url (defined to controller/method above) is what url the link will go to. The above example will output HTML similar to this:
<a href=''>Example</a>

New content

Another MVC has built-in support for blog entries and simple page creation using the website GUI. If you have not done so already, make sure to install these modules by visiting modules/install. This will create a few sample blog entries and pages which can be deleted or modified by you.

Once the modules have been installed, visit content (i.e. to view and modify the sample content. You will see a list of all content, blog posts and pages mixed together, with links to edit or view each entry. Below this list there will be an option to initiate the database (this will delete all current content and replace it with the built-in sample content) as well as an option to create new content. It is recommended that you view the sample content first, then delete it, then create your own new content.

Before you create any content, make sure you are logged in as the correct user. It is possible to create a brand new user for yourself unless this option has been turned off in site/config.php, but keep in mind that if you initiate the CMUser module all the new users will be deleted.

New blog

Another MVC only supports one blog per site, so if you want your own unique blog you will first have to delete the sample blog entries. Visit blog (i.e., click the edit link below each entry, then click the Delete button at the bottom of the form.

To create a new blog post, visit content, then click Create new content.

  • The Title should be a human-readable title of the post, such as We're 5 Years Ahead!.
  • The Slug is often a version of the human-readable title which consists of nothing but lowercase letters, digits and dashes, such as were-5-years-ahead.
  • The Content is your entire blog post.
  • The Type must be post for all blog entries.
  • The Filter defines how you want your blog post to be filtered. The options are plain, htmlpurify, bbcode and mediawiki.
    • plain should be used whenever your post contains only text and no markup. All markup will be displayed as code for the visitor.
    • htmlpurify should accept all HTML except what might be considered harmful to the site and its visitors. This can be used to format your post with headers, images, and advanced designs. This is probably more useful for content pages than blog posts. Learn about HTML
    HTML example: This is a <strong>bold</strong> word.
    • bbcode might be familiar from various forums, and is a simple markup for formatting text. Learn about BBCode
    BBCode example: This is a [b]bold[/b] word.
    • mediawiki might be familiar if you have ever edited Wikipedia or Wikia articles, and is also a very simple markup for formatting text. Another MVC's mediawiki filter is very limited compared to the real implementation. Learn about MediaWiki markup
    MediaWiki example: This is a '''bold''' word.

New page

Instead of deleting the sample pages, it is recommended that you edit their content to reflect your site. To edit old pages you must visit content and then click on the edit link next to the page you want to modify.

To create a new page, simply visit content and click Create new content, follow the instructions for blog posts (above) to fill out the form, but in the Type field you must enter page instead.

Your own controller

A custom title, maybe custom CSS and personal blog posts—these are all important details to customize your website for yourself, but they're not enough. You will also need to add your own controllers to make use of Another MVC as intended.

Create a new directory in site/src/ and then create a file with the same name as the directory (plus the PHP file extension). For example, create the directory site/src/CCMyController/ and then the file site/src/CCMyController/CCMyController.php.

All controllers should implement the IController interface, which means they also need to define an Index() method, and to gain access to the core variables all controllers should also extend CObject. Add this code to your CCMyController.php file:

 class CCMyController extends CObject implements IController {
   public function Index() {

To use your new controller (although it doesn't do anything yet) you will need to enable it in site/config.php.

 $amvc->config['controllers'] = array(
   /* ... */
   'my' => array('enabled' => true,'class' => 'CCMyController'),

The name of the controller (defined as my above) is what the user will see in the url. If they go to then Another MVC will try to load the Index() method of the controller CCMyController/CCMyController.php. If you ever want to disable the controller, just change true to false.

Now, let's let your Index() method load the sample About page. Go back to your CCMyController.php file and modify it as below.

     $this->views->AddInclude( . '/about.tpl.php', array(
       'content' => $content,

This will first load the content with id 5 (which is the id of the sample About page) into the variable $content. It then proceeds to set the page HTML title to a safely escaped version of the About page's title, using the $this->views->SetTitle() and htmlEnt() methods. Lastly it will include the file about.tpl.php (we'll get to that in a bit), making sure that this file has access to the $content variable.

Now, create the file site/src/CCMyController/about.tpl.php and write the HTML for displaying your content.

 <?php if($content['id']): ?>
   <h1><?php echo $content['title']; ?></h1>
   <p><?php echo $content->GetFilteredData(); ?></p>
 <?php else: ?>
   <p>404: No such page exists.</p>
 <?php endif; ?>

As you can see, this is an ordinary PHP file. It has access to the $content variable because we sent it in the second parameter to the $this->views->AddInclude() method in the controller. It uses the method GetFilteredData() to fetch the content of the page from the database, filtered using the filter you defined when you modified the content (or whatever filter was defined for the sample).

Following the same steps, you should be able to create the method Blog(), displaying your blog posts in the file blog.tpl.php. For further help, study the Index() method in the built-in blog controller src/CCBlog/CCBlog.php and its HTML src/CCBlog/index.tpl.php. The main difference is that instead of fetching specifically id 5 you do not send any arguments to the CMContent object.

Note that you do not need to enable individual methods, only the controllers. Since CCMyController is already enabled in site/config.php, users will automatically be able to access the Blog() method by visiting