Implementing uploadify - File upload issue - param definitions issue

2010-03-20 Thread abocanegra
Alright, ahead of time thanks for any help on this. I have been
researching for far longer than I care to admit. I am attempting to
get uploadify 2.1 to work with cakePHP 1.3. I have read up a great
deal on other formats as well, such as swfupload.

Controller name = photos_controller.php
  relevant functions = upload & addmult
Model Name = photo.php
views= addmult.ctp (upload.ctp is just the function being called from
addmult)

Sucesses - I have been able to get the browse and upload working (on
the surface). It appears to handle a multi-upload, or at least goes
through the paces. Also I am able to trigger the upload function from
the controller and add either the name using $this->params['form']
['Filedata']['name'].

Problems -
 I cannot get the file uploaded to my uploads/temp directory (it is
777 and works well with my single image upload script). I have tried
every variation including absolute paths to get to it
.
There does not seem to be any error messages, I have tried adding a
few from the various forums, none have done anything.

When I trigger the multiple uploads it goes through the paces, but
only adds one entry into the database.
Also It appears the database tends to only accept 2 entries, though I
haven't thoroughly tested that problem.

Goal -
I am hoping to implement this function so that I can utilize it with
image.php which i have altered to create the files in the manner I
need. To do this I will need to be able to send the file to image.php
for scale changes, multifolder organization and name changes. After
which it will redirect to a page to add the additional info (title,
client, etc) needed.

Any advice on any of the issues would be appreciated.

Code Snippets:

Controller:
#
class PhotosController extends AppController {

var $name = 'Photos';
var $components = array("Image");
var $helpers = array('Html', 'Javascript', 'Form');

function beforeFilter() {
if ($this->action == 'upload') {
$this->Session->id($this->params['pass'][0]);
$this->Session->start();
}
parent::beforeFilter();
}

function upload()
{
 if (isset($this->params['form']['Filedata']))
{
//Derived from the uploadify.php file - does not work
//$tempFile = $this->params['form']['Filedata']['tmp_name'];
//  $targetPath = 'http://www.whatartist.coms/uploads/temp';
//  $targetFile =  str_replace('//','/',$targetPath) . $this-
>params['form']['Filedata']['name'];
//move_uploaded_file($tempFile,$targetFile);

$image_path = $this->params['form']['Filedata']['name'];

if(isset($image_path))
{

$this->Photo->saveField('image',$image_path);
//Put success message and redirect here
}else{
//Put error message here
}
}
}


 // Handle multiple incoming uploads.
function addmulti() {
   //Left empty because it was providing no functionality
  // I did try posting to this instead of upload function but
didn't work so cleared it
}

function upload()
{
 if (isset($this->params['form']['Filedata']))
{

//Derived from the uploadify.php file - does not work
//$tempFile = $this->params['form']['Filedata']['tmp_name'];
//  $targetPath = 'http://www.whatartist.coms/uploads/temp';
//  $targetFile =  str_replace('//','/',$targetPath) . $this-
>params['form']['Filedata']['name'];
//move_uploaded_file($tempFile,$targetFile);

$image_path = $this->params['form']['Filedata']['name']; //Works

if(isset($image_path))
{

$this->Photo->saveField('image',$image_path);
//Put success message and redirect here
}else{
//Put error message here
}
}
}

//View - addmult.ctp



