cakephp route,

2011-05-04 Thread sindhu.13
helo, i'm newbie in cakephp...
my problem is,
I want to view my news in view.ctp base on "title" not "id",
so if by id -> "newsses/view/3" if id is 3
but i want make like -> "newsses/view/news_title" if title is "News
Title"

so how do i make it.?.
route, controller and view action

thank's

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


HTML helper (Meta Icon) duplicating unnecessarily?

2011-05-04 Thread Ross
Hi

I just got started with CakePHP, and have the following in  my layout,
between the  tags's as you'd expect:

Html->meta('icon') . "\t\n";   ?>

The output, however is:


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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


David Persson's Media Plugin

2011-05-04 Thread Stefan Schlesinger
Hello Folks,

I'm working on my first project with cakephp and I ran into an issue
when trying to
implement file uploads:

1) I'm trying to use the media plugin for my application. I'm having
problems to apply
the polymorphic behavior to the model. Here are my models and the
controller:

models/attachment.php: http://pastie.org/private/qjofpjluwaxsgr4t99jw
models/artist.php: http://pastie.org/private/oqhz5isx4npxdo1b0olvew
controllers/artists_contoller.php:
http://pastie.org/private/x1u10dbgc9awwpxhulqcw

When I upload a new file, its saved correctly into the attachments
table, but without
the foreign_key or the model fields being set.

2) I tried as well to manually add this fields by extending $this-
>data in my controller,
but I end up with a broken string in my database.

Here is the controller with the manually specified model and
foreign_key:

http://pastie.org/private/wrgxo9sdspar3sdxgrpyyq

and the field if its read by the Artist view:

http://666kb.com/i/bt7evphoib2ca2m6y.gif


Regards, Stefan.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


PHP Newbie

2011-05-04 Thread Chathu
hi!,
I'm new to php and final year IT student.we are developing Hospital
management system.Can i do full system using Cakephp? and also if any
problem happen theres a support team ?

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cake dispatcher is synchronous?

2011-05-04 Thread mark_story
PHP is synchronous by nature.  If you _need_ an asynchronous
framework, you might want to look at something in nodejs land.
Express is a decent framework there.

Another option is to change how your session handling works, either by
not using sessions or not using file based session storage.   Most
people opt for database session storage which usually solves a few
different problems at once.

-Mark


On May 4, 10:06 am, ojonam  wrote:
> Hello all,
>
> I was doing a little experiment when I found a curious behavior. Here is the
> setup:
>
> I have a view bookprices.ctp, which shows a list of books (12 books), and
> for each of these books, fires an ajax call to "books/getprice" (controller
> books, action getprice), in order to get the price of the book. While the
> prices are not loaded, I have a little "loading" gif show up instead of the
> price. The ajax call is done by calling a "getPrice" javascript function,
> which is coded in the bookprices.ctp file, and uses prototype.js.
>
> Testing with Firebug, I noticed that all calls to getPrice are fired at the
> same time, which is expected behaviour. However, the results arrive
> *sequentially*. Only after getting the price of the first book is it
> possible to query the "books/getprice" url again.
> Doing the same test without cakephp, I notice that things happen in
> parallel, which is the desired behaviour (and this is what made me think
> that the problem might be with cake).
>
> My question is therefore:
> - how can I tell cake to handle requests in an asynchronous manner ?
> - if the above is not possible, how do I redesign my files so that I get the
> desired behaviour here?
>
> Thanks,
> ojonam

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


accessing a function in a custom datasource, from the model

2011-05-04 Thread flowctrl
Hello,

In CakePHP 1.3, how do I use a function in a custom datasource, from a
model that uses that datasource?

My custom datasource works for regular queries, but I want to extend
the default "find" method to include a new parameter. In app/models/
datasources/foofiles_source.php I have a function to find video files
on the filesystem. For testing, it is:

class FoofilesSource extends DataSource {

   public function find_videos($videoQuery) {
 return(array("This is in the foo_files datasource!",
"w00t!"));
   }
…


In the FooFiles model, I have:

   function find($type, $options = array()) {
  switch($type) {
 case "videos":
$this->find_videos($options);
break;

 default:
return parent::find($type, $options);
break;
  }
   }

However, $this->find_videos($options) produces a fatal error:
Fatal error: Call to undefined method FoofilesSource::query() in cake/
libs/model/model.php on line 502

If I use FoofilesSource::find_videos($options) instead, I get the
error:
Fatal error: Class 'FooFilesSource' not found in app/models/
foo_files.php on line 11

How do I invoke a function in the datasource, from a model?

Thanks!

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Custom datasource ignored

2011-05-04 Thread flowctrl
Thanks! That was it.

On Apr 30, 7:51 am, Tilen Majerle  wrote:
> cakephp is still looking for database, because you wrong type model
> property...it's $useTable not $useTables :) (so letter S at the end is
> problem ) :)
> --
> Lep pozdrav, Tilen Majerlehttp://majerle.eu
>
> 2011/4/30 flowctrl 
>
>
>
> > Hello,
>
> > CakePHP seems to be ignoring the $useDbConfig variable in my model.
> > I'm trying to use a custom datasource, but I'm getting the error:
>
> > Database table foo_files for model FooFiles was not found.
>
> > When I first loaded the model and new datasource, there were typos in
> > the datasource file which caused errors, so I know that the datasource
> > file is actually being loaded. Why is CakePHP still looking for a
> > database table?
>
> > My model, app/models/foo_files.php, contains:
>
> > class FooFiles extends AppModel {
> >        var $name = 'FooFiles';
> >        var $useTables      = false;
> >        var $useDbConfig = 'foofiles';
> > }
>
> > The app/config/database.php file has:
>
> >        var $foofiles = array(
> >                'datasource' => 'foofiles',
> >                'workshopsdir' => '/some/dir',
> >        );
>
> > My new datasource, app/models/datasources/myfiles_source.php, contains
> > (summarized):
>
> > class FoofilesSource extends DataSource {
>
> >  protected $_schema = array(
> >        'files' => array( ... )
> >  );
>
> >  public function listSources() {
> >    return array('files');
> >  }
>
> >  public function describe($model) {
> >    return $this->_schema['files'];
> >  }
>
> >  public function read($model, $queryData = array()) {
> >        $workshopsDir = $config['workshopsdir'];
> >        if(!isset($queryData['conditions'])) $queryData['conditions'] =
> > 'all';
>
> >      $events = array();
> >        switch ($queryData['conditions']) {
> >                default:
> >                return(glob("$workshopsDir/*"));
> >                break;
>
> >                case $array[] = 'videos':
> >                        ...
> >                }
> >  }
>
> > Any advice would be appreciated!
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > 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

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Two in one: Accented letters and partially active debug

2011-05-04 Thread euromark
1) @ryan: the other way around. encoding of the DB is probably wrong
(not utf8)

2) globally: debug 0 - in this particular action:
Configure::write('debug', 2);



On 5 Mai, 00:02, Ryan Schmidt  wrote:
> On May 4, 2011, at 16:55, Mariano C. wrote:
>
> > 1) when I insert data inside DB through a form, it will be stored as:
> > "This letters è is è and this l’ is an apostrophe "
>
> > If I try to edit this text trough proper editing form, all of this
> > strange characters will be represented in right way as: è and '.
> > What can I do to proper echo the text even not in HTML form?
>
> Hard to know exactly what's happening without more info. One possibility is 
> that the data is being stored correctly as UTF-8, but then when you are 
> displaying it, you're on a page with encoding ISO-8859-1; the solution would 
> be to ensure your pages are using UTF-8 encoding.
>
> > 2) There's a way to active debug just in one method? How?
>
> What is "active debug"? What exactly are you trying to do?

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Two in one: Accented letters and partially active debug

2011-05-04 Thread Ryan Schmidt

On May 4, 2011, at 16:55, Mariano C. wrote:

> 1) when I insert data inside DB through a form, it will be stored as:
> "This letters è is è and this l’ is an apostrophe "
> 
> If I try to edit this text trough proper editing form, all of this
> strange characters will be represented in right way as: è and '.
> What can I do to proper echo the text even not in HTML form?

Hard to know exactly what's happening without more info. One possibility is 
that the data is being stored correctly as UTF-8, but then when you are 
displaying it, you're on a page with encoding ISO-8859-1; the solution would be 
to ensure your pages are using UTF-8 encoding.


> 2) There's a way to active debug just in one method? How?

What is "active debug"? What exactly are you trying to do?


-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Two in one: Accented letters and partially active debug

2011-05-04 Thread Mariano C.
1) when I insert data inside DB through a form, it will be stored as:
"This letters è is è and this l’ is an apostrophe "

If I try to edit this text trough proper editing form, all of this
strange characters will be represented in right way as: è and '.
What can I do to proper echo the text even not in HTML form?

2) There's a way to active debug just in one method? How?

Regards

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


ACL issue

2011-05-04 Thread Felix
Hello everyone,

I have a query regarding how to structure the ACL system in my app.

Basically i'm creating a management app for a diving club. The club
has three broad groups,

- Instructors
- Trainees
- Committee

The ACL tree looks like this at the moment

- Sebastian (name of site)
 Overlord (a master account)
- Committee
- President
- Treasurer
- etc.
- Instructors
- Practical
- Theory
- Trainees

Each position above is a group (name, description) which have many to
one relationships with a user (username, password, name).

The above system works fine except for one problem. Committee members
are always either an instructor or trainee, therefore they need to be
assigned to two groups (instructor/trainee AND the relevant committee
position).

Basically I need to place a user into two levels in the tree which
aren't related to each other hierarchically.

As far as I know this isn't possible with Cake's ACL component unless
theres something I've missed. I know the relationship between groups
-- users needs changing to a HABTM relationship but I'm unsure how ACL
treats these.

Has anyone come across this sort of problem before and able to outline
their solution, or have I been an idiot and missed something really
obvious.

Sorry for such a long message, I didn't want to miss anything out -
thanks in advance,

--Felix Fennell

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cake dispatcher is synchronous?

2011-05-04 Thread Ryan Schmidt
On May 4, 2011, at 09:06, ojonam wrote:

> I have a view bookprices.ctp, which shows a list of books (12 books), and for 
> each of these books, fires an ajax call to "books/getprice" (controller 
> books, action getprice), in order to get the price of the book. While the 
> prices are not loaded, I have a little "loading" gif show up instead of the 
> price. The ajax call is done by calling a "getPrice" javascript function, 
> which is coded in the bookprices.ctp file, and uses prototype.js.
> 
> Testing with Firebug, I noticed that all calls to getPrice are fired at the 
> same time, which is expected behaviour. However, the results arrive 
> *sequentially*. Only after getting the price of the first book is it possible 
> to query the "books/getprice" url again.
> Doing the same test without cakephp, I notice that things happen in parallel, 
> which is the desired behaviour (and this is what made me think that the 
> problem might be with cake).
> 
> My question is therefore:
> - how can I tell cake to handle requests in an asynchronous manner ?
> - if the above is not possible, how do I redesign my files so that I get the 
> desired behaviour here?

You've discovered a feature of PHP; this is not specific to CakePHP.

Only one request can use the session at once. (And CakePHP does like to use the 
session.)

If you are certain your requests do not need to use the session, tell PHP not 
to open the session in the first place. Or if you can get any required info out 
of the session up front and then close the session while you do your database 
queries for the results (if you're sure you don't need to write anything to the 
session later), then you can tell PHP to close the session early, instead of 
waiting for PHP to close it for you at the end of the request, and thus allow 
the next request to start more quickly.

http://www.thedeveloperday.com/anti-asynchronous-ajax-calls-and-php-sessions/



-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Help! CakePHP runs great in localhost but doesn't even shows up in remote Server ...

2011-05-04 Thread Roger
/**
 * To configure CakePHP *not* to use mod_rewrite and to
 * use CakePHP pretty URLs, remove these .htaccess
 * files:
 *
 * /.htaccess
 * /app/.htaccess
 * /app/webroot/.htaccess
 *
 * And uncomment the App.baseUrl below:
 */
Configure::write('App.baseUrl', env('SCRIPT_NAME'));

And use: http://myhost.com/index.php/mycontroller/action

On Apr 24, 12:55 pm, kabeerdarocker  wrote:
>  I am quite new to Cakephp, just set up doing some of my college
> projects and demonstrating in a local computer. Now, I want to be
> professional and I just have no idea of what should I be doing to go
> live. I am in deep trouble. Please help me with this. Please provide
> me a basic procedure to go cakephp live.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Custom Find sending back strange results

2011-05-04 Thread bradmaxs
Thank you for your reply.  It worked to pull the comments but is now
pulling all the comments and not just that certain show although it
seems to be doing it with the right conditions.

Same controller setup as above.

Show Model:

public function _findComments($state, $query, $results=array()) {
if ($state == "before") {
$query = $this->__getComments($query['id'], $query['model'],
$query);
return $query;
} else {
return $results;
}
}

private function __getComments($id, $model, $query) {
$query['contain'] = array(
'Comment'=> array(
'User'  => array('fields' => array('id', 'username',
'slug'),
'Image'  => array('fields' => 
array('name'))
),
'conditions' => array(
'Comment.typeID' => 2,
'Comment.model' => 'Show'
),
'limit'=> 5,
'order'=> 'created desc'
)
);
return $query;
}

Here is the SQL dump.

The first one is what I need.  See the conditions.

SELECT `Comment`.`id`, `Comment`.`parent_id`, `Comment`.`user_id`,
`Comment`.`typeID`, `Comment`.`model`, `Comment`.`comment`,
`Comment`.`created`, `Comment`.`modified` FROM `comments` AS `Comment`
WHERE `Comment`.`typeID` = (2) AND `Comment`.`model` = 'Show' ORDER BY
`created` desc LIMIT 5

This one is not what I need.  The conditions don't match the find
conditions.

SELECT `Comment`.`id`, `Comment`.`parent_id`, `Comment`.`user_id`,
`Comment`.`typeID`, `Comment`.`model`, `Comment`.`comment`,
`Comment`.`created`, `Comment`.`modified` FROM `comments` AS `Comment`
WHERE `Comment`.`typeID` = (3) AND `Comment`.`model` = 'Show' ORDER BY
`created` desc LIMIT 5

Thank you again.

Brad


On Apr 30, 11:32 am, stas kim
 wrote:
> i can tell where the errors come from
> in you __getComments you overwrite $query with actual dataset returned
> by Comment->find which is wrong
> because the $query var is passed to Model->find and it gets confused
> with your data
>
> what you need to do is build a proper contain
> $query['contain'] = array(
>    'Comment'=> array(
>         'User'=>array(),
>         'limit'=> 
>         'order'=> 'field name desc'
>    )
> )
> return $query
>
> That way you will get your Shows paginated containing comments->userinfo
>
>
>
> On Thu, Apr 28, 2011 at 9:07 PM,bradmaxs wrote:
> > All I want to do is have one find for my comments in each associated
> > model.  I would love to do this in the Comment model and only have to
> > do it once but that wasn't working out.
>
> > SHOW CONTROLLER
>
> > $this->paginate = array('comments', 'id' => $show['Show']['id'],
> > 'model' => 'Show');
> > $comments = $this->paginate();
> > $this->set(compact('show', 'comments'));
>
> > SHOW MODEL
>
> > public $_findMethods = array('comments' => true);
>
> >    public function _findComments($state, $query, $results=array()) {
> >        if ($state == "before") {
> >                $query = $this->__getComments($query['id'], $query['model'],
> > $query);
> >            return $query;
> >        } else {
> >            return $results;
> >        }
> >    }
>
> >    private function __getComments($id, $model, $query) {
> >        $query = ClassRegistry::init('Comment')->find('all', array(
> >                        'contain' => array(
> >                                'User'  => array(
> >                                        'fields' => array('id', 'username', 
> > 'slug'),
> >                                        'Image'  => array(
> >                                                'fields' => array('name')
> >                                        )
> >                                )
> >                        ),
> >                        'conditions' => array(
> >                                'Comment.typeID' => $id,
> >                                'Comment.model' => $model
> >                        ),
> >                        'limit' => 5,
> >                        'order' =>  array('Comment.created' => 'desc')
> >                ));
> >                return $query;
> >        }
>
> > RESULTS
>
> > This is the one I want:
>
> > SELECT `Comment`.`id`, `Comment`.`parent_id`, `Comment`.`user_id`,
> > `Comment`.`typeID`, `Comment`.`model`, `Comment`.`comment`,
> > `Comment`.`created`, `Comment`.`modified`, `User`.`id`,
> > `User`.`username`, `User`.`slug` FROM `comments` AS `Comment` LEFT
> > JOIN `users` AS `User` ON (`Comment`.`user_id` = `User`.`id`) WHERE
> > `Comment`.`typeID` = 2 AND `Comment`.`model` = 'Show' ORDER BY
> > `Comment`.`created` desc LIMIT 5
>
> > This is also on the sql log and it seems to be the one the view is
> > using:
>
> > SELECT `Comment`.`id`, `Comment`.`par

Containable make query data already retrieved

2011-05-04 Thread jmn2k1
Hi,

I need to make some report of my multiple associations, I tried with
containable and was surprised as it resolve to bring all the data with
the proper joins, however still do multiple queries for a model that
is already joined.

$params = array(
'fields' => array(
'id', 'student_id', 'course_id',
'registration_status_id',
'registration_course_status_id', 'progress'
),
'contain' => array(
'Course' => array(
'fields' => array('id', 'title')
),
'Student' => array(
'fields' => array('id', 'firstname', 'lastname'),
'City',
'Country'
),
'CourseTracking' => array(
'fields' => array('started', 'finished')
)
),
'conditions' => array(

),
'order' => array('Student.lastname')
);
$this->Course->Registration->find('all', $params);

I have the Registration model which is a link table between Course and
Student, and the generated query is:

SELECT `Registration`.`id`, `Registration`.`student_id`,
`Registration`.`course_id`, `Registration`.`registration_status_id`,
`Registration`.`registration_course_status_id`,
`Registration`.`progress`, `CourseTracking`.`started`,
`CourseTracking`.`finished`, `Course`.`id`, `Course`.`title`,
`Student`.`id`, `Student`.`firstname`, `Student`.`lastname`,
`Student`.`country_id`, `Student`.`city_id` FROM `registrations` AS
`Registration` LEFT JOIN `courses` AS `Course` ON
(`Registration`.`course_id` = `Course`.`id`) LEFT JOIN `students` AS
`Student` ON (`Registration`.`student_id` = `Student`.`id`) LEFT JOIN
`course_trackings` AS `CourseTracking` ON
(`CourseTracking`.`registration_id` = `Registration`.`id`) WHERE
course_id IN (1, 2) ORDER BY `Student`.`lastname` ASC

Which have all the required data, however the sql dump show me one of
the following queries for every registration:

SELECT `Course`.`id`, `Course`.`title` FROM `courses` AS `Course`
WHERE `Course`.`id` = 2

The strange part is that Course and Student are associated exactly in
the same way. Any hint on how to get rid of those queries?

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Set::extract on an array containing one element

2011-05-04 Thread Gluckens
This lead me to another question.

Is it possible to do a combine with default numeric key (0, 1, 2)

I was doing something like this :
$combine = Set::combine($result, '{n}.Data1.id', '{n}',
'{n}.Data2.name');
which return
Array
(
[name1] => Array
(
[4] => Array
(
[some data] => some value
)
[12] => Array
(
[some data] => some value
)
)
)

But i'll like to get default numeric key instead of {n}.Data1.id
Something like :
Array
(
[name1] => Array
(
[0] => Array
(
[some data] => some values
)
[1] => Array
(
[some data] => some values
)
)
)

I know that at this point I could simply do a foreach, but it could be
useful to know.
Thanks in advance.

On 4 mai, 10:46, Gluckens  wrote:
> Really?
>
> I was doing an extract on a previous combine which put the ID as the
> numeric key.
> But, switching it with a 0 and now everything seems to work.
>
> Still, it's strange that when I add another element with random key,
> it's now working.
>
> Anyway, I'll find an alternative for my ids.
>
> Thanks for the reply.
>
> On 4 mai, 08:01, "Dr. Loboto"  wrote:
>
>
>
>
>
>
>
> > Set::extract("/Some/thing", $data) assumes that you have true list -
> > array with numeric keys 0, 1, 2, ... - but not an associative array
> > with keys "some", "thing", ... or 4, 2, 15, ...
>
> > If you call it as Set::extract("/Some/thing", array_values($data))
> > when $data is associative array it will pass.
>
> > On 3 май, 16:21, Gluckens  wrote:
>
> > > Of course I know how to do it whithout the extract method.
>
> > > The point is, if the extract is not always working, it's not really
> > > usable cause you never know when it will break your things
>
> > > Someone points me to this ticket which could be 
> > > relatedhttp://cakephp.lighthouseapp.com/projects/42648/tickets/104-testpatch...
>
> > > But anyway, this fix would probably not be coming soon
>
> > > Seems like I'll need to rewrite large parts of code... ugh
>
> > > On 2 mai, 19:51, Otavio Martins Salomao 
> > > wrote:
>
> > > > u try this!
> > > > foreach($test as $element)
> > > >      $result = $element['Deep1']['Deep2']['extract'];
>
> > > > 2011/5/2 Gluckens 
>
> > > > > Hi everyone,
>
> > > > > I'm trying to extract data from an array containing only one element
> > > > > and it doesn't seem to work properly.
> > > > > Here's an example :
>
> > > > > Starting array
> > > > > $test = array(4 => array('Deep1' => array('data1' => 'nothing',
> > > > > 'Deep2' => array('extract' => 1;
> > > > > Array
> > > > > (
> > > > >    [4] => Array
> > > > >        (
> > > > >            [Deep1] => Array
> > > > >                (
> > > > >                    [data1] => nothing
> > > > >                    [Deep2] => Array
> > > > >                        (
> > > > >                            [extract] => 1
> > > > >                        )
> > > > >                )
> > > > >        )
> > > > > )
>
> > > > > Set::extract('/Deep1/Deep2[extract=1]', $test);
> > > > > NOT CORRECT
> > > > > Array
> > > > > (
> > > > > )
>
> > > > > But, when I add another element, let's say
> > > > > $test[12] = array();
> > > > > It works fine
> > > > > Set::extract('/Deep1/Deep2[extract=1]', $test);
> > > > > CORRECT
> > > > > Array
> > > > > (
> > > > >    [0] => Array
> > > > >        (
> > > > >            [Deep2] => Array
> > > > >                (
> > > > >                    [extract] => 1
> > > > >                )
> > > > >        )
> > > > > )
>
> > > > > Am I using it properly?
> > > > > Thanks in advance for any help.
>
> > > > > --
> > > > > Our newest site for the community: CakePHP Video Tutorials
> > > > >http://tv.cakephp.org
> > > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > > others with their CakePHP related questions.
>
> > > > > 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

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Help! CakePHP runs great in localhost but doesn't even shows up in remote Server ...

2011-05-04 Thread mikek
> did anybody open a ticket for that yet?
> why it is not ROOT by default? because that would make sense after
> all :)

but it is..

from a fresh 1.3.7

if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', ROOT);
}

not sure why yours isnt.


>
>
> On 4 Mai, 15:25, jjw  wrote:
>> I've had this problem before. Look at webroot/index.php and look for a
>> path to your local installation, something like:
>>
>> define('CAKE_CORE_INCLUDE_PATH', 'C:' . DS . 'wamp' . DS . 'www' .
>> DS . 'myapp');
>>
>> I have to replace it with:
>>
>> define('CAKE_CORE_INCLUDE_PATH', ROOT .'');
>>
>> When I bake the project, it puts this path in there that is hard coded
>> for my localhost.
>
> --
> 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+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>
>


-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


[CakePHP 1.3.8, TranslateBehavior, DboPostgres] Invalid result set

2011-05-04 Thread Robert
Hello,
I just have moved my project on CakePHP 1.3.8 from MySQL to PostgreSQL
8.3 and then Translate stopped working correctly.

Instead of:

[0] => Array
(
[Category] => Array
(
[id] => 3
[parent_id] =>
[lft] => 1
[rght] => 2
[locale] => pol
[name] => Start
[description] => Tutaj opis
)
   ...

I have received:

[0] => Array
(
[Category] => Array
(
[id] => 3
[parent_id] =>
[lft] => 1
[rght] => 2
[locale] => pol
[name] =>
[description] =>
)

[I18n] => Array
(
[name] => Start
[description] => Tutaj opis
)
...

SQL code generated by Cake:

SELECT
   "Category"."id" AS "Category__id",
   "Category"."parent_id" AS "Category__parent_id",
   "Category"."lft" AS "Category__lft",
   "Category"."rght" AS "Category__rght",
   "I18n__name"."content" AS "I18n__name__content",
   "I18n__description"."content" AS "I18n__description__content"
FROM "cms_categories" AS "Category"
LEFT JOIN "i18n" AS "I18n__name"
   ON ("Category"."id" = "I18n__name"."foreign_key"
  AND "I18n__name"."model" = 'Category'
  AND "I18n__name"."field" = 'name')
LEFT JOIN "i18n" AS "I18n__description"
   ON ("Category"."id" = "I18n__description"."foreign_key"
  AND "I18n__description"."model" = 'Category'
  AND "I18n__description"."field" = 'description')
WHERE "I18n__name"."locale" = 'pol'
   AND "I18n__description"."locale" = 'pol'
ORDER BY "Category"."lft" ASC

After some debug work I found reason in method
DboPostgres::resultSet(). Name of the column for "description" field
translation is "I18n__description__content". DboPostgres::resultSet()
method incorrectly parses table name and field name from this string
as "I18n" and "description" instead of "I18n__description" and
"content". In the end, method creates invalid result array and
TranslateBehavior does not detect the translation.

Code:
...
if (strpos($columnName, '__')) {
   $parts = explode('__', $columnName);
   $this->map[$index++] = array($parts[0], $parts[1]);
} ...

I propose the following solution:
...
$pos = strrpos($columnName, '__');
if ($pos !== false) {
   $table_name = substr($columnName, 0, $pos);
   $column_name = substr($columnName, $pos+2, strlen($columnName));
   $this->map[$index++] = array($table_name, $column_name);
} ...

Solution is to split $columnName at the last occurrence of __
separator, not every like in original code.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


jQuery File Upload in cakePHP

2011-05-04 Thread eduSchults
Hello there.

I think you may know  http://plugins.jquery.com/project/jQuery-File-Upload
jQuery File Upload , it's a jQuery plugin that allows you to upload multiple
files, and it's very easy to implement in a "Pure PHP" Website.

But I'm newbie in CakePHP, and I've no idea about how to implement it.

I appreciate any help.

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/jQuery-File-Upload-in-cakePHP-tp4370017p4370017.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Help! CakePHP runs great in localhost but doesn't even shows up in remote Server ...

2011-05-04 Thread euromark
did anybody open a ticket for that yet?
why it is not ROOT by default? because that would make sense after
all :)


On 4 Mai, 15:25, jjw  wrote:
> I've had this problem before. Look at webroot/index.php and look for a
> path to your local installation, something like:
>
> define('CAKE_CORE_INCLUDE_PATH', 'C:' . DS . 'wamp' . DS . 'www' .
> DS . 'myapp');
>
> I have to replace it with:
>
> define('CAKE_CORE_INCLUDE_PATH', ROOT .'');
>
> When I bake the project, it puts this path in there that is hard coded
> for my localhost.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Set::extract on an array containing one element

2011-05-04 Thread Gluckens
Really?

I was doing an extract on a previous combine which put the ID as the
numeric key.
But, switching it with a 0 and now everything seems to work.

Still, it's strange that when I add another element with random key,
it's now working.

Anyway, I'll find an alternative for my ids.

Thanks for the reply.



On 4 mai, 08:01, "Dr. Loboto"  wrote:
> Set::extract("/Some/thing", $data) assumes that you have true list -
> array with numeric keys 0, 1, 2, ... - but not an associative array
> with keys "some", "thing", ... or 4, 2, 15, ...
>
> If you call it as Set::extract("/Some/thing", array_values($data))
> when $data is associative array it will pass.
>
> On 3 май, 16:21, Gluckens  wrote:
>
>
>
>
>
>
>
> > Of course I know how to do it whithout the extract method.
>
> > The point is, if the extract is not always working, it's not really
> > usable cause you never know when it will break your things
>
> > Someone points me to this ticket which could be 
> > relatedhttp://cakephp.lighthouseapp.com/projects/42648/tickets/104-testpatch...
>
> > But anyway, this fix would probably not be coming soon
>
> > Seems like I'll need to rewrite large parts of code... ugh
>
> > On 2 mai, 19:51, Otavio Martins Salomao 
> > wrote:
>
> > > u try this!
> > > foreach($test as $element)
> > >      $result = $element['Deep1']['Deep2']['extract'];
>
> > > 2011/5/2 Gluckens 
>
> > > > Hi everyone,
>
> > > > I'm trying to extract data from an array containing only one element
> > > > and it doesn't seem to work properly.
> > > > Here's an example :
>
> > > > Starting array
> > > > $test = array(4 => array('Deep1' => array('data1' => 'nothing',
> > > > 'Deep2' => array('extract' => 1;
> > > > Array
> > > > (
> > > >    [4] => Array
> > > >        (
> > > >            [Deep1] => Array
> > > >                (
> > > >                    [data1] => nothing
> > > >                    [Deep2] => Array
> > > >                        (
> > > >                            [extract] => 1
> > > >                        )
> > > >                )
> > > >        )
> > > > )
>
> > > > Set::extract('/Deep1/Deep2[extract=1]', $test);
> > > > NOT CORRECT
> > > > Array
> > > > (
> > > > )
>
> > > > But, when I add another element, let's say
> > > > $test[12] = array();
> > > > It works fine
> > > > Set::extract('/Deep1/Deep2[extract=1]', $test);
> > > > CORRECT
> > > > Array
> > > > (
> > > >    [0] => Array
> > > >        (
> > > >            [Deep2] => Array
> > > >                (
> > > >                    [extract] => 1
> > > >                )
> > > >        )
> > > > )
>
> > > > Am I using it properly?
> > > > Thanks in advance for any help.
>
> > > > --
> > > > Our newest site for the community: CakePHP Video Tutorials
> > > >http://tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > others with their CakePHP related questions.
>
> > > > 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

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Cake dispatcher is synchronous?

2011-05-04 Thread ojonam
Hello all,

I was doing a little experiment when I found a curious behavior. Here is the 
setup:

I have a view bookprices.ctp, which shows a list of books (12 books), and 
for each of these books, fires an ajax call to "books/getprice" (controller 
books, action getprice), in order to get the price of the book. While the 
prices are not loaded, I have a little "loading" gif show up instead of the 
price. The ajax call is done by calling a "getPrice" javascript function, 
which is coded in the bookprices.ctp file, and uses prototype.js.

Testing with Firebug, I noticed that all calls to getPrice are fired at the 
same time, which is expected behaviour. However, the results arrive 
*sequentially*. Only after getting the price of the first book is it 
possible to query the "books/getprice" url again.
Doing the same test without cakephp, I notice that things happen in 
parallel, which is the desired behaviour (and this is what made me think 
that the problem might be with cake).

My question is therefore:
- how can I tell cake to handle requests in an asynchronous manner ?
- if the above is not possible, how do I redesign my files so that I get the 
desired behaviour here?

Thanks,
ojonam

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Help! CakePHP runs great in localhost but doesn't even shows up in remote Server ...

2011-05-04 Thread jjw
I've had this problem before. Look at webroot/index.php and look for a
path to your local installation, something like:

define('CAKE_CORE_INCLUDE_PATH', 'C:' . DS . 'wamp' . DS . 'www' .
DS . 'myapp');

I have to replace it with:

define('CAKE_CORE_INCLUDE_PATH', ROOT .'');

When I bake the project, it puts this path in there that is hard coded
for my localhost.

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Plugin and missing controller

2011-05-04 Thread Jeremy Burns | Class Outfit
Just to make sure that nothing else in my application was causing problems, I 
have installed the plugin in a bare copy of Cake 1.3.8, and it still comes up 
with the missing controller error. Any clues/guidance/advice?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
(t) +44 (0) 208 123 3822
(m) +44 (0) 7973 481949
Skype: jeremy_burns
http://www.classoutfit.com

On 4 May 2011, at 07:19, Jeremy Burns wrote:

> I have downloaded WebTechNick's PayPal plugin and copied the files
> into /app/plugins/paypal_ipn (exactly as per the instructions). I have
> amended /app/config/routes.php to include the routes for the plugin
> (these are copied straight from the installation instructions). As
> part of debugging this problem I have placed the routes at the top of
> the file. When I access http//:[mysite]/paypal_ipn I am getting a
> missing controller error:
> 
> Error: PaypalIpnController could not be found.
> Error: Create the class PaypalIpnController below in file: app/
> controllers/paypal_ipn_controller.php
> 
> I'm baffled as I have followed conventions yet this isn't working. I
> have other plugins working as expected.
> 
> What am I doing wrong?
> 
> -- 
> 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+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Set::extract on an array containing one element

2011-05-04 Thread Dr. Loboto
Set::extract("/Some/thing", $data) assumes that you have true list -
array with numeric keys 0, 1, 2, ... - but not an associative array
with keys "some", "thing", ... or 4, 2, 15, ...

If you call it as Set::extract("/Some/thing", array_values($data))
when $data is associative array it will pass.

On 3 май, 16:21, Gluckens  wrote:
> Of course I know how to do it whithout the extract method.
>
> The point is, if the extract is not always working, it's not really
> usable cause you never know when it will break your things
>
> Someone points me to this ticket which could be 
> relatedhttp://cakephp.lighthouseapp.com/projects/42648/tickets/104-testpatch...
>
> But anyway, this fix would probably not be coming soon
>
> Seems like I'll need to rewrite large parts of code... ugh
>
> On 2 mai, 19:51, Otavio Martins Salomao 
> wrote:
>
>
>
>
>
>
>
> > u try this!
> > foreach($test as $element)
> >      $result = $element['Deep1']['Deep2']['extract'];
>
> > 2011/5/2 Gluckens 
>
> > > Hi everyone,
>
> > > I'm trying to extract data from an array containing only one element
> > > and it doesn't seem to work properly.
> > > Here's an example :
>
> > > Starting array
> > > $test = array(4 => array('Deep1' => array('data1' => 'nothing',
> > > 'Deep2' => array('extract' => 1;
> > > Array
> > > (
> > >    [4] => Array
> > >        (
> > >            [Deep1] => Array
> > >                (
> > >                    [data1] => nothing
> > >                    [Deep2] => Array
> > >                        (
> > >                            [extract] => 1
> > >                        )
> > >                )
> > >        )
> > > )
>
> > > Set::extract('/Deep1/Deep2[extract=1]', $test);
> > > NOT CORRECT
> > > Array
> > > (
> > > )
>
> > > But, when I add another element, let's say
> > > $test[12] = array();
> > > It works fine
> > > Set::extract('/Deep1/Deep2[extract=1]', $test);
> > > CORRECT
> > > Array
> > > (
> > >    [0] => Array
> > >        (
> > >            [Deep2] => Array
> > >                (
> > >                    [extract] => 1
> > >                )
> > >        )
> > > )
>
> > > Am I using it properly?
> > > Thanks in advance for any help.
>
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > others with their CakePHP related questions.
>
> > > 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

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cake Coding Standards from old trac wiki?

2011-05-04 Thread Simon Males
> The new book nav doesn't seem to give a link to it - but googling the
> title for that page and book yields:
>
> http://book.cakephp.org/view/509/Coding-Standards
>
> AD

Thank you very much, this is what I was searching for.

-- 
Simon Males

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Cake Coding Standards from old trac wiki?

2011-05-04 Thread AD7six


On May 4, 3:08 am, Simon Males  wrote:
> Hi
>
> There was a really good document on the trac wiki, are they archived 
> somewhere?
>
> Cake Coding Standards 
> :https://trac.cakephp.org/wiki/Developement/CodingStandards
>

The new book nav doesn't seem to give a link to it - but googling the
title for that page and book yields:

http://book.cakephp.org/view/509/Coding-Standards

AD

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: how can I set my home page

2011-05-04 Thread Ryan Schmidt

On May 3, 2011, at 17:07, mthabisi mlunjwa wrote:

> I'm trying to set home.ctp as my home page/landing page. But no matter
> how I try I'm redirected to a different page(http://domain.com/
> practitioners/login).

Sounds like you've added the Auth component (possibly to your AppController). 
Is that possible? If so, that's what's asking you to log in here.

http://book.cakephp.org/view/1250/Authentication

If you don't want users to have to log in to see your home page, then you need 
to tell the Auth component that, for example by allowing the display action. 
(This will allow all URLs handled by the Pages controller (not just the home 
page) to be displayed.)

http://book.cakephp.org/view/1656/allowedActions


-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: how can I set my home page

2011-05-04 Thread Tilen Majerle
do u use AuthComponent?
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2011/5/4 mthabisi mlunjwa 

> I'm trying to set home.ctp as my home page/landing page. But no matter
> how I try I'm redirected to a different page(http://domain.com/
> practitioners/login). I'm not sure if  I'm following the correct
> procedure. see below the pagesController and routes.php
> class PagesController extends AppController {
>
>var $name = 'Pages';
>
>var $helpers = array('Html');
>
>var $uses = array();
>
>
>function display() {
>$path = func_get_args();
>
>$count = count($path);
>if (!$count) {
>$this->redirect('/');
>}
>$page = $subpage = $title_for_layout = null;
>
>if (!empty($path[0])) {
>$page = $path[0];
>}
>if (!empty($path[1])) {
>$subpage = $path[1];
>}
>if (!empty($path[$count - 1])) {
>$title_for_layout = Inflector::humanize($path[$count
> - 1]);
>}
>$this->set(compact('page', 'subpage', 'title_for_layout'));
>$this->render(implode('/', $path));
>}
>
>public function home(){
>$this->set('title_for_layout', 'Practitioner's');
>$this->layout = 'home2';
>}
> }
> ?>
>
> Routes.php:
>
>Router::connect('/', array('controller' => 'pages', 'action' =>
> 'display', 'home'));
>Router::connect('/pages/*', array('controller' => 'pages', 'action'
> => 'display'));
>
> --
> 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+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


how can I set my home page

2011-05-04 Thread mthabisi mlunjwa
I'm trying to set home.ctp as my home page/landing page. But no matter
how I try I'm redirected to a different page(http://domain.com/
practitioners/login). I'm not sure if  I'm following the correct
procedure. see below the pagesController and routes.php
class PagesController extends AppController {

var $name = 'Pages';

var $helpers = array('Html');

var $uses = array();


function display() {
$path = func_get_args();

$count = count($path);
if (!$count) {
$this->redirect('/');
}
$page = $subpage = $title_for_layout = null;

if (!empty($path[0])) {
$page = $path[0];
}
if (!empty($path[1])) {
$subpage = $path[1];
}
if (!empty($path[$count - 1])) {
$title_for_layout = Inflector::humanize($path[$count - 
1]);
}
$this->set(compact('page', 'subpage', 'title_for_layout'));
$this->render(implode('/', $path));
}

public function home(){
$this->set('title_for_layout', 'Practitioner's');
$this->layout = 'home2';
}
}
?>

Routes.php:

Router::connect('/', array('controller' => 'pages', 'action' =>
'display', 'home'));
Router::connect('/pages/*', array('controller' => 'pages', 'action'
=> 'display'));

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Haveing a basic understanding problem regarding media views

2011-05-04 Thread heohni
hi,

I have an action to create a txt file and write stuff into.
Then I redirect to another action, where I have a simple template with
a download button.
On click, I would like to download the txt file, the name of the file
I pass within the url to the download function.

function download(){
$this->view = 'Media';
$params = array(
  'id' => $this->params['named']['do'].'.txt',
  'name' => 'example',
  'extension' => 'txt',
  'mimeType' => array('txt' => 'text/plain'),   // extends
internal list of mimeTypes
  'path' => WWW_ROOT.'/DTAfiles/'.$this->params['named']
['do'].'.txt'
   );
   $this->set($params);
}

But I get the message
Not Found
Error: The requested address '/members/download/040520111017' was not
found on this server.

I dont understand why this isn't working, what do I do wrong?

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: $this->Ajax->Form Question to avoid double submit

2011-05-04 Thread heohni
@Taffarel de Lima

yes, this works much better, thanks!!!

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php