Creating a new php functionality page in iLister, the business classifieds system

Here’s the step by step guide to create a new functionality page in iLister.

Let’s say we wanted to create a new small enquiry form at the http://www.yoursite.com/contact_us. For this to make happen we will create a new ContactUs handler to process the form values and will place it under miscellaneous. Following are the steps required.

  1. Go to apps/frontEnd/modules/miscellaneous and open config.php
  2. Add a new handler function to the list. In this example we add
    ,
      'contact_us' => array
      (
    	  'display_name' => 'Contact Us Page',
    	  'class' => 'ContactUsHandler',
    	  'raw_output' => true,
      ),
  3. Now goto apps/frontEnd/scripts/miscellaneous and create a new php file named ContactUsHandler.php in it.
  4. Place the following code in it. You will have to modify it according to your needs.
    class ContactUsHandler extends ContentHandlerBase
      {
    	  public function respond()
    	  {	
    	      //execut you form values here, access database or do anything you would do inside any handles of your iLister. You have access to main iLister object $this->appContext here. Also you could render the template file here 
    
    	  }
      }
  5. As a last step goto your admin section and tell your system to access the correct Handler on a http://www.yoursite.com/contact_us call in browser’s address bar. Go to Site Layout > Site Pages (/admin/site_pages/ currently) and click Add New Site Page. In the New Page form add /contact_us/ for URI select miscellaneous for Module and contact_us for the Function field (it should be there once you add them correctly above in config.php).
  6. Create a new template file contact_us.tpl in apps/frontEnd/templates/ActiveTemplateFolderName/miscellaneous. You will place your enquiry form in this template file. Set your form action to http://www.yoursite.com/contact_us.
  7. That’s all about creating a new functionality page in iLister classifieds. I will post some more information on iLister functionality later.

Leave a Reply