  $(document).ready(function() {
$("#fileInput2").uploadify({
'uploader'   : '/admin/swf/uploadify.swf',
'script' : 'url('/photos/upload/'.$session-
>id()); ?>',
'cancelImg'  : '/admin/img/cancel.png',
'fileExt': '*.jpg;*.jpeg;*.png;*.gif',
'folder' : '../../../uploads/temp',
'multi'  : true,
'auto'   : true,
'fileE

Re: Cake php help

2010-03-20 Thread nurvzy
That's the standard baked home page.  What's the problem?

Possible common problems:

Problem: Is it not styled.
Answer 1: check that .htaccess are present and that you have
mod_rewrite active
Answer 2: delete all .htaccess and Edit the config/core.php to
uncomment the AppBase configuration

Problem: Database not found
Answer: create a database.php file in config/ and follow the example
(database.php.default)

Problem: Notice of Security.salt
Answer: change the value in Security.salt in config/core.php to be
something else.

If that doesn't help you, please be more specific on what the problem
is.

Hope that helps,
Nick

On Mar 20, 3:41 pm, Zaky Katalan-Ezra  wrote:
> http://book.cakephp.org/view/308/Installing-CakePHP
> cake version?
> OS?
> web server?
> Something...
>
>
>
> On Sat, Mar 20, 2010 at 4:49 AM, Manzoor  wrote:
> > I have downloaded all the version of cake php but when I hit the
> > index.php
> >  page that shows different page like. please can you tell me how to
> > solve the problem
>
> > --- 
> > --
> > CakePHP: the rapid development php framework
>
> > Release Notes for CakePHP 1.2.0.6311 beta.
>
> > Read the release notes and get the latest version
> > Notice (1024): Please change the value of 'Security.salt' in app/
> > config/core.php to a salt value specific to your application [CORE\cake
> > \libs\debugger.php, line 535]
> > Your tmp directory is writable.
>
> > The FileEngine is being used for caching. To change the config edit
> > APP/config/core.php
>
> > Your database configuration file is NOT present.
> > Rename config/database.php.default to config/database.php
>
> > Editing this Page
>
> > To change the content of this page, edit: APP/views/pages/home.ctp.
> > To change its layout, edit: APP/views/layouts/default.ctp.
> > You can also add some CSS styles for your pages at: APP/webroot/css.
>
> > Getting Started
>
> > Working copy of the new CakePHP 1.2 Manual (temporary) The 15 min Blog
> > Tutorial
> > The OCPHP presentation on new features in 1.2
> > More about Cake
>
> > CakePHP is a rapid development framework for PHP which uses commonly
> > known design patterns like Active Record, Association Data Mapping,
> > Front Controller and MVC.
>
> > Our primary goal is to provide a structured framework that enables PHP
> > users at all levels to rapidly develop robust web applications,
> > without any loss to flexibility.
>
> > Cake Software Foundation
> > Promoting development related to CakePHP
> > The Show
> > The Show is a weekly live internet radio broadcast where we discuss
> > CakePHP-related topics and answer questions live via IRC, Skype, and
> > telephone.
> > The Bakery
> > Everything CakePHP
> > Book Store
> > Recommended Software Books
> > CakeSchwag
> > Get your own CakePHP gear - Doughnate to Cake
> > CakePHP
> > The Rapid Development Framework
> > CakePHP Manual
> > Your Rapid Development Cookbook
> > CakePHP API
> > Docblock Your Best Friend
> > CakeForge
> > Open Development for CakePHP
> > CakePHP Trac
> > For the Development of CakePHP (Tickets, SVN browser, Roadmap,
> > Changelogs)
> > CakePHP Google Group
> > Community mailing list
> > irc.freenode.net #cakephp
> > Live chat about CakePHP
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> > To unsubscribe from this group, send email to 
> > cake-php+unsubscribegooglegroups.com or reply to this email with the words 
> > "REMOVE ME" as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Cake php help

2010-03-20 Thread Zaky Katalan-Ezra
http://book.cakephp.org/view/308/Installing-CakePHP
cake version?
OS?
web server?
Something...

On Sat, Mar 20, 2010 at 4:49 AM, Manzoor  wrote:
> I have downloaded all the version of cake php but when I hit the
> index.php
>  page that shows different page like. please can you tell me how to
> solve the problem
>
> -
> CakePHP: the rapid development php framework
>
> Release Notes for CakePHP 1.2.0.6311 beta.
>
> Read the release notes and get the latest version
> Notice (1024): Please change the value of 'Security.salt' in app/
> config/core.php to a salt value specific to your application [CORE\cake
> \libs\debugger.php, line 535]
> Your tmp directory is writable.
>
> The FileEngine is being used for caching. To change the config edit
> APP/config/core.php
>
> Your database configuration file is NOT present.
> Rename config/database.php.default to config/database.php
>
> Editing this Page
>
> To change the content of this page, edit: APP/views/pages/home.ctp.
> To change its layout, edit: APP/views/layouts/default.ctp.
> You can also add some CSS styles for your pages at: APP/webroot/css.
>
> Getting Started
>
> Working copy of the new CakePHP 1.2 Manual (temporary) The 15 min Blog
> Tutorial
> The OCPHP presentation on new features in 1.2
> More about Cake
>
> CakePHP is a rapid development framework for PHP which uses commonly
> known design patterns like Active Record, Association Data Mapping,
> Front Controller and MVC.
>
> Our primary goal is to provide a structured framework that enables PHP
> users at all levels to rapidly develop robust web applications,
> without any loss to flexibility.
>
>
> Cake Software Foundation
> Promoting development related to CakePHP
> The Show
> The Show is a weekly live internet radio broadcast where we discuss
> CakePHP-related topics and answer questions live via IRC, Skype, and
> telephone.
> The Bakery
> Everything CakePHP
> Book Store
> Recommended Software Books
> CakeSchwag
> Get your own CakePHP gear - Doughnate to Cake
> CakePHP
> The Rapid Development Framework
> CakePHP Manual
> Your Rapid Development Cookbook
> CakePHP API
> Docblock Your Best Friend
> CakeForge
> Open Development for CakePHP
> CakePHP Trac
> For the Development of CakePHP (Tickets, SVN browser, Roadmap,
> Changelogs)
> CakePHP Google Group
> Community mailing list
> irc.freenode.net #cakephp
> Live chat about CakePHP
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
>
> To unsubscribe from this group, send email to 
> cake-php+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Setting arrays for a complicated HABTM relationship

2010-03-20 Thread paws_galuten
Hello experts!

Let's say there are many women in my life (ha!) and depending upon the
time, they might have different moods. This cannot be a simple HABTM
relationship because I want a value associated with the join table, so
I have defined the models like this:

Woman hasMany Mood
Time hasMany Mood
Mood belongsTo Woman, Time

The db would be something like:

Women {id, name}
Times {id, name}
Moods {id, woman_id, time_id, mood}  <--- by the way, is "mood" an ok
field name in the "moods" table, or should it be "name"?

Good so far?

Now, let's say in my view I just want to draw a table with Women
across the top (wife, daughter, etc...) and Times along the left side
(Morning, Afternoon, When I Forget A Birthday, etc...). Ideally I'd
want to just cycle through the times (creating table rows), and then
within each row, get each woman's mood for that time. Of course, the
first row will be the names of the women, and the first  of each
row will be the time.

It seems like a simple (and probably common) relationship, but I'm
having trouble seeing the clean and efficient way to set that array in
the controller.

Your thoughts are much appreciated!
Thanks,
Jason

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Cake php help

2010-03-20 Thread Manzoor
I have downloaded all the version of cake php but when I hit the
index.php
 page that shows different page like. please can you tell me how to
solve the problem

-
CakePHP: the rapid development php framework

Release Notes for CakePHP 1.2.0.6311 beta.

Read the release notes and get the latest version
Notice (1024): Please change the value of 'Security.salt' in app/
config/core.php to a salt value specific to your application [CORE\cake
\libs\debugger.php, line 535]
Your tmp directory is writable.

The FileEngine is being used for caching. To change the config edit
APP/config/core.php

Your database configuration file is NOT present.
Rename config/database.php.default to config/database.php

Editing this Page

To change the content of this page, edit: APP/views/pages/home.ctp.
To change its layout, edit: APP/views/layouts/default.ctp.
You can also add some CSS styles for your pages at: APP/webroot/css.

Getting Started

Working copy of the new CakePHP 1.2 Manual (temporary) The 15 min Blog
Tutorial
The OCPHP presentation on new features in 1.2
More about Cake

CakePHP is a rapid development framework for PHP which uses commonly
known design patterns like Active Record, Association Data Mapping,
Front Controller and MVC.

Our primary goal is to provide a structured framework that enables PHP
users at all levels to rapidly develop robust web applications,
without any loss to flexibility.


Cake Software Foundation
Promoting development related to CakePHP
The Show
The Show is a weekly live internet radio broadcast where we discuss
CakePHP-related topics and answer questions live via IRC, Skype, and
telephone.
The Bakery
Everything CakePHP
Book Store
Recommended Software Books
CakeSchwag
Get your own CakePHP gear - Doughnate to Cake
CakePHP
The Rapid Development Framework
CakePHP Manual
Your Rapid Development Cookbook
CakePHP API
Docblock Your Best Friend
CakeForge
Open Development for CakePHP
CakePHP Trac
For the Development of CakePHP (Tickets, SVN browser, Roadmap,
Changelogs)
CakePHP Google Group
Community mailing list
irc.freenode.net #cakephp
Live chat about CakePHP

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: cache is messing up cookies and session???

2010-03-20 Thread leafchild book
I have checked this page:
http://book.cakephp.org/view/213/Cache

try to control cache but it seems
not working?

even I set

something,,, something


browser is keep using cache view so it is not updating current file view.


How can I stop cake to use cache view and shows current one?

Please someone give me some idea

Thanks





On Sat, Mar 20, 2010 at 3:55 AM, leafchild book wrote:

> this is reproducible by everybody
>
> i have to refresh page to get right cookie information.
>
> how can I get right cookie information without refreshing?
>
>
>
>
> On Sat, Mar 20, 2010 at 12:57 AM, John Andersen 
> wrote:
>
>> I would think that this is an issue with the browser cache!
>> Enjoy,
>>   John
>>
>> On Mar 20, 1:05 am, leafchild book  wrote:
>> > I said cache is messing up but not 100% sure but it's obvious that
>> > cookie's info is not update unless page is refreshed
>> >
>> > How can I get right cookie info without refreshing page after user
>> update
>> > shopping cart or their billing info.
>> >
>> [snip]
>>
>> Check out the new CakePHP Questions site http://cakeqs.org and help
>> others with their CakePHP related questions.
>>
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to cake-php@googlegroups.com
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>> To unsubscribe from this group, send email to cake-php+
>> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
>> ME" as the subject.
>>
>
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Better way to handle this model association

2010-03-20 Thread jwerd
Ok, I'm going to try to make this quick.  This _works_ but I think
there is a better way to do it.

Tables:

CREATE TABLE `ratings` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `rating_types_id` tinyint(3) default NULL,
  `editorial_reviews_id` int(11) default NULL,
  `service_types_id` int(11) default NULL,
  `rating` tinyint(2) unsigned NOT NULL default '0',
  `created` datetime default NULL,
  `modified` datetime default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=403 DEFAULT CHARSET=latin1

CREATE TABLE `rating_types` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(100) NOT NULL,
  `published` tinyint(1) default NULL,
  `created` datetime default NULL,
  `updated` datetime default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1

CREATE TABLE `service_types` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) default NULL,
  `published` tinyint(1) default NULL,
  `created` datetime default NULL,
  `updated` datetime default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=latin1

CREATE TABLE `editorial_reviews` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(255) default NULL,
  `review` text,
  `published` tinyint(1) default NULL,
  `created` datetime default NULL,
  `updated` datetime default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=latin1

CREATE TABLE `editorial_reviews_service_types` (
  `editorial_reviews_id` int(11) default NULL,
  `service_types_id` tinyint(2) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
=

editorial_reviews habtm service_types

Anyways, so the main focus point is the "ratings" table.  Essentially,
I want to store the ratings based on a specific editorial and service
type, hence the reason the columns are both present in that table.

The problem is, I have to do a little trickery here, where I have to
write some beforeSave logic to actually insert the rows, and I just
think Cake has an easier way to handle something like this.

Take for instance from the editorial_review.php model:
function beforeSave()
{
if(count($this->data['ServiceType']['ServiceType']) > 0 && count(@
$this->data['Rating']) > 0)) {

// Mapping ServiceTypes
$service_types = array();
if(isset($this->data['ServiceType']['ServiceType'][0])) 
{
foreach(@$this->data['ServiceType']['ServiceType'] 
as $key=>
$val) {
$service_types[$val] = $val;
}
}



foreach($this->data['Rating'] as $step) {
foreach($step as $key => $val) {
if(!empty($val['rating'])) {
// Check if service_type is checked

if(@$service_typ...@$val['service_types_id']] == @
$val['service_types_id']) {
$data_array['Rating'] = array(
  'id'  
 => @
$val['id'],

  'editorial_reviews_id' =>
$val['editorial_reviews_id'],

  'service_types_id' =>
$val['service_types_id'],

  'rating_types_id'  =>
$val['rating_types_id'],

  'rating'   => $val['rating']);
//pr($data_array);

$this->Rating->save($data_array);
} else {
// Play clean-up
$this->Rating-
>deleteAll(array('Rating.editorial_reviews_id' =>
$val['editorial_reviews_id'], 'Rating.service_types_id' =>
$val['service_types_id']));
}
}
}
}
unset($this->data['Rating']);
  }
}
return $this->data;
}

(sorry for the mess, I feel this is more of a hack than anything...

Please help me figure out a better way to handle this, to be more
reusable, I guess is what I'm saying?

Thanks,
Jake

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to 

Re: redirect to anchor link for form validation

2010-03-20 Thread cricket
To include anchor in a URL, provide the id with the '#' key in the
URL. If your anchor ID is 'foo', you'd use something like:

'controller' => 'xxx', 'action' => 'yyy', '#' => 'foo'

... in the form action. You need to specify it there, and not in a
controller redirect, because the page is not reloaded when there are
validation errors. The form submits to the same URL, and, if there are
NO errors, the request is redirected. Otherwise, the view for that URL
is rendered as requested, only this time displaying validation
errors..

OT FYI: You can use any HTML element with id="foo"; there's no need to
use an A tag (I believe that that use of A is deprecated in HTML5).


On Mar 19, 11:45 pm, Johnny Ferguson  wrote:
> Hi,
>
> I've successfully set up a contact form in cakePHP, and when
> validation rules in my model don't pass, the form is reloaded with all
> my validation errors displayed properly. That battle was won :)
>
> Now for the tricky part.
>
> Can anyone think of a way to not only have the form page reload with
> error messages, but jump to an anchor link at the top of the form if
> errors are present? I'm sure I could use javascript for this, but as
> it stands I can't count on users having javascript enabled. Currently
> when the form reloads with error messages in place, users have to
> scroll down from the top of the page, and I see this as a slight
> problem.
>
> Obviously CakePHP is smart enough to redirect to an appropriate URL
> when validation fails, all I need to do is add #myAnchor to the end of
> that URL somehow. Any ideas?
>
> I've thought of adding a line to my beforeFilter that says something
> like
>
> 1. if we're visiting the form page
> 2. and if some error flag variable is set
> 3. catch the URL somehow
> 4. Add the anchor to the end
>
> But I'm not sure on the specifics of how I'd go about this, and as
> this filter would run before the any page in the controller runs, I
> have concerns about efficiency. Any ideas?
>
> Thanks in advance for your input.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Creating a simple search form

2010-03-20 Thread Jeremy Burns
The variable is being destroyed when you redirect. I would change the action to 
one that finds the data (in your example this is process). Check for 
$this->data. If it's empty there are no search criteria so redirect to your 
search page. If it's not empty, do your find and put the results into a 
variable ($results?). Then have a view called process.ctp (at this point, 
having a function and view called process sounds wrong - 'results' sounds more 
intuitive?). In the view, you can pick up your $results and display them.

Jeremy Burns
jeremybu...@me.com


On 20 Mar 2010, at 12:32, aveev wrote:

> 
> Hi, I'm new in using cakephp
> I'm trying to create a simple search form for user table (namely
> people),where I input the id, and then a page displaying the result will
> show up...Here's I've come up with:
> 
> CREATE TABLE  `people` (
>  `id` int(10) unsigned NOT NULL auto_increment,
>  `name` varchar(30) NOT NULL,
>  `pob` varchar(25) default NULL,
>  PRIMARY KEY  (`id`)
> )
> in search.ctp
>echo $form->create('Person', array('action'=>'search'));
>   echo $form->input('id', array('type'=>'text'));
>   echo $form->end('Save');
> 
> ?>
> 
> in people_controller.php
> function search() {
>   if(!empty($this->data)) {
>   $data =
> $this->Person->find('all',array('conditions'=>array('id'=>$this->data['Person']['id'])));
>   $this->set('res',$data);
>   
> $this->redirect(array('controller'=>'people','action'=>'process'));
>   }
>   }
> 
> function process() {}
> 
> in process.ctp
>echo $res;
> ?>
> when I key in the id in search.ctp and hit save button, the error message
> displays :
> Notice (8): Undefined variable: res [APP\views\persons\process.ctp, line 5]
> 
> In search function I set the query result to a variable named res, and
> redirect to another controller action, which is process..From what I've read
> in the manual, putting set method is the way we pass data to the view so I
> think it should be ok, but the res variable is not recognized in process.ctp
> view...
> Any help would be greatly appreciated...
> Thanks in advance...
> 
> -- 
> View this message in context: 
> http://old.nabble.com/Creating-a-simple-search-form-tp27954861p27954861.html
> Sent from the CakePHP mailing list archive at Nabble.com.
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
> 
> To unsubscribe from this group, send email to 
> cake-php+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Creating a simple search form

