amostajo / wordpress-plugin

A Wordpress Plugin Template that comes with MVC and Composer for a flexible and ordered development.
MIT License
9 stars 2 forks source link

Wordpers Plugin Controller Issue #1

Open classicalrehan opened 8 years ago

classicalrehan commented 8 years ago

Hello Team,

I have just downloaded this plugin from your source code but I am facing problem to calling controller action.

I have created controller PostController as per your reference documents.

<?php

namespace MyApp\Controllers;

use Amostajo\LightweightMVC\Controller;

class PostController extends Controller { public function filter ( $content ) { // CUSTOM CODE return $content; } }

and save this code under controller directory with Post.php

and then I am calling this controller into Main.php

/* * Declares HOOKS and FILTERS when on admin dashboard. / public function on_admin() { // Call public Wordpress HOOKS and FILTERS here // -------------------------------------------- // i.e. // add_action( 'admin_init', array( &$this, 'admin_init' ) ); add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );

}

/* * Add options page / public function add_plugin_page() { // This page will be under "Settings" add_menu_page( 'Settings Admin', 'Job Settings', 'manage_options', 'my-setting-admin1', array( $this, 'job_setting_page' ) ); } public function job_setting_page() { $content ="Hello";

    return $this->mvc->action( 'PostController@filter', $post_id );
}

but it's not showing passed content. It's nothign to represent any output.

Please have a look and let me know how can resolve this.

Thanks Rihan

amostajo commented 8 years ago

You must pass the parameter $content to the controller, like:

return $this->mvc->action( 'PostController@filter', $content );
classicalrehan commented 8 years ago

Hello,

Still I am unable to call controller.

I thing I am missing naming convention. Can you tell what is naming convention for controller file with path.

Or provide me sample code.

Thanks for help.

Thanks Rihan

classicalrehan commented 8 years ago

wordpress-plugin.tar.gz

Hello,

I have attached sample code, here just I am printing Hello, but not getting output, it's showing fatal error.

Please help.

Thanks Rihan

classicalrehan commented 8 years ago

Hello,

I have just download code from your code repo i.e. http://wordpress-dev.evopiru.com/download/

but here src folder is missing as I have gone https://github.com/amostajo/lightweight-mvc

is both are interrelated?

or just share the sample code with controller model and view

Thanks Rihan