Routing Problems

I’m trying to develop a plug-in and I’m having trouble creating a route. I think I’m missing something when it comes to creating new routes. Any help would be much appreciated. Here is my file structure:

NeatlineAccessiblePage (plug-in directory)

  • controllers (folder)
  • NeatlineAccessiblePage_RecordsController.php
  • NeatlineAccessiblePagePlugin.php
  • plugin.ini
  • plugin.php


class NeatlineAccessiblePagePlugin extends Omeka_Plugin_AbstractPlugin
  public $_hooks = array(

  public function hookDefineRoutes($args)
    $router = $args['router'];
    $route = new Zend_Controller_Router_Route(
        'controller' => 'records',
        'action' => 'display',
        'module' => 'neatline-accessible-page'

    $router->addRoute('accessible-page', $route);


class NeatlineAccessiblePage_RecordsController extends Omeka_Controller_AbstractActionController

  public function displayAction()
    echo "Hello";

http://localhost/omeka_install/accessible-page is returning a 404 and “Hello” is never printed. Any help would be much appreciated.

You have both a plugin.php and a NeatlineAccessiblePlugin.php file listed: you really should only have one or the other.

plugin.php is the old non-class-based main plugin file, and if you’re not using it, you should delete it.

plugin.php looks like this:

  define('NL_ACCESSIBLE_PAGE_DIR', dirname(__FILE__));

require_once NL_ACCESSIBLE_PAGE_DIR . '/NeatlineAccessiblePagePlugin.php';
$accessible = new NeatlineAccessiblePagePlugin();

Should that code be located somewhere else?

If this is a plugin for Omeka 2, you don’t need that code at all.

Ah. Renaming NeatlineAccessiblePage_RecordsController.php to RecordsController.php. I must of been looking at an old naming convention. Thanks jflatnes for your help!

Ah, that makes sense. I missed the filename there, and it is a bit of an odd case for controllers in modules that doesn’t come up almost anywhere else, where the filename should be different from the class name.