2010-03-20 Thread aveev

Hi, I'm new in using cakephp
I'm trying to create a simple search form for user table (namely
people),where I input the id, and then a page displaying the result will
show up...Here's I've come up with:

CREATE TABLE  `people` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(30) NOT NULL,
  `pob` varchar(25) default NULL,
  PRIMARY KEY  (`id`)
)
in search.ctp
create('Person', array('action'=>'search'));
echo $form->input('id', array('type'=>'text'));
echo $form->end('Save');

?>

in people_controller.php
function search() {
if(!empty($this->data)) {
$data =
$this->Person->find('all',array('conditions'=>array('id'=>$this->data['Person']['id'])));
$this->set('res',$data);

$this->redirect(array('controller'=>'people','action'=>'process'));
}
}

function process() {}

in process.ctp

when I key in the id in search.ctp and hit save button, the error message
displays :
Notice (8): Undefined variable: res [APP\views\persons\process.ctp, line 5]

In search function I set the query result to a variable named res, and
redirect to another controller action, which is process..From what I've read
in the manual, putting set method is the way we pass data to the view so I
think it should be ok, but the res variable is not recognized in process.ctp
view...
Any help would be greatly appreciated...
Thanks in advance...

-- 
View this message in context: 
http://old.nabble.com/Creating-a-simple-search-form-tp27954861p27954861.html
Sent from the CakePHP mailing list archive at Nabble.com.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: cache is messing up cookies and session???

