Jump to content

Application Development - Basic otherMethod() test not worki


Recommended Posts

Hello, as a new application developer on the IPS platform I am attempting to run through the example provided in Anatomy of a controller located here.

I have added an example module to the core app and within that module I have added a example controller. Here is the content of the controller example.php:

<?php
/**
 * @brief		example
 * @author		<a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
 * @copyright	(c) 2001 - 2016 Invision Power Services, Inc.
 * @license		http://www.invisionpower.com/legal/standards/
 * @package		IPS Community Suite

 * @since		13 May 2017
 * @version		SVN_VERSION_NUMBER
 */

namespace IPS\core\modules\front\example;

/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
	exit;
}

/**
 * example
 */
class _example extends \IPS\Dispatcher\Controller
{
	/**
	 * Execute
	 *
	 * @return	void
	 */
	public function execute()
	{
		parent::execute();
	}

	/**
	 * ...
	 *
	 * @return	void
	 */
	protected function manage()
	{
		// This is the default method if no 'do' parameter is specified
	}
	
	// Create new methods with the same name as the 'do' parameter which should execute it
	
	public function otherMethod()
	{
		echo "Hello world";
	}
}

example.php is located here on our drive: /applications/core/modules/front/example

I navigate to [mysitedomain/index.php]?app=core&module=example&controller=example&do=otherMethod but all I see is this:

543805613a6d2cf1e26ce1e4445bb1d4.png

I expected to see a simple Hello world echoed on the page, but nothing displays. I tried the same type of thing with the application I am working on developing and received the same empty output.

Any tips or assistance you can provide would be greatly appreciated.

Link to comment
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...