arron | 1 Jun 01:04 2011

Re: observeField equivalent in the new JsHelper

some more information.

I tried to debug this in firebug. When i used firebug it shows the
proper response so i an cluseless on why it's not showing on my page

I changed my js code to the following. Does anyone have any idea on
why my results are not being displayed????????

<?php
> $this->Js->get('#countries')->event('change', $this->Js->request(
> array('controller' => 'users', 'action' =>
> 'update_region_select'),
> array(
> 'update' => '#regions',
> 'async' => true,
> 'dataExpression' => true,
> 'method' => 'post',
> 'data' => $js->serializeForm(array('isForm' => false, 'inline' =>
> true))
> ) ) );
>
> ?>

On May 26, 3:49 pm, arron <w...@...> wrote:
> I have a depdent drop down.
>
> when someone picks a country the regions from the country populate. It
> works in 1.2, but when i migrated to 1.3 i had to change a few things
> around because the ajax, observeField and javascript helper has been
> deprecated
(Continue reading)

barricades | 1 Jun 01:09 2011

What's the best way to find these two fields

Hey there, I've got a Campaigns model which belongs to a Charities
model. When a user signs up they are meant to first pick a charity the
id of which gets passed along to the regCampaigns function in the
Campaigns controller.

I'm trying to get three fields from the record of the charity they
picked (the $id which was passed), but I'm not sure how to do this
properly within the campaigns controller.

I've tried read, find, findById and have tried with containable
behaviour but for the life of me can't get just the three fields into
an array.

The fields are id (which I obviously already have) and image_url and
charity_name. I've been trying variations of:
$campCharity = $this->Campaign->Charity->read(array('image_url',
'charity_name'), $charity);
$this->set('campChar', $campCharity);

which is the best so far but it still tries to return all the
campaigns associated with the charity.

I know it's probably dead simple but I've been reading stuff for hours
and it's frustrating :(

--

-- 
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP
related questions.

(Continue reading)

Miles J | 1 Jun 03:14 2011
Picon

Re: Caching

Why not just cache your data instead of the view? Caching the view is
pretty much just stepping in its place.

