cakephp

CakePHP model useTable with SQL Views

I'm in the process converting our CakePHP-built website from Pervasive to SQL Server 2005. After a lot of hassle the setup I've gotten to work is using the ADODB driver with 'connect' as odbc_mssql. This connects to our database and builds the SQL queries just fine. However, here's the rub: one of our Models was associated with an SQ...

Never display some records in CakePHP

Hi, I would like return some records from my base (eg. users roles) And I use usually function find(), findAll(), etc., and I always must write 'conditions' with like this: not display role admin (name!=admin). My question is, how I can in RoleModel set for all function will be return with this conditions. Sorry for english! Bye! ...

How to add new form fields using jQuery and $form helper?

Hi all, I'm trying to let a user to do a 'Click here to add more info' link. I'm trying to do this with input fields so that the id of the field have to increment. I would like for jQuery to add this on every click where $i is the number of each field incremented: <div id="info"></div> <?php echo $form->input("User.$i.first_name"); ?>...

Undefined method stdClass::user() error when using CakePHP Auth

Hi there, I'm fairly new to CakePHPand am building a site using the Auth component. A couple of times I have tried to do things with this component which have caused the error Fatal error: Call to undefined method stdClass::user() in /ftphome/site/app/controllers/users_controller.php on line 395 The line it refers to in this case is ...

CakePHP. Ajax request not working with debug = 0

I am at a loss. I submit a form via Ajax using submitForm: function(element) { $.post( webroot + 'users/settings', $('#AJAXform').serialize(), function() { var option = $('#AJAXform').find('select option:selected'); $j.current.v.updateField(element, option.text()); $j.curre...

Problem with HTTP POST request to HTTPS URL

I am using CakePHP "HttpSocket" class to post information to a Paypal payments server. My code is working fine when the target URL is http://www.something.com, I can parse the response as I would like. However, when I am trying to post data to PayPals payment API URL (on HTTPS) I get no response whatsoever. I have tried the same code o...

How is simplest method to create threaded list in CakePHP?

I create table: id, name, thread_id The mainly thread has thread_id = 0, but their children has theard_id = id of parent, and how is the best and simplest solution to create list with children, and looks like: Category 1 Product 1 Product 2 Category 2 Product 3 etc... Maybe You have better solution for such a list? Sorry, for my eng...

Changing view caching config in CakePHP

I am working on a project in cakephp where one app will support multiple sites using different domains. This is an issue when using view caching where it only matches to the end part of the url and ignores the host. Is there a way to prefix view caching with the host so that there isn't any conflict across different sites? ...

CakePHP Router::connect() aliases?

Is it possible in CakePHP to have URL aliases in routes.php? Or by what other means can achieve something equivalent: Lets assume I have some paginated views. Among the possible orderings there are particular ones I want to bind to a simple URL. E.g.: http://example.com/headlines => http://example.com/posts/listView/page:1/sort:Post.c...

cakephp dropdownlist

hi, this is the dropdown list link in my edit page when editing it selects the friend automatically, but i want it shows 'select your exiting friend' by default(whenever the page loads).. echo $form->input('PostCard.friend_id',array('label'=>_l('Friend Name List'),'empty'=>_l('Select Your Existing Friend'),'options'=>$friends)); ...

How do you rewrite/recode a website to be scalable?

How do you rewrite a website to be scalable?(traffic) I work with mainly PHP and some Ruby on rails and i know its a generic question. I'm just looking to increase my knowledge so any advice would be useful. Thank you in advance ;-) ...

Using TCPDF and FPDI with cake php

Hi Guys, I have go TCPDF setup in my cake php install and am now trying to also use FPDI with it as i need to add a PDF to the start of the PDF that is being generated. WHen trying to do this i am using 3 classes XTCPDF which holds my header data FPDI - FPDI class TCPDF - TCPDF class and it is setup as so: XTCPDF extends FPDI FPDI...

using cakephp, how do I display a series of data without using for each loops?

The application I'm building is a tennis draw, which has a list of matches organized by round. I've also given the matches a position number as a way to order them and manage matches that are at the top of the draw. In a 32 player draw there are 16 matches in the first round, with match positions ordered from 1 - 16. The draw is laid ou...

CakePHP recommendation to iterate a huge table and generate a sitemap?

I'm trying to create an XML sitemap using CakePHP, from a table which has more than 50,000 records at the moment, each record equivalent to a URI in the sitemap. Now the problem I'm facing is CakePHP is running me out of memory while generating it, for two reasons: A find('all') is building a huge associative array of the entire set of...

Saving array of objects with jQuery AJAX and PHP?

Hi I'm using fullcalendar, jQuery and CakePHP. When using the clientEvents function I get all of the calendar events in an array of objects. I then pass that array to an action via jQuery's $.ajax of type post. But when I inspect the post data I get something like: Array ( [undefined] => undefined ) What seems to be the problem? ...

Trying to integrate CakePHP and jQuery

Trying to integrate CakePHP and jQuery, using next example http://bakery.cakephp.org/articles/view/dynamic-select-boxes-with-ajax-jquery What I want is to when user change first option element, to automaticly fill second select option box with proper values. But, nothing happens, if you can help me why. So, there is a Invoice add for...

Children in the same Model - CakePHP

My table 'Post' has field: id, name, content, post_id When i create new post, the field 'post_id'=0, but when I "answer" to Post, the field 'post_id' get id off answered post ID. My question is, how get post by slug field width post_id=0 (parent) and get his children with 'post_id' = parent.id in one query? ...

How to paginate existing model functions in CakePHP?

I have loads of model functions returning different datasets already. I would like to be able to paginate these without having to rewrite them all using the paginate method in the controller. Is there a tidy way of doing this? ...

using cakephp, how do I handle model operations that return no results so my view doesn't break?

In my controller I have model operations that can return empty results. I've setup the view to display the results using a foreach loop. But if the model opertion is empty and returns no results then the foreach loop is breaking in my view. This is the operation: $match3 = $this->Draw->Match-> find('all',array('conditions'=>array('Matc...

How create select/options tag from find('threaded') in CakePHP

How to create select/option html tag from find('threaded') data in CakePHP? Function find() return results like this: Array ( [0] => Array ( [Forum] => Array ( [id] => 1 [name] => Forum ) [children] => Array ( ...