Questions tagged [cakephp-helper]

Helpers are the component-like classes for the presentation layer of cakephp application

Helpers contain presentational logic that is shared between many views, elements, or layouts.

Deceleration: (In Controller)

class BakeriesController extends AppController {
    public $helpers = array('Form', 'Html', 'Js', 'Time');
}

Usage: (In View)

echo $this->Html->css('styles');

Manual Refrence

17 questions
4
votes
6 answers

cakephp-2.0 simplest ajax link with jshelper

I want to create the most basic ajax link there is in Cakephp 2.0. In index.ctp i have Js->link('myLink', array('controller'=>'technologies', 'action'=>'view'), array('update'=>'#success')); ?>
in…
glasspill
  • 1,290
  • 4
  • 21
  • 36
3
votes
1 answer

File broken when I generate an Excel file with CakePHP 2.x

I am trying to export my database info to Excel with CakePHP 2.5.4. However, Excel cannot open the resulting file myfilename.xlsx. The error given is: "The file format or file extension is not valid. Verify the the file has not been corrupted and…
1
vote
1 answer

php contact form was not working and not redirecting to success page

whats wrong in my code? In HTML, I have taken form and i have created heading3 and i taken two inputs for name and email and i written textarea for message at last i taken another input is for submit and i closed the form tag.
1
vote
1 answer

Interesting Question here - Why Tomorrow Date PHP and +1 Days Gives Different Time

Hello PHP DEV, I Want to know why this strange thing is happening! Example : strtotime("+1 days") returns time as UTC TIME which is current Time so why strtotime('tomorrow') returns time as 00:00:00. I noticed this show wants to know the official…
1
vote
2 answers
1
vote
1 answer

CakePHP - extending FormHelper causes error in it

I want to extend the FormHelper and used this part of a method's code to be called in the view. $out = parent::input($fieldName, $opts); return parent::output($out); Error: Call to a member function useTag() on a non-object File: …
Sven Mäurer
  • 715
  • 1
  • 9
  • 19
1
vote
1 answer

cakePHP- PieChart Helper class

I am trying to make use of this Helper class, which was written for earlier version of cake.. It seems that it makes use of the vendor() method to use a third party class, but now that method is deprecated. I am trying to use the following in the…
LogixMaster
  • 586
  • 2
  • 11
  • 36
1
vote
1 answer

Alter database row from Helper or Component - which ist better?

I am working with CakePHP for quite a while and think that I have a pretty good understanding of the mvc-principle. But today, I encountered a little problem that I do not now how to solve while sticking with mvc. In my database, there is a table…
Lars Ebert
  • 3,487
  • 2
  • 24
  • 46
1
vote
2 answers

Organizing helpers in sub-directories

I am new to CakePHP and I had trouble organizing my helper files. I searched through the web and doesn't seem to find an answer for this. I have no problem using the helpers if I put them under app/Views/Helpers/test. But when I put it under…
AbSoLution8
  • 1,203
  • 1
  • 18
  • 27
1
vote
3 answers

Advice needed in making a CakePHP Helper

I need to make a CakePHP helper which involves making some HTML dynamically. But the part of the code is to make 1-2 database queries. These queries are very essential for this helper as all the text it populates is inside the database. According to…
abhi.gupta200297
  • 881
  • 6
  • 12
1
vote
1 answer

Logic between CakePHP component and helper

I am writing a component+helper pair which handle inclusion of JS files for the current View. The idea is to autoload JS files which have the same name as the view (or action). So if you have a view called 'admin_add.ctp' and a file 'admin_add.js'…
Vanja D.
  • 834
  • 13
  • 20
0
votes
2 answers

Load FormHelper into Controller CakePHP 1.3

So my problem is that i know how to load an Helper into the Controller but it´s only working for HtmlHelper not for FormHelper. i load it into my method like this: //this method is from an controller like page_controller function…
webfacer
  • 109
  • 5
  • 18
0
votes
2 answers

CakePHP 3 - How to set CSS / Script block inside a View Cell

I'm using CakePHP 3.9 I'm trying to set css / script dependency block inside my view cell. I want it to be fetched inside the head of my layout, but it just don't work. If I want it to work I must set the css dependency inside the view before/after…
0
votes
1 answer

cakephp - how to define cake php helpes correctly

I have an ItemsController which extends AppController. To handle my site menu, I used a menuhelper. However, I saw in the documentation that you have to add your helpers in an array in your controller (AppController): public $helpers =…
randomizer
  • 1,619
  • 3
  • 15
  • 31
0
votes
3 answers

how to get json in url https

I want to get timeZoneId using googleapis url. I want this url return me json response to parse it later and insert lat and long in my database. It works fine when it's not a googlemap url but i have the famous "request_denied" error when I use this…
HoangHieu
  • 2,802
  • 3
  • 28
  • 44
1
2