On May 31, 10:24 am, dreamingmind <dreamingmin...@...> wrote:
> Jeremy,
>
> Yes, another layer... seems a bit crazy. It looks like their may be
> more bits and pieces of unique code sprinkled into your pages than I
> imagined. None the less, a couple more thoughts?
>
> - A new route could override the basic controller/action/params
> pattern and funnel everything to your accumulator controller/action
> while still passing along the controller/action/params that are needed
> to fully inform the process.
> - Or maybe your component just needs to be extended a bit to do the
> necessary additional portioning-out of tasks
>
> Either way seems in line with cake philosophy.
>
> - I've had some success with shipping html into php's XML/DOM
> manipulators
(http://us.php.net/manual/en/refs.xml.phphttp://us.php.net/manual/en/domdocument.loadhtml.php)
and that has
> sometimes made it very easy to swap an entire div in or out of a page.
> It's also given me ways of walking through the DOM in php to make all
> sorts of fussy page tweaks. This just moves the javascripty way
> manipulating pages into your component, action or helper.
> - Possibly a final helper could be fed the cached and dynamic chunks
> for assembly into your final cach-namic page. That would be a pretty
> cake-y way to go.
(Continue reading)

dreamingmind | 1 Jun 03:34 2011
Picon

Re: Best practise? Creating a detailed data report from different linked models?

Michael,

You could certainly have a Reports controller. The expectation would
be that it is operating on the Report model. This seems pretty
unlikely given the information so far. More likely you are wanting a
report on data in some other model (like Project or Customer or ...)
and it's related models.

Starting with the assumption that you want to generate reports on the
model Project, you would want a report action in your Projects
controller. A simple example would be this:

function report() {
  if(!empty($this->data)) {
     $report = $this->Project->find('all', array('conditions'=>'your
conditions', 'contain'=>'fields you want'));
     $this->set('report', $report);
  }
}

In the folder app/views/projects/ you would store your file report.ctp
This file would output a form so the user can control and modify
reports. Also have this file output a formatted report if data is
available to do so. User the Form Helper to generate the form on your
page (http://book.cakephp.org/view/1383/Form).

Given this setup the user would get to the page at http://yoursite.com/projects/report

The report action in your Project controller looks to see if it was
being provided with posted data. On the first visit there would be
(Continue reading)

O.J. Tibi | 1 Jun 04:11 2011
Picon

Re: Caching

Jeremy

Yes, Miles is quite right. If it is practical enough, you should push
enough data (as much data as you expect to be dynamic) about your
navigation structure into the view and let CakePHP cache the view.
Since views are made of PHP opcodes, they still store the variable
values with them once they're cached, therefore you can manipulate
them without the need of executing your controller callbacks.

Cheers,
OJ

On Jun 1, 9:14 am, Miles J <mileswjohn...@...> wrote:
> Why not just cache your data instead of the view? Caching the view is
> pretty much just stepping in its place.
>
> On May 31, 10:24 am, dreamingmind <dreamingmin...@...> wrote:
>
>
>
>
>
>
>
> > Jeremy,
>
> > Yes, another layer... seems a bit crazy. It looks like their may be
> > more bits and pieces of unique code sprinkled into your pages than I
> > imagined. None the less, a couple more thoughts?
>
(Continue reading)

Angel Robert Marquez | 1 Jun 07:36 2011
Picon

Passing fusion chart csv via javascript to a cake controller

I need to export a csv file from fusion charts and pass the data to a cake controller function via javascript/jquery.

HTML
<li><a href="javascript:void(0)" id="downloadCsv" class="userFunctionsButton">Download CSV</a></li>

JS
$(function(){
    $('#downloadCsv').click(function(){
        var myChart = FusionCharts('myChartId3');

        var data = myChart.getDataAsCSV();

        data = data.replace(/"/g, '').replace(/\n/g, 'BREAK'); 
var url = PATH +'dashboard/getCsvReport/?'+ encodeURIComponent( data );
        
        window.location = url;
    });
});

PHP
function getCsvReport($chart_data){
           $filename = 'chart';
 
            $data = str_replace('/', "\n", $chart_data);
  
            header("Content-type: application/force-download");
            header("Pragma: no-cache");
            header("Expires: 0");
            header("Content-Disposition: attachment; filename=\"".$filename.".csv\"");

            $this->layout = 'empty';
            $this->render('/ajax/empty');

            echo $data;
     }


The above only writes the first key value pair to the csv file. Turning on the AllowEncodedSlashes in the apache config is not an option. 

Any ideas? References for sending post data as a form submission or ajax request.

Thank you in advance.

-a 

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/cake-php
Angel Robert Marquez | 1 Jun 07:39 2011
Picon

Re: Passing fusion chart csv via javascript to a cake controller

revised PHP code. apologize.

I need to export a csv file from fusion charts and pass the data to a cake controller function via javascript/jquery.

HTML
<li><a href="javascript:void(0)" id="downloadCsv" class="userFunctionsButton">Download CSV</a></li>

JS
$(function(){
    $('#downloadCsv').click(function(){
        var myChart = FusionCharts('myChartId3');

        var data = myChart.getDataAsCSV();

        data = data.replace(/"/g, '').replace(/\n/g, 'BREAK'); 
var url = PATH +'dashboard/getCsvReport/?'+ encodeURIComponent( data );
        
        window.location = url;
    });
});

PHP
function getCsvReport($chart_data){
           $filename = 'chart';
           $data = str_replace('BREAK', "\n", $chart_data);
  
            header("Content-type: application/force-download");
            header("Pragma: no-cache");
            header("Expires: 0");
            header("Content-Disposition: attachment; filename=\"".$filename.".csv\"");

            $this->layout = 'empty';
            $this->render('/ajax/empty');

            echo $data;
     }


The above only writes the first key value pair to the csv file. Turning on the AllowEncodedSlashes in the apache config is not an option. 

Any ideas? References for sending post data as a form submission or ajax request.

Thank you in advance.

-a 

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/cake-php
Salines | 1 Jun 13:19 2011
Picon

cakephp 1.3.10 - URL rewriting is not properly configured on your server

Hello,
after baking new app i see following message on homepage:
-----------------
URL rewriting is not properly configured on your server.

    Help me configure it
    I don't / can't use URL rewriting
-----------------

My app work correctly..

Is there bug or what?

--

-- 
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP
related questions.

To unsubscribe from this group, send email to
cake-php+unsubscribe@... For more options, visit this group
at http://groups.google.com/group/cake-php

Jens Dittrich | 1 Jun 13:30 2011
Picon

Aw: cakephp 1.3.10 - URL rewriting is not properly configured on your server

you should actually know if you can use url rewriting or your do not want to use it. So what is it?
Have your read the manual? http://book.cakephp.org ?
You will find the answer there...

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/cake-php
Jon Bennett | 1 Jun 14:33 2011
Picon

Re: Static Username

> Notice (8): Undefined property:  View::$Auth [APP/views/pages/
> home.ctp, line 16]
> Fatal error: Call to a member function login() on a non-object
>
> Does your code have to be placed in a controller? I'm trying to
> include it in home.ctp

Auth is a component, so yep, as a controller extension it is only
available inside the controller. As a Mike suggested, you can find the
user and log them in from the controller without a http post request,
or you could even just recreate the session that auth expects and then
redirect to another page (not login though).

hth

j

-- 
jon bennett - www.jben.net - blog.jben.net

--

-- 
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP
related questions.

To unsubscribe from this group, send email to
cake-php+unsubscribe@... For more options, visit this group
at http://groups.google.com/group/cake-php


Gmane