Questions tagged [cakephp]

CakePHP, a framework for PHP, is widely recognized as an open-source web development platform that enables speedy and efficient creation of applications. With its flexible architecture, developers gain the ability to easily build, manage, and launch various projects. By incorporating popular design patterns such as MVC and ORM, along with the convention over configuration approach, CakePHP ensures seamless development processes.

Find the most frequently occurring value in CakePHP's list

What is the best way to list the top occurrences of a value in a table using CakePHP (v3.X)? For instance, how can you display the 10 most common first_name values from a table called Users? Instead of using raw SQL like the example below, is there a mor ...

There seems to be an issue with ngOptions in Angular as it is

Calling all angularjs experts for assistance... Currently integrating cake with angular. Utilizing a rest controller to enable communication and retrieve options in a serialized json format as displayed below Attempting to populate dropdown options: &l ...

What is the proper way to adjust the width of a text box in CakePHP by utilizing the 'style' parameter?

I am currently developing an application using CakePHP, JQuery, and Mysql. On my homepage, I have a list of all the form names. When a user clicks on a form name, it should display the form. In the view for each form, I have the following code: <?php e ...

Creating personalized flash messages in CakePHP

I recently came across a feature in the CakePHP Book where you can create your own customized setFlash messages using an element. However, I'm unsure of what to include inside the element and how to pass different content. For instance, let's sa ...

Refining a list according to specific criteria

