Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7987957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:17:51+00:00 2026-06-04T12:17:51+00:00

In CakePhp 1.3: orry if this question is stupid, but I really don’t know

  • 0

In CakePhp 1.3:

orry if this question is stupid, but I really don’t know why my code is not working, maybe someone can point me in the right direction. My problem/question is: how can I access a function in a controller from the app_controller?

I have an app/controllers/items_controller.php:

class ItemsController extends AppController {
       ...
        function holaItem(){
            $i = 1;
            return $j = 2;
        }
        ...
}

app_controller.php

class AppController extends Controller {
     var $uses = array('Item');

    function beforeFilter() {
        parent::beforeFilter();
        $result2 = $this->Item->holaItem();
    }
}

Why “$this->Item->holaItem()” is not working?
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:17:53+00:00Added an answer on June 4, 2026 at 12:17 pm

    $this->Item reference the Item model. However, the holaItem() method exists in the Item controller.

    Either move it to your Item model or move the beforeFilter() to your Item controller.

    I’d encourage you to read and understand how CakePHP does MVC.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using CakePHP to build an application using the MVC Pattern, but my question
the cakephp rest tutorial says that post data should be in $this->data, but I
CakePHP is driving me nuts! Here is my code: if($this->Page->save($datavalue)) { $this->Session->setFlash('Page content updated
In cakephp, I used $rNo array in WHERE clause. $rooms =$this->find('all',array( 'conditions'=>array(NOT=>array('Room.id'=>$rNo)), 'group'=>array('Room.room_type_id'))); Now,
Using CakePHP 1.3.6 I'm sure I may have to add code and examples, but
In CakePHP view, When I try this code <?php echo $form->input('download_link', array('type'=>file)); ?>> whose
I have used cakePHP 1.2 and know how to use behaviors in it. using
CakePHP problems by not getting the _schema my model in cakephp: <?php App::uses('AppModel', 'Model');
In CakePHP 2.0 version, I have written something like this in UsersController.php public function
The CakePHP framework is a layered structure. My question is: Where (theoretically) is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.