How to access controller method inside the same controller

i have method "A_method" inside the controller. and inside A_method i would like to call another method in same controller "B_method".how can i call method "B_method" inside "A_method"

function A_mehtod() { $rsl = B_method(10); echo $rsl; } function B_method($data) { retun ($data+1); }

please give me a solution in Php MVC. because i'm working on opencart and i'm new to it


$rsl = $this->B_method($data);

That's all. Have a nice day!!

function A_mehtod() {

$rsl = $this->B_method(10);

echo $rsl;


Category:php Time:2014-02-27 Views:0

Related post

  • Accessing controller methods inside a model with Kohana/MVC Framework 2010-06-08

    I need to able to access controller methods from a model using the Kohana V2.3 framework. At the moment I'm passing the controller object (by ref.) to the model on creation which works perfectly fine but I can't help think there is a more "cleaner" w

  • Objective-C - Accessing class methods inside Initializer method 2011-06-11

    I have a class called SqliteImageAccess that is going to have various methods that provide support for some sqlite functionality. I have a local class variable of type sqlite3 and a class method called opendb. This class method should do one thing an

  • Switching between View Controllers via action method inside current view controller 2011-12-12

    My situation is that I have a Primary View Controller (UIViewController in PrimaryViewController.h .m) that contains a UIButton. When pressed, a second View Controller (UINavigationController) is displayed, the general idea is to press a "settings" b

  • Using another Controller/view inside the One controller/view by ajax and CakePHP 2009-06-08

    I m having a three controllers in my app: Forms attributes Users In my /forms/designpage I'm posting the data as: $.ajax({ type: "POST", url: "./attributes/untitledfieldname", data: "sequence_no = " + counter + " & type = " + type, success: funct

  • Access shell methods in controller? Cake PHP 1.3 2010-06-01

    I wrote a shell method in CakePHP 1.3 that has a return value. I'd like to be able to access that method from within a controller, so that I can pass its return value into the View. I'm not sure how to access those methods appropriately from within t

  • MVC - Calling Controller Methods 2010-05-26

    My application is following the MVC design pattern. The problem I keep running into is needing to call methods inside a Controller class from outside that Controller class (ex. A View class wants to call a Controller method, or a Manager class wants

  • Initialize a NSString member variable inside the view controller 2010-01-21

    I have a NSString member variable declared in the header file of the view controller: @interface MyApprViewController : UIViewController { NSString *var; ... } @property (retain) NSString *var; ... -(IBAction)buttonPressed: (id)sender; Inside the imp

  • I tried this as a method in my View Controller, but I'd really like it in a Label 2011-07-03

    I really want to implement a category like 'UILabel+formattedText' that allows me to perform a method which will nicely format the text in the label's visible display, but any code that looks at label.text just sees the unformatted number string. I k

  • Access controller method from inside a model 2012-03-05

    How do I access a controller method from inside a model? --------------Solutions------------- You don't. Although it is technically possible, if you think that you need to, it suggests a flaw in your application's design. The Controller layer is the

Copyright (C), All Rights Reserved.

processed in 0.381 (s). 13 q(s)