2010-03-20 Thread leafchild book
this is reproducible by everybody

i have to refresh page to get right cookie information.

how can I get right cookie information without refreshing?



On Sat, Mar 20, 2010 at 12:57 AM, John Andersen wrote:

> I would think that this is an issue with the browser cache!
> Enjoy,
>   John
>
> On Mar 20, 1:05 am, leafchild book  wrote:
> > I said cache is messing up but not 100% sure but it's obvious that
> > cookie's info is not update unless page is refreshed
> >
> > How can I get right cookie info without refreshing page after user update
> > shopping cart or their billing info.
> >
> [snip]
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
> To unsubscribe from this group, send email to cake-php+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Sort with random order

2010-03-20 Thread Jon Bennett
> if ($this->params['named']['sort'] === 'RAND()') { // or any sting you
> choose
>  $this->pagainte['sort'] = 'RAND()';
> }
>
> But unless you've got only 1 page of results I doubt that's really
> what you want (hint - click sort*, click page 2, click page 1*. * they
> won't be the same and more importantly there will be results you may
> be unable to find or find repeatedly - on page 1, page 2, page 3 etc.)

Yep - each page would be different, rather than the whole set
randomised. A better bet would be to randomly sort a list of ids for
the entire table, then custom paginate that.

You could store this random array of ids in the session, or perhaps
cache the list of ids with a random string which is appended to the
url.