The challenge Upon login, users are presented with a list of tasks they need to complete. I am looking for a way to filter these tasks based on assignment. The key fields in the table include: **tasks table** task_id | (Foreign Key int) user | (Foreign ...

A step-by-step guide to receiving Json input in a CakePhp Restful API through the PUT method

Managing data through passing IDs in URL format like /apis/view/id.json allows me to view and delete data. public function view($id) { $api = $this->Api->findById($id); $this->set(array( 'api' => $api, ...

Exploring CakePHP's search functionality for English language dates

In my cakephp application, there is a database table named users containing user data. Each user record includes the registration date stored in a field called date. I want to perform a find query that retrieves all users who registered last month. Here's ...

Refreshing data in CakePHP through ajax to display an updated table

I'm struggling to locate any references on this topic. My challenge involves a webpage that showcases a list of users. Above the list, I can successfully update the user information using ajax. Once updated, I need the table below to reflect these ch ...

The validation 'add()' function in CakePHP 3 is currently functioning with only 2 parameters, despite the method signature indicating that there should actually be 3 parameters

Currently, I am attempting to implement alphanumeric with spaces validation in CakePHP 3.5.13. To achieve this, I have made the following addition to one of my Table classes: // src/Model/Table/SavedSearchesTable.php public function validationDefault(Va ...

Why isn't the data showing in the controller for Cakephp 2.0 Ajax post requests?

I have been working on a CakePHP web application and have created a small Ajax function in the default CTP file setup. I am now trying to send value data to another controller function. In the Chrome browser network, it shows that Ajax is posting to the de ...

Is cakephp generating tabs as output?

I created a web application using cakephp on my Windows XP system with xampp, and everything worked perfectly. However, when I deployed it to a CentOS and an Ubuntu Server, I encountered a strange issue. The problem is that there seems to be a tab space ad ...

Connecting a Router with CakePHP

Router::connect( 'mylogin', array('controller' => 'User', 'action' => 'xyz', 5) ); Is there a method for transforming the string '/User/xyz/5' stored in a database into an array array('controller' => 'User', 'action' => 'xyz', 5)? Is ...

"Delving into the intricacies of CakePHP: Efficiently managing

Imagine a scenario where two models are associated, with the main model having a hasMany relationship with the other model. For example, Donor hasMany Donations. After carefully studying CakePHP's documentation, I came across this important note: "When ...

Interact with JSON data using CakePHP for posting and retrieving requests

Having difficulty posting and retrieving JSON data using CakePHP. In the view file, attempting to post data with code resembling the following: $.ajax({ type: "post", url: '/invoices/insertItem/', data: {'description': "this is description", ...

CakePHP 1.3 - issue with JSON REST call not rendering correctly

I recently followed a tutorial on setting up a REST webservice for JSON and XML. While XML outputs correctly, I encountered an issue with JSON calls which resulted in the "view not found" message from Cake. To address this problem, I made some modificatio ...

"Retrieve data from an Excel file and either present it in a textarea or store it as an array

Is it possible to use JavaScript to read an Excel file and convert a single column (identified by name or index) into an array in JavaScript? ...

Can cakephp applications be deployed on google app engine?

After exploring various options, I came across an interesting article stating that php applications can actually be deployed on Google App Engine using Quercus. This has raised a curious question in my mind - Can cakephp applications also be deployed in a ...

The posted value fails to appear when utilizing enctype as multipart/form-data in the CakePHP framework

In my work with CakePHP, I encountered an issue while creating a form that includes file uploads along with textboxes and textareas. My HTML code for the form is structured as follows : <form action="" id="frmReg" method="post" enctype= "multipart/for ...

Ensuring the Accuracy of Translated Objects within CakePHP 3

I'm currently facing some challenges while trying to validate an I18N field in CakePHP3. The setup for the translate behavior looks like this: $this->addBehavior('Translate', [ 'fields' => ['name', 'body ...

CakePHP 3.6 encountered an issue where it could not convert an object of the class CakeI18nFrozenTime to an integer

In my index.ctp file, I am attempting to determine if a date is more recent than one week ago: (((!isset($task->date_end) || is_null($task->date_end))? strotime('now') : $task->date_end) > strtotime('-1 week')) However, I am encounte ...

Using CSS files in the web directory in CakePHP and connecting them to HTML

Could someone offer some help with cakephp? I'm experiencing an issue related to routes that I can't seem to resolve. I've organized all my css files in webroot/css within my app. In my default layout, I included a html link <link href="css/bootstrap.m ...

Creating a COALESCE statement in CakePHP 3 query builder

Is there a way to incorporate the COALESCE() statement directly in the query builder? SQL SELECT COALESCE(n.value, p.value) AS value FROM nodes n LEFT JOIN parents p ON p.id = n.parent_id PHP I am currently retrieving both child and parent values separ ...

Potential reasons for interrupted connection in a LAMP stack deployment

Server Configuration: MySQL 5.1.73 Apache/2.2.15 PHP 5.6.13 CentOS release 6.5 Cakephp 3.1 I am facing an issue with an import process on the server. After approximately 4 minutes, the process stops abruptly without any error or warning messages in the ...

Displaying data in JSON format using CakePHP

I'm having difficulty formatting the content retrieved from my Controller as JSON in my view. Instead of displaying neatly like a typical JSON output, mine appears messy and unorganized. When I search for JSON online, I see outputs that look like thi ...

Saving CakePHP Math Before!

I'm struggling with implementing a feature in my form where user-submitted data needs to be manipulated based on specific conditions. Depending on the field, I want to either ignore the data, divide it by 100, or multiply it by 1,000,000. While tryin ...

Technique for dynamically incorporating Csrf tokens prior to every ajax request in CakePHP

I am currently using CakePHP 3.6 and have implemented a function that retrieves data via an AJAX call. This function can be triggered from any page on my website, where a button click opens a modal displaying the data fetched through the AJAX call. The iss ...

Encountering a 500 Server Error on an EC2 Ubuntu Instance while using the CakePhp application

I recently created a web app using PHP MySQL in both plain code and also with CakePHP. Everything was working fine until I uploaded the Cake directory to an Ubuntu EC2 instance, which resulted in a 500 server error. I attempted adding / to all three htacc ...

What are the steps for utilizing svn+ssh within a PHP script?

I am facing a challenge in accessing the repository from a CakePHP project called fredistrano (which allows CakePHP deploys with a web 2.0 interface). The issue arises when I try to access fredistrano located in my web broadcasting directory on a shared Un ...

403 error when making an Ajax post request in CakePHP despite having granted all permissions

Encountered a 403 error when making an Ajax request in a Cakephp project. Despite having all permissions granted for the project directory in localhost (XAMPP). Error message: "Failed to load resource: the server responded with a status of 403 (Forbidde ...

"Exploring the possibilities of cakePHP in integrating Ajax

After setting $this->layout = 'ajax', Cake still requires the view file for that action to be present. I'm wondering, is it necessary to create that view file, or is there a workaround? I want to avoid having one-liner view files for ajax actions like ...

CakePHP is experiencing issues with JsHelper and Ajax functionality

I'm really struggling to figure out what's happening here! The jQuery doesn't seem to be working at all. Even though the script is being generated, when I click on the submit button, it behaves the same as if jQuery and Ajax weren't inv ...

Unable to access View variables set in App controller in Cakephp 3 when rendering certain templates or during AJAX requests

I have set various view variables in my App controller like company name, address, and contact information that change depending on subdomains to make them available across all view templates. However, I am facing difficulties in understanding why they are ...

The 1and1 Server is experiencing a 500 internal error when using Ajax and jQuery .Load() functions, but accessing the URL directly seems to

Currently, I am utilizing a jQuery .load() function to enable infinite scrolling in a CakePHP web application. Below is the snippet of Javascript code: $("#post_container").append('<div class="batch row" style="display:none;"></div>&apos ...

Utilizing a separate MySql database for write functions within CakePHP

My MySQL RDS instance needs to be scaled. I am able to launch read replicas in Amazon RDS, however, there is an issue with write operations not functioning on read replicas. Is there a way to redirect all write operations (INSERT, UPDATE, DELETE) to the ma ...

Unable to fetch data in CakePHP 3.x controller using jQuery AJAX POST

I've been searching everywhere and unfortunately, I can't seem to figure out why the data is not being sent to my controller when posting via ajax. Here's the jQuery code snippet: var newDate = {}; newDate['start'] = startyear+"-"+startmo ...

Exploring the capabilities of Google API Client with CakePHP 3

I recently installed the Google PHP API Client library using Composer from this link: https://github.com/google/google-api-php-client After installation, the guzzle, psr, monolog, firebase, and google directories were generated in my vendor directory. Ho ...

Utilizing Gmail's TLS-enabled Outgoing SMTP in PHP for Sending Emails

Currently, I am trying to send email from PHP using the Gmail SMTP server. I had everything set up and working smoothly with SSL over port 465, but unfortunately, my web host does not allow outgoing traffic over this port. However, they did inform me that ...

Locate the sorting order of CakePHP with its corresponding associated fields

Array ( [Page] => Array ( [id] => 1 [parent_id] => 0 [title] => example [url] => http://www.example.com [slug] => www_example_com ...

Utilizing CakePHP 3.0 with jQuery UI for an autocomplete feature

Seeking assistance on why the current code isn't functioning. The objective is to retrieve data from the index controller to search and obtain JSON data. No requests are being made, and there are no visible results. New to CakePHP 3.0, I am attempting to ...

How to use CakePHP to load a view containing PHP variables and then return it using Ajax

Alright, I've been seriously bothered by this issue for the past couple of days. Let's take a look at my form: echo $this->Form->create(FALSE, array('id' => 'AdminGeneralReport', 'class' => 'Report ...

Connecting Models in CakePHP

As a beginner in using cakephp, my goal is to display a list of all subjects belonging to a specific subject category. I have created a Subject model with the following code: subjects.php <?php class Subject extends AppModel { var $name='Subject'; va ...

CakePHP is currently experiencing an issue with password hashing inconsistency

I am facing an issue with implementing a password reset function for my CakePHP website. I have tried various methods such as $auth->hashPasswords, $auth->password, and even Security::hash, but none of them seem to be hashing the password correctly. ...

employing the condition of AND in MySQL

What I am searching for is: if I provide training_ids 172 and 174, it should only return user 150 I attempted the following query but it did not produce the desired result SELECT user_id FROM Training_users WHERE training_id = 172 AND training_id = 174 ...

CakePHP guaranteeing true validation every time

Hey everyone, I'm relatively new to cakePHP and I've been struggling with a simple user registration feature. For the past two days, I've been stuck on validating the form. No matter what, the validation function always returns true, which means that even ...

Unable to invoke the jQuery function within CakePHP3

I am having trouble calling the jQuery function mentioned below in my CakePHP3 MVC project. There are no error messages, but nothing seems to be happening. The code is set up so that jQuery gets included automatically. The function I am trying to call sh ...

Using PHP, create a menu tree by filtering an array

$this->loadModel('Menu'); $this->loadModel('SubMenu'); $this->loadModel('SubSubMenu'); $options['joins'] = array( array('table' => 'sub_menus', ...

Efficient Pagination in CakePHP Using Ajax Search Functionality with POST Data

I am in the process of implementing a search functionality in my CakePHP 2.x project. Below is the controller code I have written: public function admin_index() { $this->Customer->recursive = 0; $this->Paginator->settings = array( ...

Making an Ajax call using CakePHP

Encountering an issue with the AJAX call. Currently working on a website project in PHP using CakePHP framework, where a popup appears prompting the user to choose between "yes" or "no". Depending on the choice made, the selection should be saved. However, ...

Having trouble with Cakephp 3.0 not saving Entity without any errors - anyone know what could be causing this issue?

$newContainer = $this->Containers->newEntity($this->request->data); if($this->Containers->save($newContainer) !== false) { $this->Flash->success("Saved"); } else { debug($newContainer); } Why does it always display the deb ...

Arranging the results from the treeList search into a sorted list

Can the output of a treeList be sorted? $orgUnits = $this->OrganizationalUnits->find('treeList', [ 'keyPath' => 'id', 'valuePath' => 'name_en', 'spacer' => ...

Issue encountered in CakePHP 3.5 when using the Crud plugin (Uncaught Exception in CrudComponent.php)

While trying to implement the plugin friendsofcake/crud, version 5.4.1, on a fresh installation of CakePHP 3.5 with the Api, ApiPagination and ApiQueryLog listeners, I encountered an issue. My setup includes PHP 7.0 on Ubuntu. Following the installation i ...

SQL Error: 1054: The column 'Array' in CakePHP 1.3 is unrecognized

I am currently using the CakePHP-Photo-Behavior from the repository https://github.com/dilab/CakePHP-Photo-Behavior and I encountered an error while running it. The error message states: SQL Error: 1054: Unknown column 'Array' in 'field list' [COREcakel ...

How can I specify the parent or current object in a CakeORM hasMany relationship condition?

Currently, in CakeORM 3.2, the scenario involves an object named Cabinet, which possesses Siblings. These Siblings are essentially other Cabinets positioned similarly (meaning they share the same values for x, y, and location_id). Within the hasMany relati ...

Optimal method for sending FQL response to cakephp controller using jQuery

My FQL result is a JavaScript object with the following structure: [{"name":"3904","fql_result_set":[{"like_count":"0"}]},{"name":"7617","fql_result_set":[{"like_count":"0"}]},{"name":"9674","fql_result_set":[{"like_count":"0"}]}] I am struggling to pass ...

Encountered a message stating "Value cannot be converted to string" while fetching data from a belongsToMany relationship

Currently, I am utilizing CakePHP 3.3.6 along with MySQL 5.7.13. The database consists of several tables, including collections, tags, and the intermediary table collections_tags. Collections Table CREATE TABLE IF NOT EXISTS `database`.`collections` ( ...

Looking for CakePHP error views for handling JSON and XML responses?

I am currently in the process of developing a REST API using CakePHP. Essentially, when I send requests to endpoints like add.json, the input data is processed and a JSON response is returned. Similarly, if I send it to add.xml, an XML response is generate ...

A Sweet Journey into CakePHP4 - Crafting Exquisite Moments with Ajax

I'm currently learning how to work with CakePHP, and I am encountering difficulties in adding a form that can post to a different database table using ajax. The form I have now successfully carries out a search, but before the user can perform the search, ...

Issue with retrieving validation messages from saveMany function in CakePHP when it is invoked through a Behavior

Hey there, I've got a behavior that allows me to upload data from an Excel file to the model. The issue I'm facing is that when the data is invalid, I don't receive any errors - just a silent failure. I return a generic error message in this ...

Activate the dialog box exclusively after data has been submitted via the submit button on a form

My goal is to create a data saving functionality with a next button. After filling out the form, clicking on the next button triggers a popup dialog asking, "Do you want to submit your data?" To achieve this, I included the following code in my submit but ...

Preserving specific items while juggling multiple tasks

When using a select input with multiple set to true, how can I save this data in a cakephp-friendly way while also implementing validation? <?php echo $this->Form->input("user_id", array('multiple'=> 'checkbox' )); ?> ...

Once the response is received, the ajax function does not trigger any callbacks such as complete, success,

I am currently facing an issue with an AJAX call to a CakePHP function in the controller. The problem lies in the fact that after the controller function sends back a response, neither the complete nor success nor error functions are being triggered. Any ...

Loading a gallery dynamically using AJAX in a CakePHP application

I am currently working with Cakephp 2.8.0 and I am facing an issue with implementing ajax in my application. I have a list of categories displayed as li links, and upon clicking on a category, I need to remove certain html code, locate the necessary catego ...

CakePHP 1.3.6 is pushing the memory limits on a MAMP server, whereas it is not experiencing the same issue on

Recently, I have taken over a large code base that was developed by an external source for my company. The code is built using cakephp version 1.3.6. Running the application on a lamp server with php5.3.29 works fine. However, when I try to run it on a ma ...

Using CakePHP4: Transmit Data via Ajax from Controller to View

I'm trying to retrieve data from the database and send it using Ajax in CakePhp4 from the controller to the view. Although I've managed to implement it (with sparse documentation), I'm facing an issue where it doesn't return me the array. It seems to be e ...

Storing various values in the database using CakePHP 3

While working on receiving data, I encountered an issue where the saved time in the database is different from what was input. For example, when I send 8:00 pm, it gets saved as 12:00 am due to a +4 hour difference. When I receive data from a form and che ...

Configuring the timezone for the database in CakePHP

To ensure my CakePHP application is internationalized, I am setting the timezone for PHP and MySQL. When a client sends a request to the server, before processing the request, the server connects to a GeoIP location server to retrieve the timezone. I then ...

The issue of not displaying results in a DIV when using CakePHP 2 and jQuery

I'm having trouble creating an auto-refreshing DIV with updated data. Despite everything appearing to be correct, it's not displaying any results on the webpage. Any assistance would be greatly appreciated :) Controller: public function homeNewMessagesA ...

What is the method to establish the table format in HTML using several for each loops?

I need to arrange the table structure for product plans as follows: +------------------+---------------+---------------+ | product1 | product2 | product3 | +------------------+---------------+---------------+ | product1plan1 | product ...

Event Triggering in CakePHP

I am struggling with the onChange event in this code snippet. I must have overlooked something because it's not functioning as expected. Can someone please point out my mistake? Your assistance is greatly appreciated: <td class="cellInput"> < ...

Guide on displaying the AJAX response in CakePHP 3.1

I'm working with a table that contains checkboxes. After selecting them, I want to calculate the sum of values from the table in a modal before confirming the form submission. Can someone guide me on how to render the AJAX response from the controller? Her ...

CakePHP: Oops! The view for the TasksController::index() cannot be located

I am currently using CakePHP version 2.5.5 for my project located in the directory: C:\xampp\htdocs\vy\cakephp-2.5.5. The layout of my project directory is as follows: I have created a file named C:\xampp\htdocs\vy&b ...

Include CakePHP named parameters in the URL when selecting from a list

If I have a selection list like the one below: <select name='languages'> <option value='german'>German</option> <option value='english'>English</option> </select> How can I use JavaScript/jQuery to refresh the ...

What is the process of running PHP in a .ctp file within the CakePHP framework?

I have recently started working with CakePHP and I have a question about how PHP code is executed in a file with the .ctp extension. Can you explain how PHP is processed within a .ctp file in CakePHP? Additionally, I'm also curious about executing PHP co ...

Ensuring CakePHP Security: Guarding Against Form Injection

Currently, I have a Users table with the following structure: |**id**|**username**|**password**|**role**|**email**| When creating an edit page for users to update their username/password/email, but not their role, I am using CakePHP's form helper. I ...

Perform a secondary AJAX request to the database while the initial request is still processing

When I have two AJAX calls, the first one starts a long-running script and the second one polls a database table for a percentage field. Strangely, when making the second AJAX call, the database query will always return false until after the first one is c ...