Otherwise, don't paginate and you'll be fine.

hth

J

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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Sort with random order

2010-03-20 Thread AD7six


On 20 mar, 01:04, Onkel Judith  wrote:
> *push* :/

if ($this->params['named']['sort'] === 'RAND()') { // or any sting you
choose
  $this->pagainte['sort'] = 'RAND()';
}

But unless you've got only 1 page of results I doubt that's really
what you want (hint - click sort*, click page 2, click page 1*. * they
won't be the same and more importantly there will be results you may
be unable to find or find repeatedly - on page 1, page 2, page 3 etc.)

hth

AD

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Complex form with fields belonging to fields that belong to the top table

2010-03-20 Thread WebbedIT
I regularly stare at a problem so long that I become code blind and
miss the most obvious things.  Just make sure you remember for next
time, and there will be a a next time :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: cache is messing up cookies and session???

2010-03-20 Thread John Andersen
I would think that this is an issue with the browser cache!
Enjoy,
   John

On Mar 20, 1:05 am, leafchild book  wrote:
> I said cache is messing up but not 100% sure but it's obvious that
> cookie's info is not update unless page is refreshed
>
> How can I get right cookie info without refreshing page after user update
> shopping cart or their billing info.
>
[snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Bake Screencast not Working?

2010-03-20 Thread Johnny Ferguson
I got this same problem, and after viewing the file directly, I am
extremely disappointed that I had to go through the hassle of filling
my comp with garbage like QuickTime just to have some guy show me how
to update my PATH variable. *facepalm*

Why this isn't on a youtube video is beyond me.

On Mar 12, 4:33 pm, mailman  wrote:
> Hey all. Thehttp://cakephp.org/screencasts/view/6isn't working in
> any of my browsers.
>
> Anyone have a good tute on how to set up bake on Vista (I know...sorry
> Vista haters). ;)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.