Re: really wierd problem

2009-08-24 Thread Martin Westin

I'd say the problem is a grammatical one. (I'm one to talk!)

One Post, Many Posts
One Location, Many Locations
One PieceOfInformation, Many PiecesOfInformation

Information is an odd substantive. It does not really have singular or
plural forms in the normal sense.

At the top of the controller, add:
var $uses = array('Information');

Or try re-naming the controller InformationController. It is just a
guess, but Cake possibly likes Information without any plural form.





On Aug 24, 8:47 pm, Pixelastic  wrote:
> It seems that you are trying to access a class variable from a static
> call. Make sure that you are using an instance of your
> InformationsController and not the class itself.
>
> On Aug 24, 8:16 pm, Paulos23  wrote:
>
>
>
> > Hi people,
> > I am facing a really wierd problem.I am building my app with cake
> > since previous September and for 1st time i can't find any solution.In
> > particular,i am trying to save some data and i am taking this message
> > >
>
> > Notice (8): Undefined property: InformationsController::$Information
> > [APP\controllers\informations_controller.php, line 79]
>
> >         /** saves the input data from user**/
>
> >         $this->Information->saveAll($this->data);
>
> > InformationsController::view() - APP\controllers
> > \informations_controller.php, line 79
> > Object::dispatchMethod() - CORE\cake\libs\object.php, line 117
> > Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227
> > Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194
> > require - APP\webroot\index.php, line 88
> > [main] - CORE\index.php, line 61
>
> > Fatal error: Call to a member function saveAll() on a non-object in C:
> > \Program Files\xampp\htdocs\voyage~voyage-source\app\controllers
> > \informations_controller.php on line 79
>
> > My model is named Information,my controller informations_controller
> > and the table in database is named informations.I use the same way for
> > another model (Location) and everything work fine!
> > Any ideas why this happened to my code?
>
> > Ty in advance!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



New to PHP

2009-08-24 Thread Rakesh P


Hi guys,
Just struck up in the middle of php cross roads. I will list out my
problem any help is much appreciated.

Just recently I started learing php and designed a small dynamic
website using php to keep in my resume with own guest book, admin
privilages, normal users and a shopping cart etc. and now ready for
looking for jobs.

Everytime I search for jobs on php I hear a new term like LAMP/CAKE/
ZEND etc. It really scares and annoys me that some other work is still
pending. If I google up all those terminology looks same but varies in
some properties like linux and rubyon rails imitation & frameworks
etc...and spending most of my time in learning theese conceptes but
not in applying the jobs.

But out of interest could any one please advice me how to learn php
perfectly like which modules should I have to concentrate basically
and what next?

Also could any one please clear this. What is MVC in cake php. After
reading the documentation, I understood that seperating the code
individually into different pieces of code like Business layers in dot
net. Please clarify this.

M really drowning in the pool of confusions. Any help is much
appreciated.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Howto sort forum threads?

2009-08-24 Thread Martin Westin

I have two ideas but I can't be sure which is the best for you.

One way to go is to force joins (or possibly sub-selects) and sort on
the modified field from the replies table. You wouldn't want to or
need to get all the records just the "most recent" one.

Another way to go is to try to make something like counterCache but
instead of updating a count you update a datetime field whenever a new
record is created on existing one edited. So when a new reply is
saved, Reply updates Thread which then updates Forum. You would end up
with updated time-stamps in all your models.

/Martin


On Aug 25, 8:14 am, Braindead  wrote:
> I want to build a forum with CakePHP. The forum actually consists of
> many forums. Each forum hasMany threads. A thread hasMany replies.
> Forums, threads and replies are stored in separate tables. All
> assossiations are setup correctly.
>
> How can I sort threads and replies by date, so that the newest thread
> or the thread with the newest reply comes first.
>
> Thanks,
> Markus
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: sanitize and echoing in html

2009-08-24 Thread ezekfred

hi all,

forget about it:

On Aug 24, 10:18 am, ezekfred  wrote:
> > Vielen danke!
> >
> > I didn't knew this "nl2br"!
> >
> > here is my way to do (with sanitize...)
> >
> >  > App::import('Sanitize');
> >
> > class MyController extends AppController {
> >  function add() {
> >   if (!empty($this->data)) {
> >$this->data = Sanitize::clean($this->data);
> >$this->Mydata->create();
> >
> >  }
> >
> > function edit($id = null) {
> >  if (!empty($this->data)) {
> >   $this->data = Sanitize::clean($this->data);
> >   if ($this->Mydata->save($this->data)) {
> >   
> >   }
> >  }
> >
> > }
> >
> > ?>
> >
> > and in my view template index.ctp
> > 
> >
> > thanks again.
> >
> > On Aug 21, 5:57 pm, "euromark (munich)" 
> > wrote:
> >
>> > > always the same^^
> >
>> > > no sanitizing neccessary
>> > > just use h($var) in the view
> >
>> > > and for textareas
>> > > nl2br(h($var))
> >
>> > > thats all
> >
>> > > On 21 Aug., 16:55, ezekfred  wrote:
> >
>>> > > > Hello,
> >
>>> > > > I'm having some issues with my views.
> >
>>> > > > add.ctp: echo $form->input('theanswer');
>>> > > > view.ctp: echo $data['theanswer'];
> >
>>> > > > in my database theanswer is a TEXT field
> >
>>> > > > I just want to allow people make use of carriage return,
>>> > > > I want to display these CR in view.ctp and index.ctp
>>> > > > but I don't want them to write scripts like alert
>>> > > > ("EXPLETIVES!!!")
> >
>>> > > > I've tried to sanitize::clean the input, to sanitize::html the output
>>> > > > but I'm unable to get an output like that:
>>> > > > "Line1
>>> > > > Line2
>>> > > > "
> >
>>> > > > Has anyone an idea?
> >
>>> > > > thanks for your help!
> >

euromark was right:
no sanitizing necessary: just use h($var) in the view
and for textareas: nl2br(h($var))

I've found my issue: I was using an old version of debug kit...
with the last one (1.1) everything is ok with h($myvars)

Thank you again Mister Euromark.



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Possible, saving null with saveField?

2009-08-24 Thread Martin Westin

I forgot to reply earlier.
Thanks, that worked great.



On Aug 19, 11:02 am, viktor  wrote:
> you could try
> Model->saveField('fieldName', 'NULL');
>
> On Aug 18, 10:00 am, Martin Westin  wrote:
>
>
>
> > Hi,
> > I would prefer to be abel to use saveField for a simple ajax inline-
> > edit functionality. Setting a value is fine, clearing out the field
> > does not apear to work. I can't seem to call Model->saveField
> > ('fieldname',null) or even pass an empty string.
>
> > Am I doing something wrong or is it just not possible, and I should do
> > a "normal" save?
>
> > /Martin
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: One app & db, many domains - what is the right mix?

2009-08-24 Thread Martin Westin

No, that's not it. That article is about how I switch configs based on
domain name.
I remember another one where they had example.com/name/controller/
action but made it name.example.com/controller/action... pretty close
to what you describe.

(a few minutes later)

I was close... they did some "cheating" to give users their own
domain:
http://bakery.cakephp.org/articles/view/subdomaining-with-cake
found it here:
http://www.mail-archive.com/cake-php@googlegroups.com/msg44539.html


It looks like something you could tweak for your needs.
/Martin


On Aug 24, 11:21 pm, jonoa  wrote:
> I think you are referring 
> tohttp://bakery.cakephp.org/articles/view/one-core-one-app-multiple-dom...
>
> I believe this scenario is where the author has multiple domains, a
> single app but a different DB containing the application specific data
> for each domain. He hacks bootstrap to match the header hostname to a
> config subdirectory and loads the appropriate db config file.
>
> Not quite what I'm looking to achieve but some good concepts there.
>
> On Aug 25, 1:25 am, Martin Westin  wrote:
>
>
>
> > Did you check the bakery?
> > I think I remember seeing something like that in some article a while
> > back.
>
> > /Martin
>
> > On Aug 24, 3:38 pm, jonoa  wrote:
>
> > > Hello all
>
> > > Big thanks to all the people who contribute to CakePHP - has certainly
> > > put some structure in to my development and I'll be donating as soon
> > > as I can monetize what I'm working on. :)
>
> > > I'm writing an app at the moment - basically it will allow the user to
> > > login, fill out some forms and basically spit out a pre-fabricated
> > > website complete with a registered domain.
>
> > > The interface for the user to login and submit the content for the
> > > site and register domains etc is done, the content to be used for the
> > > user-generated website is spread across a few models. I've built a
> > > controller (web) and appropriate views (about, contact) to make this
> > > data available. The website is also themed using native cake
> > > functionality allowing users to pick from a bunch of different themes.
>
> > > My question is this - how can I present the newly generated website
> > > and maintain the domain it was registered with? i.e. I can easily make
> > > my themed website available using /web/about/id:1 and /web/contact/id:
> > > 1 - but I need to make it accessible through mydomain.com/about and
> > > mydomain.com/contact. Similarly /web/about/id:2 and /web/contact/id:2
> > > would be accessible through myotherdomain.com/about and
> > > myotherdomain.com/contact.
>
> > > So the workflow is something like this..
>
> > > 1. User logs into corpsite.com
>
> > > 2. User enters content information into, essentially a CMS and a
> > > domain is registered for the user-site in the backend (i.e.
> > > mydomain.com)
>
> > > 3. Domain is configured in DNS and Apache to point at the corpsite.com
> > > cake application
>
> > > 4. Anyone who visits mydomain.com/about or mydomain.com/contact is
> > > essentially seeing a view rendered by corpsite.com/web/about/id:1 or
> > > corpsite.com/web/contact/id:1
>
> > > The tricky part is ensuring the URL for anyone visiting is the same as
> > > the domain that was registered.
>
> > > I'd like to keep everything as one app - I'm not sure if this is
> > > something I should be tackling in cake (I looked at routes - but I
> > > don't think it can match on hostname? In any case, if there was
> > > several hundred of these sites, would surely degrade performance too
> > > much). I'm thinking that mod_rewrite will definitely be involved
> > > somehow. Apache I'm pretty sure I can just use a wildcard virtual host
> > > and point it at the same app directory.
>
> > > I considered having the app write out a new directory structure and
> > > copy views etc over for each site, but I think that is not going to be
> > > maintainable.
>
> > > I think I have the various pieces - just not sure how to architect
> > > them. The fact that my cake app has knowledge of the relationship
> > > between the domain and the model for the content makes me think I can
> > > do this in cake. Scaling out to potentially hundreds of domains needs
> > > to be kept in mind.
>
> > > I'm not sure if this makes sense - any advice is greatly appreciated.
>
> > > Kind Regards
>
> > > Jon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Howto sort forum threads?

2009-08-24 Thread Braindead

I want to build a forum with CakePHP. The forum actually consists of
many forums. Each forum hasMany threads. A thread hasMany replies.
Forums, threads and replies are stored in separate tables. All
assossiations are setup correctly.

How can I sort threads and replies by date, so that the newest thread
or the thread with the newest reply comes first.

Thanks,
Markus
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Class and Model Naming Problems (wave becomes wafe)

2009-08-24 Thread Vijay Pandey

Yes...thats trueIt is NOT a bug but a "cake convention"all
plurals ending in "ves" are converted in "fe" to make singular.

To instruct cake not to do that...just add the entri in
$irregularPlurals at app/config/inflector.php  as Marcelo says.

Regards,

Vijay

On Aug 24, 10:48 pm, Nancy  wrote:
> This isn't going to help but I bet maybe it uses the the same rules
> for waves/wafe as it does for wives/wife. :D
>
> On Aug 21, 12:10 pm, JDRopp  wrote:
>
> > Thanks Marcelo for pointing to the relevant code.
>
> > I decided to change the model, table, and controller names instead.
>
> > I'll submit the defect to Cake.
>
> > On Aug 21, 12:01 pm, Marcelo Andrade  wrote:
>
> > > On Fri, Aug 21, 2009 at 3:21 PM, JDRopp wrote:
>
> > > > I've just started working with Cake and have been impressed so far.
>
> > > > I've created:
> > > > A table called "waves"
> > > > A model class called "wave" (wave.php)
> > > > A controller class called "WavesController" (waves_controller.php)
>
> > > > Somehow "wave" turns into "wafe" when SQL is generated.  For example:
> > > > Nr      Query   Error   Affected        Num. rows       Took (ms)
> > > > 1       DESCRIBE `waves`                3       3       38
> > > > 2       SELECT COUNT(*) AS `count` FROM `waves` AS `Wafe` WHERE 
> > > > `Wafe`.`id`
> > > > = 1             1       1       0
> > > > 3       SELECT `Wafe`.`id`, `Wafe`.`name`, `Wafe`.`deployment_date` FROM
> > > > `waves` AS `Wafe` WHERE `Wafe`.`id` = 1 LIMIT 1         1       1       > > > > 0
>
> > > > Any idea what's going on here?  I've searched and found no "wafe"
> > > > typos in my code.
>
> > > Not sure, but It seems like a bug in inflector.
>
> > > Try to add wave/waves to the $irregularPlurals at app/config/inflector.php
>
> > > If it not works, I'm afraid you'll have to define the $useTable = 
> > > 'waves'; in
> > > your Wave model.
>
> > > Best regards.
>
> > > --
> > > MARCELO DE F. ANDRADE
> > > Belem, PA, Amazonia, Brazil
> > > Linux User #221105
>
> > >http://mfandrade.wordpress.com
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



How to make pure html graphs in cakephp

2009-08-24 Thread mona

I want functions that create pure html graphs.


The functions should take an array as a parameter. The array will look
like
array('data' =>
  array(
array('label' => 'Nokia N95', 'number' => 95, 'axislabel' => ''),
array('label' => 'Apple iPhone', 'number' => 120, 'axislabel' =>
'iPhone'),
  ),
  'heading' => 'Graph Heading',
  'xaxis' => 'Phones this month',
  'yaxis' => 'Hits',
  'graphtype' => 'horizontal',
  'pixelswide' => 700,
  'pixelshigh' => 120);

Mousing over the bars in the bar graphs will produce the label &
number.

graphs should be horiantal or vertical bar graphs

can anybody tell me how to make these type of graphs in cakephp


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Edit function not working properly it always returns ID=(1)

2009-08-24 Thread Vijay Pandey

Hi,

Thanks for response

Status model has relationship with two tables "projects" and "tasks".
both relationships are one two many (one status can have many projects
and tasks)

here is status model (I have followed cake convention)

class Status extends AppModel {

var $name = 'Status';


//The Associations below have been created with all possible keys,
those that are not needed can be removed
var $hasMany = array(
'Project' => array(
'className' => 'Project',
'foreignKey' => 'status_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'Task' => array(
'className' => 'Task',
'foreignKey' => 'status_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);

}

Yes, the tables have conventional structure...

Strangly, the problem is only with stauses table..(I can not modify
anything in status table...even when I edit projects, I can not change
their status with always shows as 1 =not started.

I am not very familiar with CakePHP...please help..

Regards,

Vijay


On Aug 24, 9:07 pm, DavidH  wrote:
> I guess there's some relationship between Tasks Projects and Statuses
> because the SQL you're reproduced here shows what's being selected
> from the related models not from the statuses model. Does anything get
> selected from statuses at all?
>
> What does your statuses model look like?
>
> Do the underlying tables have conventional structures, I.e. id for the
> primary key and table_id for the foreign keys?
>
> David
>
> On Aug 24, 3:56 pm, Vijay Pandey  wrote:
>
> > Hi !
>
> > I have a little problem with edit function...I have developed a small
> > application to manage projects. Every project has a status...there are
> > totoal 5 statuses..I want to change the name of 5th status but I can
> > not do it...no matter which "status" I select to "edit" it always
> > displays status 1 for editing...
>
> > Here is the url
>
> > localhost/myapp/statuses/edit/4
>
> > and here is what it did:
>
> > SELECT `Project`.`id`, `Project`.`name`, `Project`.`description`,
> > `Project`.`status_id`, `Project`.`created`, `Project`.`modified` FROM
> > `projects` AS `Project` WHERE `Project`.`status_id` = (1)
>
> > SELECT `Task`.`id`, `Task`.`project_id`, `Task`.`name`,
> > `Task`.`description`, `Task`.`status_id`, `Task`.`created`,
> > `Task`.`modified` FROM `tasks` AS `Task` WHERE `Task`.`status_id` =
> > (1)
>
> > (i got this beacuse I have kept debug variable on )
>
> > What to do? this problem is only with "ststuses" only...all other
> > edits are working fine...
>
> > Here are other information
>
> > statuses_controller.php
>
> > function edit($id = null) {
> >                 if (!$id && empty($this->data)) {
> >                         $this->Session->setFlash(__('Invalid Status', 
> > true));
> >                         $this->redirect(array('action'=>'index'));
> >                 }
> >                 if (!empty($this->data)) {
> >                         if ($this->Status->save($this->data)) {
> >                                 $this->Session->setFlash(__('The Status has 
> > been saved', true));
> >                                 $this->redirect(array('action'=>'index'));
> >                         } else {
> >                                 $this->Session->setFlash(__('The Status 
> > could not be saved.
> > Please, try again.', true));
> >                         }
> >                 }
> >                 if (empty($this->data)) {
> >                         $this->data = $this->Status->read(null,$id);
> >                 }
> >         }
>
> > edit.ctp    file
>
> > create('Status');?>
> >         
> >                 
> >          >                 echo $form->input('id');
> >                 echo $form->input('name');
> >         ?>
> >         
> > end('Submit');?>
>
> > default.ctp file
>
> > 
> >         
> >                 
>
> >                         flash(); ?>
>
> >                         
>
> >                 
> >                 
>
> >                 
> >         
> >         
> > 
>
> > Please enlighten me why this strange thing is happening...
>
> > regards,
>
> > Vijai
--~--~-~--~~~---~--~~
You received this m

component->startup taking more time in new cake than old cake

2009-08-24 Thread abc

We ported our apps from alpha to 1.2.

We observed that component->startup is taking more time in new cake
than previously (100ms more).

Thanks in advance


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Changing datasource or database of a model during runtime

2009-08-24 Thread Dr. Loboto

http://groups.google.com/group/cake-php/browse_thread/thread/21717ae54545aaa9/a092d6c27a291b91?#a092d6c27a291b91

With such approach I ordinary have problems only with save callbacks
and need wrap above common save(), and do not have problems at all
with find(). Also after model config change you may need to call $this-
>setSource($this->useTable) to make saves work.

On Aug 24, 4:19 pm, Marco Pietschmann  wrote:
> Hi,
>
> got the following problem.
>
> Need to combine several tables from different datasources that are
> associated to each other. So far so good.
>
> But I've got the following problem:
> The data retreived from the default database defines which datasource
> should be used.
>
> Example:
>
> Project belongsTo Customer belongsTo Address belongsTo Country
> Project hasMany Invoices
>
> The Invoices are stored in different databases depending on the
> Customers country.
>
> I tried different things with changing the datasource of the invoice
> model, but since I set it with beforeFind the change only effects the
> next query, not the current one and I had to start additional queries.
>
> Since also a list of projects on one view is needed I need a solution
> that changes the datasource easily during runtime, not only once at
> the beginning of the lifecycle. I need a possibility to change the
> models datasource after loading the default data and before the data
> of the associated model is loaded.
>
> Any ideas?
>
> Thanks a lot,
> Marco
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Configure::listObjects() and bootstrap.php

2009-08-24 Thread brian

On Mon, Aug 24, 2009 at 2:44 PM, Pixelastic wrote:
>
> I don't think that would work. ::constructClasses() can't be called
> statically, it does use the $uses variable to instanciate the models.

Why do you need to call it statically?

> And additionnaly, AppController isn't even loaded in bootstrap.

The bootstrap would have nothing to do with it. I'm suggesting that
you place the code in AppController so it's run on each
request--pretty much the same thing you're looking for by putting it
in bootstrap.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: no pages_controller.php?

2009-08-24 Thread cralls

Thanks Schreck,

I was able to copy it over and update it as necessary.

In previous versions of CakePHP that I have used the
pages_controller.php was in my app's controllers directory after
baking the project. With this latest release it did not do that. I'm
not sure I see the reason behind NOT copying it out as part of the
bake project operation like it does with app_controller.php etc...
It's a file that will most likely be modified with most apps.

Thanks much,

~Casey

On Aug 24, 7:09 pm, schrec...@gmail.com wrote:
> The pages_controller is in the core library. You can find it under 
> cake/libs/controller/pages_controller.php (if memory serves)
> Schreck
>
> -Original Message-
> From: cralls <208...@gmail.com>
>
> Date: Mon, 24 Aug 2009 17:33:22
> To: CakePHP
> Subject: no pages_controller.php?
>
> I'm running version 1.2.4.8284 and I have no pages_controller.php. In
> past versions it's just always been there. Is this a bug or is it
> functions as designed?
>
> Either way, I need to know how to generate the pages_controller.php.
>
> What really blows me away is that I have the views/pages and the
> home.ctp works just fine, even though the controller is no-where to be
> seen.
>
> Thanks to those who post back.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



No Listbox for HABTM Relationship using Scaffold

2009-08-24 Thread josephusbrown

I am unable to get the list box to display for my HABTM relationship
between requests table and services table. I have created a
requests_services join table with the ids from both original tables
and the query that the bottom of the screen completes fine (SELECT
`Service`.`id`, `Service`.`name` FROM `services` AS `Service` WHERE 1
= 1 ). I am not sure what else to do, except code it out, but I was
hoping for the scaffolding to work. Please help.

/models/request.php
class Request extends AppModel
{
var $name = 'Request';
var $belongsTo = array('State');
var $hasAndBelongsToMany = array(
'Service'=>array('className'=>'Service',
 'joinTable'=>'requests_services',
 'foreignKey'=>'request_id',
 
'associationForeignKey'=>'service_id',
 'unique'=> true,
 
'with'=>'RequestsServices')
);
}

/models/service.php
class Service extends AppModel
{
var $name = 'Service';
var $hasAndBelongsToMany = array(
'Request'=>array('className'=>'Request',
 'joinTable'=>'requests_services',
 'with'=>'RequestsServices')
);
}

/controllers/requests_controller.php

class RequestsController extends AppController
{
var $name = 'Requests';
var $scaffold;
}

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: no pages_controller.php?

2009-08-24 Thread schreck84
The pages_controller is in the core library. You can find it under 
cake/libs/controller/pages_controller.php (if memory serves)
Schreck

-Original Message-
From: cralls <208...@gmail.com>

Date: Mon, 24 Aug 2009 17:33:22 
To: CakePHP
Subject: no pages_controller.php?



I'm running version 1.2.4.8284 and I have no pages_controller.php. In
past versions it's just always been there. Is this a bug or is it
functions as designed?

Either way, I need to know how to generate the pages_controller.php.

What really blows me away is that I have the views/pages and the
home.ctp works just fine, even though the controller is no-where to be
seen.

Thanks to those who post back.



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: One app & db, many domains - what is the right mix?

2009-08-24 Thread jonoa

Ahh ok that sort of makes sense - in my 'CMS' controller I could look
at the hostname, look the domain up and get the associated models..

I guess I need to just find some way of rewriting the URL so they stay
pretty.

On Aug 25, 9:08 am, Pixelastic  wrote:
> Maybe you could create a general controller, that will be triggered by
> any request to the cake app. And in a method inside it catch the
> hostname and make the appropriate db find operation to get the
> relevant content and then pass it to the view.
>
> On Aug 24, 11:21 pm, jonoa  wrote:
>
>
>
> > I think you are referring 
> > tohttp://bakery.cakephp.org/articles/view/one-core-one-app-multiple-dom...
>
> > I believe this scenario is where the author has multiple domains, a
> > single app but a different DB containing the application specific data
> > for each domain. He hacks bootstrap to match the header hostname to a
> > config subdirectory and loads the appropriate db config file.
>
> > Not quite what I'm looking to achieve but some good concepts there.
>
> > On Aug 25, 1:25 am, Martin Westin  wrote:
>
> > > Did you check the bakery?
> > > I think I remember seeing something like that in some article a while
> > > back.
>
> > > /Martin
>
> > > On Aug 24, 3:38 pm, jonoa  wrote:
>
> > > > Hello all
>
> > > > Big thanks to all the people who contribute to CakePHP - has certainly
> > > > put some structure in to my development and I'll be donating as soon
> > > > as I can monetize what I'm working on. :)
>
> > > > I'm writing an app at the moment - basically it will allow the user to
> > > > login, fill out some forms and basically spit out a pre-fabricated
> > > > website complete with a registered domain.
>
> > > > The interface for the user to login and submit the content for the
> > > > site and register domains etc is done, the content to be used for the
> > > > user-generated website is spread across a few models. I've built a
> > > > controller (web) and appropriate views (about, contact) to make this
> > > > data available. The website is also themed using native cake
> > > > functionality allowing users to pick from a bunch of different themes.
>
> > > > My question is this - how can I present the newly generated website
> > > > and maintain the domain it was registered with? i.e. I can easily make
> > > > my themed website available using /web/about/id:1 and /web/contact/id:
> > > > 1 - but I need to make it accessible through mydomain.com/about and
> > > > mydomain.com/contact. Similarly /web/about/id:2 and /web/contact/id:2
> > > > would be accessible through myotherdomain.com/about and
> > > > myotherdomain.com/contact.
>
> > > > So the workflow is something like this..
>
> > > > 1. User logs into corpsite.com
>
> > > > 2. User enters content information into, essentially a CMS and a
> > > > domain is registered for the user-site in the backend (i.e.
> > > > mydomain.com)
>
> > > > 3. Domain is configured in DNS and Apache to point at the corpsite.com
> > > > cake application
>
> > > > 4. Anyone who visits mydomain.com/about or mydomain.com/contact is
> > > > essentially seeing a view rendered by corpsite.com/web/about/id:1 or
> > > > corpsite.com/web/contact/id:1
>
> > > > The tricky part is ensuring the URL for anyone visiting is the same as
> > > > the domain that was registered.
>
> > > > I'd like to keep everything as one app - I'm not sure if this is
> > > > something I should be tackling in cake (I looked at routes - but I
> > > > don't think it can match on hostname? In any case, if there was
> > > > several hundred of these sites, would surely degrade performance too
> > > > much). I'm thinking that mod_rewrite will definitely be involved
> > > > somehow. Apache I'm pretty sure I can just use a wildcard virtual host
> > > > and point it at the same app directory.
>
> > > > I considered having the app write out a new directory structure and
> > > > copy views etc over for each site, but I think that is not going to be
> > > > maintainable.
>
> > > > I think I have the various pieces - just not sure how to architect
> > > > them. The fact that my cake app has knowledge of the relationship
> > > > between the domain and the model for the content makes me think I can
> > > > do this in cake. Scaling out to potentially hundreds of domains needs
> > > > to be kept in mind.
>
> > > > I'm not sure if this makes sense - any advice is greatly appreciated.
>
> > > > Kind Regards
>
> > > > Jon- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



no pages_controller.php?

2009-08-24 Thread cralls

I'm running version 1.2.4.8284 and I have no pages_controller.php. In
past versions it's just always been there. Is this a bug or is it
functions as designed?

Either way, I need to know how to generate the pages_controller.php.

What really blows me away is that I have the views/pages and the
home.ctp works just fine, even though the controller is no-where to be
seen.

Thanks to those who post back.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Cake's built-in caching in i18n.php

2009-08-24 Thread A Smiley

My company uses CakePHP as our application framework, and recently
upgraded to the 1.2 release.  Recently while doing performance testing
we noticed that the localization functions are eating up a lot more
time than they did with our old Cake version, and traced it to the new
caching scheme found in i18n.php.  (Previously, we had been using a
'homegrown' caching addition to this file.)

I believe I've pinned down the problem as follows.  Consider a page
which displays two strings:

md('seo', 'homepage.header');
md('default', 'Welcome to our site!');

Suppose the cache is already populated - with the seo domain only.
Then, on the 'seo' call:

$_this->domain is set to {$domain}_{$lang_code} - let's say you're
browsing in en-us, so this is seo_en_us.
$_this->__domains is empty, so it loads the cached domains from
seo_en_us.
The SEO domain is in the cache, so the function simply performs the
translation.

On the 'default' call:

$_this->domain is set to {$domain}_{$lang_code} - default_en_us.
$_this->__domains has been previously set by the 'seo' call, so no
cache is loaded.
The default domain is NOT in the cache, so the function loads it from
PO and sets $_this->__cache.

On the destruct afterwards:

$_this->domain is still whatever it was set to by the last call
(default_en_us).
$_this->domains is written out into the '_cake_core_' cache under the
key 'default_en_us'.

The next time we load the page, seo_en_us is again the first $_this-
>domain value, so we load the cached value from 'seo_en_us' - only
this value hasn't been updated, so we *again* read in the entire
default.po on the second call.  And so on, and so on ad infinitem.
This means that the localization cache is often underutilized in
localization schemes with multiple domains because we're reading from
one cache key and writing to another.

This was quite problematic for us because it increased the duration of
the afflicted localization calls by about 7.5x.  Once we removed the
domain dependence from the cache key, it worked fine.  Is this a
potential bug in Cake?

--Smiley

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: One app & db, many domains - what is the right mix?

2009-08-24 Thread Pixelastic

Maybe you could create a general controller, that will be triggered by
any request to the cake app. And in a method inside it catch the
hostname and make the appropriate db find operation to get the
relevant content and then pass it to the view.

On Aug 24, 11:21 pm, jonoa  wrote:
> I think you are referring 
> tohttp://bakery.cakephp.org/articles/view/one-core-one-app-multiple-dom...
>
> I believe this scenario is where the author has multiple domains, a
> single app but a different DB containing the application specific data
> for each domain. He hacks bootstrap to match the header hostname to a
> config subdirectory and loads the appropriate db config file.
>
> Not quite what I'm looking to achieve but some good concepts there.
>
> On Aug 25, 1:25 am, Martin Westin  wrote:
>
> > Did you check the bakery?
> > I think I remember seeing something like that in some article a while
> > back.
>
> > /Martin
>
> > On Aug 24, 3:38 pm, jonoa  wrote:
>
> > > Hello all
>
> > > Big thanks to all the people who contribute to CakePHP - has certainly
> > > put some structure in to my development and I'll be donating as soon
> > > as I can monetize what I'm working on. :)
>
> > > I'm writing an app at the moment - basically it will allow the user to
> > > login, fill out some forms and basically spit out a pre-fabricated
> > > website complete with a registered domain.
>
> > > The interface for the user to login and submit the content for the
> > > site and register domains etc is done, the content to be used for the
> > > user-generated website is spread across a few models. I've built a
> > > controller (web) and appropriate views (about, contact) to make this
> > > data available. The website is also themed using native cake
> > > functionality allowing users to pick from a bunch of different themes.
>
> > > My question is this - how can I present the newly generated website
> > > and maintain the domain it was registered with? i.e. I can easily make
> > > my themed website available using /web/about/id:1 and /web/contact/id:
> > > 1 - but I need to make it accessible through mydomain.com/about and
> > > mydomain.com/contact. Similarly /web/about/id:2 and /web/contact/id:2
> > > would be accessible through myotherdomain.com/about and
> > > myotherdomain.com/contact.
>
> > > So the workflow is something like this..
>
> > > 1. User logs into corpsite.com
>
> > > 2. User enters content information into, essentially a CMS and a
> > > domain is registered for the user-site in the backend (i.e.
> > > mydomain.com)
>
> > > 3. Domain is configured in DNS and Apache to point at the corpsite.com
> > > cake application
>
> > > 4. Anyone who visits mydomain.com/about or mydomain.com/contact is
> > > essentially seeing a view rendered by corpsite.com/web/about/id:1 or
> > > corpsite.com/web/contact/id:1
>
> > > The tricky part is ensuring the URL for anyone visiting is the same as
> > > the domain that was registered.
>
> > > I'd like to keep everything as one app - I'm not sure if this is
> > > something I should be tackling in cake (I looked at routes - but I
> > > don't think it can match on hostname? In any case, if there was
> > > several hundred of these sites, would surely degrade performance too
> > > much). I'm thinking that mod_rewrite will definitely be involved
> > > somehow. Apache I'm pretty sure I can just use a wildcard virtual host
> > > and point it at the same app directory.
>
> > > I considered having the app write out a new directory structure and
> > > copy views etc over for each site, but I think that is not going to be
> > > maintainable.
>
> > > I think I have the various pieces - just not sure how to architect
> > > them. The fact that my cake app has knowledge of the relationship
> > > between the domain and the model for the content makes me think I can
> > > do this in cake. Scaling out to potentially hundreds of domains needs
> > > to be kept in mind.
>
> > > I'm not sure if this makes sense - any advice is greatly appreciated.
>
> > > Kind Regards
>
> > > Jon
>
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: $ajax->form - NOT WORKING!!!!! ARGHHHH

2009-08-24 Thread yaronh

Hi,

I have the same problem, did anyone found a solution for it?

On Jul 23, 12:24 am, David  wrote:
> Hello,
>
> I am trying to work with ajax helper to do a comments form on a test
> blog system.
> I am fairly new...but have managed to pick most things up...but this
> is doing my head in!
>
> Okay so I show a blog post and people can comment on them so I use
> this in the view file:
>
> form(null,'post',array
> ('update'=>'comment','url'=>array
> ('controller'=>'comments','action'=>'add')));
>  ?>
> input('Comment.name'); ?>
> input('Comment.content'); ?>
> input('Comment.post_id', array
> ('type'=>'hidden','value'=>$post['Post']['id'])); ?>
> end('Add Comment'); ?>
>
> ---
> then the logic for this in the Comments controller / add function is :
>
> function add() {
>                 if(!empty($this->data)){
>                         $this->Comment->create();
>                         if($this->Comment->save($this->data)) {
>                                 
> $comments=$this->Comment->find('all',array('conditions'=>array
> ('post_id'=>$this->data['Comment']['post_id']),'recursive'=>-1));
>                                 $this->set(compact('comments'));
>                                 $this->render('add_success','ajax');
>                         }else{
>                                 $this->render('add_failure','ajax');
>                         }
>                 }
>         }
>
> ..now it all displays good..BUT when I click 'Add Comment'
> It doesnt do ANYTHING!!! I have searched high and low and
> cannot find any help on the web, so I am hoping some superstar on here
> can help??
>
> WHY is it not doing ANYTHINGatleast if I got an error I could take
> it from there, but I get NOTHING!
>
> PLEASE HELP!!

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: One app & db, many domains - what is the right mix?

2009-08-24 Thread jonoa

I think you are referring to 
http://bakery.cakephp.org/articles/view/one-core-one-app-multiple-domains

I believe this scenario is where the author has multiple domains, a
single app but a different DB containing the application specific data
for each domain. He hacks bootstrap to match the header hostname to a
config subdirectory and loads the appropriate db config file.

Not quite what I'm looking to achieve but some good concepts there.

On Aug 25, 1:25 am, Martin Westin  wrote:
> Did you check the bakery?
> I think I remember seeing something like that in some article a while
> back.
>
> /Martin
>
> On Aug 24, 3:38 pm, jonoa  wrote:
>
> > Hello all
>
> > Big thanks to all the people who contribute to CakePHP - has certainly
> > put some structure in to my development and I'll be donating as soon
> > as I can monetize what I'm working on. :)
>
> > I'm writing an app at the moment - basically it will allow the user to
> > login, fill out some forms and basically spit out a pre-fabricated
> > website complete with a registered domain.
>
> > The interface for the user to login and submit the content for the
> > site and register domains etc is done, the content to be used for the
> > user-generated website is spread across a few models. I've built a
> > controller (web) and appropriate views (about, contact) to make this
> > data available. The website is also themed using native cake
> > functionality allowing users to pick from a bunch of different themes.
>
> > My question is this - how can I present the newly generated website
> > and maintain the domain it was registered with? i.e. I can easily make
> > my themed website available using /web/about/id:1 and /web/contact/id:
> > 1 - but I need to make it accessible through mydomain.com/about and
> > mydomain.com/contact. Similarly /web/about/id:2 and /web/contact/id:2
> > would be accessible through myotherdomain.com/about and
> > myotherdomain.com/contact.
>
> > So the workflow is something like this..
>
> > 1. User logs into corpsite.com
>
> > 2. User enters content information into, essentially a CMS and a
> > domain is registered for the user-site in the backend (i.e.
> > mydomain.com)
>
> > 3. Domain is configured in DNS and Apache to point at the corpsite.com
> > cake application
>
> > 4. Anyone who visits mydomain.com/about or mydomain.com/contact is
> > essentially seeing a view rendered by corpsite.com/web/about/id:1 or
> > corpsite.com/web/contact/id:1
>
> > The tricky part is ensuring the URL for anyone visiting is the same as
> > the domain that was registered.
>
> > I'd like to keep everything as one app - I'm not sure if this is
> > something I should be tackling in cake (I looked at routes - but I
> > don't think it can match on hostname? In any case, if there was
> > several hundred of these sites, would surely degrade performance too
> > much). I'm thinking that mod_rewrite will definitely be involved
> > somehow. Apache I'm pretty sure I can just use a wildcard virtual host
> > and point it at the same app directory.
>
> > I considered having the app write out a new directory structure and
> > copy views etc over for each site, but I think that is not going to be
> > maintainable.
>
> > I think I have the various pieces - just not sure how to architect
> > them. The fact that my cake app has knowledge of the relationship
> > between the domain and the model for the content makes me think I can
> > do this in cake. Scaling out to potentially hundreds of domains needs
> > to be kept in mind.
>
> > I'm not sure if this makes sense - any advice is greatly appreciated.
>
> > Kind Regards
>
> > Jon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



OAuth Serving

2009-08-24 Thread eusef

Hi all,

Has anyone had any experince with putting together an OAuth server for
an existing service using a library for PHP or a component for Cake?

T.I.A.

Phil
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Geocode Plugin

2009-08-24 Thread Mariano Iglesias
Bakers,

I've just added a Geocode plugin to my github repository (based mostly 
on the work by Nate at 
http://bakery.cakephp.org/articles/view/geocoding-in-cakephp and 
lababidi at 
http://bakery.cakephp.org/articles/view/adding-a-google-map-to-your-app):

Check it out at (geocode plugin):

http://github.com/mariano/syrup/tree/master

I haven't added any documentation to it yet, since I'm still working on 
it, but you can start to get an idea from its test cases:

http://tinyurl.com/kn4vqb

As you can see:

* Default unit is Kilometers, but any distance calculation can be
  done on the given units (kilometers, miles, feet, inches, nautical
  miles)
* You can attach the Geocodable behavior to any model where you
  store some sort of address information
* If you use the built in Geocode.Address model, you can take
  advantage of the built in 'near' find type, which allows you to:
  o $this->Address->find('near', array('address' => '1209 La
Brad Lane, Tampa, FL'));
  o Paginate on the 'near' find type (check test cases)
  o Specify distance and resulting distance on any given unit:
$this->Address->find('near', array('address' => '1209 La
Brad Lane, Tampa, FL', 'distance' => 5, 'unit' => 'm'));
* When you use 'near' (custom find type) or near method you can sort
  by proximity (near, or further away)

Since I have yet to add documentation those of you who like to be up to 
the challenge and start using this stuff please go ahead. Do report any 
issues you may find on github.

-- 

PS: *Help me Get Married*: Chip in my Wedding Fund 
 :)

-MI
*Coding Ninja* @ CRICAVA Technologies 
 
*Blog*: http://www.marianoiglesias.com.ar
*Twitter*:  http://twitter.com/mgiglesias
*LinkedIn*: http://www.linkedin.com/pub/2/483/B94
*Facebook*: http://www.facebook.com/mariano.iglesias


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Dying on blank white page

2009-08-24 Thread Pixelastic

Maybe a chmod problem, making the cache uneffective ?

On Aug 24, 7:36 pm, brian  wrote:
> Do you have access to Apache's error log? The blank page may be due to
> a fatal PHP error
>
> On Sun, Aug 23, 2009 at 11:40 AM, Arvind wrote:
>
> > Yes of course. But as i mentioned above no cache files were being
> > written to tmp cache directory.
>
> > On Aug 21, 3:00 pm, "rich...@home"  wrote:
> >> Also worth remembering to clear the app/tmp directories (just the
> >> files, leave the directory structures intact) when you upload
>
> >> On Aug 21, 9:22 am, Bert Van den Brande  wrote:
>
> >> > I've had blank pages when :
> >> > * .htaccess was not working as it should, due to restrictions from
> >> > Apache (it needed Allow Overwrite All)
> >> > * a table was missing from the db, and the error couldn't be displayed
> >> > by Cake because it got into a recursion when trying to output the
> >> > message html (this is very project specific since we added some magic
> >> > stuff to /app/config/routes.php)
>
> >> > Still it's weird that all of a sudden it started working ... I'm
> >> > thinking along the line of a browser page cache that just showed you
> >> > the white page again instead of reloading the requested url ?
>
> >> > On Thu, Aug 20, 2009 at 10:00 PM, Arvind wrote:
>
> >> > > It has started to work without doing anything moments ago. All i did,
> >> > > i decided to debug through dispatcher
> >> > > and before going into the dispatcher i decided to do some "dies"
> >> > > around
> >> > > to the dispatcher call in webroot/index.php file to make sure it goes
> >> > > into
> >> > > (which i had tested already; just wanted to double check it) it and
> >> > > after
> >> > > doing 2-3 "dies" around the code
>
> >> > >        if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) {
> >> > >                trigger_error("CakePHP core could not be found.  Check
> >> > > the value of
> >> > > CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php.  It should point to
> >> > > the directory containing your " . DS . "cake core directory and your
> >> > > " . DS . "vendors root directory.", E_USER_ERROR);
> >> > >        }
> >> > >        if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') {
> >> > >                return;
> >> > >        } else {
>
> >> > >                $Dispatcher = new Dispatcher();
> >> > >                $Dispatcher->dispatch($url);
> >> > >        }
> >> > >        if (Configure::read() > 0) {
> >> > >                echo "";
> >> > >        }
>
> >> > > and it started to work all at once. And tmp/cache files also started
> >> > > to
> >> > > get
> >> > > generated! VERY STRANGE INDEED!!
>
> >> > > I think there must be something which i am missing. Please let me
> >> > > know if someone has faced this kind of problem. Some apache
> >> > > server problem? Cake hash validation problem? or caching problem?
>
> >> > > Please put your thoughts before cakephp ( which i love the most in
> >> > > frameworks ) starts to become a mystery to me. (I wish it were not a
> >> > > cakephp problem though)
>
> >> > > On Aug 21, 12:21 am, Arvind  wrote:
> >> > >> Hi everyone,
>
> >> > >> I uploaded my local controller files, view files and one css file to
> >> > >> remote server 2 hrs ago and tried to access the site admin section but
> >> > >> it is dying on blank white page without any debug report or any error
> >> > >> displayed. The entire system is working fine on my local wamp server
> >> > >> and also worked well on the same remote server yesterday but is not
> >> > >> working right now. I have checked all files many a times and all files
> >> > >> mentioned above are parallel to my local files with one exception. On
> >> > >> the remote server there is no cache files being generated inside the
> >> > >> app/tmp/cache folder which i noticed today only but i am sure it
> >> > >> worked with same settings 1 day ago. I am trying to debug in webroot/
> >> > >> index.php file and it is reaching till the dispatcher alright. I also
> >> > >> tried by removing .htaccess but same problem with /webroot/index.php
> >> > >> file. Mod rewrite is WORKING just fine.
>
> >> > >> Not sure what is the problem. Anyone with thoughts on this is most
> >> > >> welcome as i have already started to pull my hair.
>
> >> > >> Here is the url where it is dying on blank page 
> >> > >> :http://d1041638.blacknight.com/admin/users/login
>
> >> > >> Thanks in advance,
>
> >> > >> Arvind.
>
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Configure::listObjects() and bootstrap.php

2009-08-24 Thread Pixelastic

I don't think that would work. ::constructClasses() can't be called
statically, it does use the $uses variable to instanciate the models.
And additionnaly, AppController isn't even loaded in bootstrap.

If that's of any help, I'm trying to grab the plugin list by calling
Configure::listObjects('plugin');


On Aug 24, 7:32 pm, brian  wrote:
> AppController::constructClasses()?
>
> On Mon, Aug 24, 2009 at 8:42 AM, Pixelastic wrote:
>
> > Hello,
>
> > I have some code I would like to put in my bootstrap.php that needs
> > the Configure::listObjects() function. Unfortunately, this function
> > does not return anything when called from inside the bootstrap.php,
> > likely because bootstrap is called very very early.
>
> > I finally had to put my code in the routes.php file, because that's
> > the only place I found to get my code loaded as early as possible, but
> > it is quite an unusual place. And not a very clean way of organizing
> > things.
>
> > Do any of you know a cleaner way to this ?
>
> > (P.S : As the listObject() method is quite heavy, I DO cache results
> > of my custom function for further requests, but I need the first one -
> > cache empty- to occur before any model creation)
>
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: really wierd problem

2009-08-24 Thread Pixelastic

It seems that you are trying to access a class variable from a static
call. Make sure that you are using an instance of your
InformationsController and not the class itself.

On Aug 24, 8:16 pm, Paulos23  wrote:
> Hi people,
> I am facing a really wierd problem.I am building my app with cake
> since previous September and for 1st time i can't find any solution.In
> particular,i am trying to save some data and i am taking this message
> >
>
> Notice (8): Undefined property: InformationsController::$Information
> [APP\controllers\informations_controller.php, line 79]
>
>         /** saves the input data from user**/
>
>         $this->Information->saveAll($this->data);
>
> InformationsController::view() - APP\controllers
> \informations_controller.php, line 79
> Object::dispatchMethod() - CORE\cake\libs\object.php, line 117
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194
> require - APP\webroot\index.php, line 88
> [main] - CORE\index.php, line 61
>
> Fatal error: Call to a member function saveAll() on a non-object in C:
> \Program Files\xampp\htdocs\voyage~voyage-source\app\controllers
> \informations_controller.php on line 79
>
> My model is named Information,my controller informations_controller
> and the table in database is named informations.I use the same way for
> another model (Location) and everything work fine!
> Any ideas why this happened to my code?
>
> Ty in advance!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



really wierd problem

2009-08-24 Thread Paulos23

Hi people,
I am facing a really wierd problem.I am building my app with cake
since previous September and for 1st time i can't find any solution.In
particular,i am trying to save some data and i am taking this message
>

Notice (8): Undefined property: InformationsController::$Information
[APP\controllers\informations_controller.php, line 79]


/** saves the input data from user**/

$this->Information->saveAll($this->data);

InformationsController::view() - APP\controllers
\informations_controller.php, line 79
Object::dispatchMethod() - CORE\cake\libs\object.php, line 117
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194
require - APP\webroot\index.php, line 88
[main] - CORE\index.php, line 61


Fatal error: Call to a member function saveAll() on a non-object in C:
\Program Files\xampp\htdocs\voyage~voyage-source\app\controllers
\informations_controller.php on line 79


My model is named Information,my controller informations_controller
and the table in database is named informations.I use the same way for
another model (Location) and everything work fine!
Any ideas why this happened to my code?

Ty in advance!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: class Overloadable2

2009-08-24 Thread mark_story

The key to Overloadable and Overloadable lies in the php4 versions of
the files.  Basically both classes serve as workarounds for PHP4's
lack of magic methods.  By using overload() you can add magic methods
into PHP4 classes.  So the overloadable classes are the base classes
for all objects that have magic methods.

-Mark

On Aug 24, 6:28 am, Biaggi  wrote:
> I've been looking for a use of this class but i cant find any
> changeset or documentation about the need of that class or what the
> class resolves.
>
> The main diference between class Overloadable and Overloadable2 are
> the __get and __set functions, this functions appears in commit [3957]
> and seems to be fully deprecated.
>
> So, someone knows why the class Overloadable2 appears in the
> Overloadable_php4.php and Overloadable_php5.php files.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Class and Model Naming Problems (wave becomes wafe)

2009-08-24 Thread Nancy

This isn't going to help but I bet maybe it uses the the same rules
for waves/wafe as it does for wives/wife. :D

On Aug 21, 12:10 pm, JDRopp  wrote:
> Thanks Marcelo for pointing to the relevant code.
>
> I decided to change the model, table, and controller names instead.
>
> I'll submit the defect to Cake.
>
> On Aug 21, 12:01 pm, Marcelo Andrade  wrote:
>
> > On Fri, Aug 21, 2009 at 3:21 PM, JDRopp wrote:
>
> > > I've just started working with Cake and have been impressed so far.
>
> > > I've created:
> > > A table called "waves"
> > > A model class called "wave" (wave.php)
> > > A controller class called "WavesController" (waves_controller.php)
>
> > > Somehow "wave" turns into "wafe" when SQL is generated.  For example:
> > > Nr      Query   Error   Affected        Num. rows       Took (ms)
> > > 1       DESCRIBE `waves`                3       3       38
> > > 2       SELECT COUNT(*) AS `count` FROM `waves` AS `Wafe` WHERE 
> > > `Wafe`.`id`
> > > = 1             1       1       0
> > > 3       SELECT `Wafe`.`id`, `Wafe`.`name`, `Wafe`.`deployment_date` FROM
> > > `waves` AS `Wafe` WHERE `Wafe`.`id` = 1 LIMIT 1         1       1       0
>
> > > Any idea what's going on here?  I've searched and found no "wafe"
> > > typos in my code.
>
> > Not sure, but It seems like a bug in inflector.
>
> > Try to add wave/waves to the $irregularPlurals at app/config/inflector.php
>
> > If it not works, I'm afraid you'll have to define the $useTable = 'waves'; 
> > in
> > your Wave model.
>
> > Best regards.
>
> > --
> > MARCELO DE F. ANDRADE
> > Belem, PA, Amazonia, Brazil
> > Linux User #221105
>
> >http://mfandrade.wordpress.com
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Dying on blank white page

2009-08-24 Thread brian

Do you have access to Apache's error log? The blank page may be due to
a fatal PHP error

On Sun, Aug 23, 2009 at 11:40 AM, Arvind wrote:
>
> Yes of course. But as i mentioned above no cache files were being
> written to tmp cache directory.
>
> On Aug 21, 3:00 pm, "rich...@home"  wrote:
>> Also worth remembering to clear the app/tmp directories (just the
>> files, leave the directory structures intact) when you upload
>>
>> On Aug 21, 9:22 am, Bert Van den Brande  wrote:
>>
>> > I've had blank pages when :
>> > * .htaccess was not working as it should, due to restrictions from
>> > Apache (it needed Allow Overwrite All)
>> > * a table was missing from the db, and the error couldn't be displayed
>> > by Cake because it got into a recursion when trying to output the
>> > message html (this is very project specific since we added some magic
>> > stuff to /app/config/routes.php)
>>
>> > Still it's weird that all of a sudden it started working ... I'm
>> > thinking along the line of a browser page cache that just showed you
>> > the white page again instead of reloading the requested url ?
>>
>> > On Thu, Aug 20, 2009 at 10:00 PM, Arvind wrote:
>>
>> > > It has started to work without doing anything moments ago. All i did,
>> > > i decided to debug through dispatcher
>> > > and before going into the dispatcher i decided to do some "dies"
>> > > around
>> > > to the dispatcher call in webroot/index.php file to make sure it goes
>> > > into
>> > > (which i had tested already; just wanted to double check it) it and
>> > > after
>> > > doing 2-3 "dies" around the code
>>
>> > >        if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) {
>> > >                trigger_error("CakePHP core could not be found.  Check
>> > > the value of
>> > > CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php.  It should point to
>> > > the directory containing your " . DS . "cake core directory and your
>> > > " . DS . "vendors root directory.", E_USER_ERROR);
>> > >        }
>> > >        if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') {
>> > >                return;
>> > >        } else {
>>
>> > >                $Dispatcher = new Dispatcher();
>> > >                $Dispatcher->dispatch($url);
>> > >        }
>> > >        if (Configure::read() > 0) {
>> > >                echo "";
>> > >        }
>>
>> > > and it started to work all at once. And tmp/cache files also started
>> > > to
>> > > get
>> > > generated! VERY STRANGE INDEED!!
>>
>> > > I think there must be something which i am missing. Please let me
>> > > know if someone has faced this kind of problem. Some apache
>> > > server problem? Cake hash validation problem? or caching problem?
>>
>> > > Please put your thoughts before cakephp ( which i love the most in
>> > > frameworks ) starts to become a mystery to me. (I wish it were not a
>> > > cakephp problem though)
>>
>> > > On Aug 21, 12:21 am, Arvind  wrote:
>> > >> Hi everyone,
>>
>> > >> I uploaded my local controller files, view files and one css file to
>> > >> remote server 2 hrs ago and tried to access the site admin section but
>> > >> it is dying on blank white page without any debug report or any error
>> > >> displayed. The entire system is working fine on my local wamp server
>> > >> and also worked well on the same remote server yesterday but is not
>> > >> working right now. I have checked all files many a times and all files
>> > >> mentioned above are parallel to my local files with one exception. On
>> > >> the remote server there is no cache files being generated inside the
>> > >> app/tmp/cache folder which i noticed today only but i am sure it
>> > >> worked with same settings 1 day ago. I am trying to debug in webroot/
>> > >> index.php file and it is reaching till the dispatcher alright. I also
>> > >> tried by removing .htaccess but same problem with /webroot/index.php
>> > >> file. Mod rewrite is WORKING just fine.
>>
>> > >> Not sure what is the problem. Anyone with thoughts on this is most
>> > >> welcome as i have already started to pull my hair.
>>
>> > >> Here is the url where it is dying on blank page 
>> > >> :http://d1041638.blacknight.com/admin/users/login
>>
>> > >> Thanks in advance,
>>
>> > >> Arvind.
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Configure::listObjects() and bootstrap.php

2009-08-24 Thread brian

AppController::constructClasses()?

On Mon, Aug 24, 2009 at 8:42 AM, Pixelastic wrote:
>
> Hello,
>
> I have some code I would like to put in my bootstrap.php that needs
> the Configure::listObjects() function. Unfortunately, this function
> does not return anything when called from inside the bootstrap.php,
> likely because bootstrap is called very very early.
>
> I finally had to put my code in the routes.php file, because that's
> the only place I found to get my code loaded as early as possible, but
> it is quite an unusual place. And not a very clean way of organizing
> things.
>
> Do any of you know a cleaner way to this ?
>
> (P.S : As the listObject() method is quite heavy, I DO cache results
> of my custom function for further requests, but I need the first one -
> cache empty- to occur before any model creation)
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: pages not diplayed

2009-08-24 Thread brian

Check Apache's logs if you can access them. Check Cake's error log.
Set debug = 2.

On Sun, Aug 23, 2009 at 5:24 AM, xxbeta wrote:
>
> My project is working properly on my local server, apache on windows
> xp. However, after uploading all the files onto the hosting server,
> some pages just can not be displayed.Only returns a blank page in the
> web browser, both IE and Firefox. The hosting server should be linux.
> Need advice.
>
> Thanks advance.
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Request help with a model definition.

2009-08-24 Thread brian

On Sun, Aug 23, 2009 at 9:23 AM, gedm wrote:
>
> Hi,
>
> I am very new to Cake and have searched for an answer to this but
> can't quite get my head around it enough to ask ask the right
> question.

I'm not sure you asked anything. What's your question?

The debug array you posted looks ok to me. That is, if $id = 1. Is
that the case? Have you reied it with $id = 2? You should see the
ParentComment then, and the ChildComment array should be empty.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Changing datasource or database of a model during runtime

2009-08-24 Thread DavidH

Is this something you can define at the database level rather than at
the application level? If I were designing an application I would try
and present a coherent and consistent view of the data to the
application layer. I'd have to ask you why you have invoices stored in
different databases according to country?

On Aug 24, 10:19 am, Marco Pietschmann  wrote:
> Hi,
>
> got the following problem.
>
> Need to combine several tables from different datasources that are
> associated to each other. So far so good.
>
> But I've got the following problem:
> The data retreived from the default database defines which datasource
> should be used.
>
> Example:
>
> Project belongsTo Customer belongsTo Address belongsTo Country
> Project hasMany Invoices
>
> The Invoices are stored in different databases depending on the
> Customers country.
>
> I tried different things with changing the datasource of the invoice
> model, but since I set it with beforeFind the change only effects the
> next query, not the current one and I had to start additional queries.
>
> Since also a list of projects on one view is needed I need a solution
> that changes the datasource easily during runtime, not only once at
> the beginning of the lifecycle. I need a possibility to change the
> models datasource after loading the default data and before the data
> of the associated model is loaded.
>
> Any ideas?
>
> Thanks a lot,
> Marco
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Data Validation

2009-08-24 Thread DavidH

Have you tried

array('rule' => 'notEmpty', 'message' => '.')

I.e. don't put the notEmpty into an array. This is the format in the
CookBook http://book.cakephp.org/view/338/Data-Validation

David

On Aug 24, 8:28 am, Juan Jose Marquez 
wrote:
> I have a small problem with the validation of some fields in a model
> The particular problem is that the system validates the data if the model
> but I painted the error messages in sight and it is not
> possible and have tried some things but nothing and I'm desperate.
> This is the code I have
>
>
>     VISTA
>         echo $form->create('usuariosaplicacion',array('url' =>
> '/clientes/add_acceso_aplicacion'))."\n";
>         echo "\n";
>         echo "Aplicación\n";
>         echo $form->input('usuariosaplicacion.id_aplicacion',  
> array('label'=>false,'div'=>false,'empty'=>true,'options'=>$lista_aplicaciones))."\n";
>         echo "\n";
>         echo $form->input('sm_precio_sms',  array('label'=>Precio
> SMS,'size' => '5','maxlength'=>'4','div'=>false))."\n";
>         echo $form->input('usuariosaplicacion.id_usuario',
> array('type'=>'hidden', 'value' => $id_cliente));
>         echo $form->end('Submit');
>
>     MODELO
>        var $validate = array(  
>          'id_aplicacion'   => array(
>            'required' => array('rule' => array('notEmpty'),'message' =>
> 'Debe Seleccionar una aplicación')
>       )
>     );
>
>     CONTROLADOR
>
>     if (!empty($this->data)) {
>             if ($this->usuariosaplicacion->save($this->data)) {
>                 $this->Session->setFlash(__('Se ha añadido el acceso a
> esta aplicacion correctamente', true));
>                 //$this->redirect(array('action'=>'index'));
>             } else {
>                 $this->Session->setFlash(__('No se ha podido dar el
> acceso a esta aplicacion.', true));
>             }
>         }Do not know if this table will have something to do with this table 
> is the table MIDDLE HABT a Relationship.
> A greeting and thank you very much
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Connecting to ORACLE Database !

2009-08-24 Thread DavidH

Have you tried setting up the connection as in this thread:

http://groups.google.com/group/cake-php/browse_thread/thread/48df05d640ce3276

It's possible you need the oci_connect and to use the database SID
rather than the service name.

David

On Aug 24, 4:21 pm, Xanax  wrote:
> Hello,
>
> I've been developing my cakephp application with MySQL sor far and now
> i must migrate the database to an oracle one.
>
> I've created an oracle database and import the tables, everything
> wrked fine.
> Here an extract of the tsnames.ora entry concerning this databse :
>
>  ORACLE_DPRO =
>   (DESCRIPTION =
>     (ADDRESS = (PROTOCOL = TCP)(HOST = 10.50.114.21)(PORT = 1521))
>     (CONNECT_DATA = (SERVICE_NAME = DPRO11))
>   )
>
> In my databse.php, i've set up this :
>
>                 var $default = array(
>                 'driver' => 'oracle',
>                 'persistent' => false,
>                 'host' => '10.50.114.21',
>                 'login' => 'AZIZM',
>                 'password' => 'AZIZM',
>                 'database' => 'DPRO11',
>                 'encoding' => 'UTF-8',
>                 'prefix' => '',
>         );
>
> Whe i go to the test, cakephp show that the databse config gile is
> present and then nothing else, i think it bugs when he try to verify
> the connection... :
>
> Release Notes for CakePHP 1.2.1.8004.
> Read the changelog
>
> 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 present.
>
> Do you have any idea of what should be the problem ? Thanks in
> advande, me i have no clue...
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: CakePHP Install Issue

2009-08-24 Thread majna

You are using php 5.3?
http://groups.google.com/group/cake-php/browse_thread/thread/cc8b71d4b7aa5217

On Aug 24, 8:39 am, Lostprophetpunk 
wrote:
> I get this error (plus many others that are basically the same) when
> trying to view CakePHP onhttp://localhost/cake/
>
> Deprecated: Assigning the return value of new by reference is
> deprecated in C:\xampp\htdocs\cake\cake\libs\file.php on line 96
>
> I look at the url in the address bar and it ishttp://localhost:8080/cake/
>
> Can anyone help me fix this so I can get Cake working?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Edit function not working properly it always returns ID=(1)

2009-08-24 Thread DavidH

I guess there's some relationship between Tasks Projects and Statuses
because the SQL you're reproduced here shows what's being selected
from the related models not from the statuses model. Does anything get
selected from statuses at all?

What does your statuses model look like?

Do the underlying tables have conventional structures, I.e. id for the
primary key and table_id for the foreign keys?

David

On Aug 24, 3:56 pm, Vijay Pandey  wrote:
> Hi !
>
> I have a little problem with edit function...I have developed a small
> application to manage projects. Every project has a status...there are
> totoal 5 statuses..I want to change the name of 5th status but I can
> not do it...no matter which "status" I select to "edit" it always
> displays status 1 for editing...
>
> Here is the url
>
> localhost/myapp/statuses/edit/4
>
> and here is what it did:
>
> SELECT `Project`.`id`, `Project`.`name`, `Project`.`description`,
> `Project`.`status_id`, `Project`.`created`, `Project`.`modified` FROM
> `projects` AS `Project` WHERE `Project`.`status_id` = (1)
>
> SELECT `Task`.`id`, `Task`.`project_id`, `Task`.`name`,
> `Task`.`description`, `Task`.`status_id`, `Task`.`created`,
> `Task`.`modified` FROM `tasks` AS `Task` WHERE `Task`.`status_id` =
> (1)
>
> (i got this beacuse I have kept debug variable on )
>
> What to do? this problem is only with "ststuses" only...all other
> edits are working fine...
>
> Here are other information
>
> statuses_controller.php
>
> function edit($id = null) {
>                 if (!$id && empty($this->data)) {
>                         $this->Session->setFlash(__('Invalid Status', true));
>                         $this->redirect(array('action'=>'index'));
>                 }
>                 if (!empty($this->data)) {
>                         if ($this->Status->save($this->data)) {
>                                 $this->Session->setFlash(__('The Status has 
> been saved', true));
>                                 $this->redirect(array('action'=>'index'));
>                         } else {
>                                 $this->Session->setFlash(__('The Status could 
> not be saved.
> Please, try again.', true));
>                         }
>                 }
>                 if (empty($this->data)) {
>                         $this->data = $this->Status->read(null,$id);
>                 }
>         }
>
> edit.ctp    file
>
> create('Status');?>
>         
>                 
>                          echo $form->input('id');
>                 echo $form->input('name');
>         ?>
>         
> end('Submit');?>
>
> default.ctp file
>
> 
>         
>                 
>
>                         flash(); ?>
>
>                         
>
>                 
>                 
>
>                 
>         
>         
> 
>
> Please enlighten me why this strange thing is happening...
>
> regards,
>
> Vijai
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Edit function not working properly it always returns ID=(1)

2009-08-24 Thread Vijay Pandey

Hi !

I have a little problem with edit function...I have developed a small
application to manage projects. Every project has a status...there are
totoal 5 statuses..I want to change the name of 5th status but I can
not do it...no matter which "status" I select to "edit" it always
displays status 1 for editing...

Here is the url

localhost/myapp/statuses/edit/4

and here is what it did:

SELECT `Project`.`id`, `Project`.`name`, `Project`.`description`,
`Project`.`status_id`, `Project`.`created`, `Project`.`modified` FROM
`projects` AS `Project` WHERE `Project`.`status_id` = (1)

SELECT `Task`.`id`, `Task`.`project_id`, `Task`.`name`,
`Task`.`description`, `Task`.`status_id`, `Task`.`created`,
`Task`.`modified` FROM `tasks` AS `Task` WHERE `Task`.`status_id` =
(1)

(i got this beacuse I have kept debug variable on )

What to do? this problem is only with "ststuses" only...all other
edits are working fine...

Here are other information

statuses_controller.php

function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid Status', true));
$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
if ($this->Status->save($this->data)) {
$this->Session->setFlash(__('The Status has 
been saved', true));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The Status could 
not be saved.
Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Status->read(null,$id);
}
}



edit.ctpfile

create('Status');?>


input('id');
echo $form->input('name');
?>

end('Submit');?>


default.ctp file





flash(); ?>












Please enlighten me why this strange thing is happening...

regards,

Vijai


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Certain strings crashing CakePHP - where do I look first?

2009-08-24 Thread Brendon Kozlowski (Realm)

My apologies, Chris.  I didn't click on the "newer" link at the bottom
of the Google Group topic to see it had been resolved prior to sending
my last email.  Like I said in my direct email reply though, I am glad
you got everything working as it should be.

It's possible (and completely plausible) that your host had disabled
the ability for users to disable mod_security2 via htaccess.  This may
not be the case for everyone though, so it's still a viable option to
try first.  :)


On Aug 24, 10:05 am, Chris P  wrote:
> Hi Brendon
>
> Thank you SO much for helping me out with this - it was indeed a server
> issue - mod_security2 is the culprit and after a brief battle they
> agreed to turn it off.
>
> As mentioned on the weekend, I couldn't have ascertained this without
> your and everyone else's help to rule out my code and cake, and
> establish that the server was a feasible culprit.
>
> Thanks *hugely*,
> Chris
>
>
>
> Brendon Kozlowski (Realm) wrote:
> > I've been thinking about this over the weekend, and...to be honest, if
> > it's a server issue (you're testing with the same version of CakePHP
> > on both your development machine, and production server, right?), I
> > think you're probably going to have to resolve this with your host.
>
> > To see what options are available/running on your host within PHP, you
> > can use the phpinfo() function.  You simply run that on a page all of
> > its own and view the output (both production and development) and
> > compare the two results to see what might be different (other than
> > paths and Operating Systems).
>
> >  >     phpinfo();
> > ?>
>
> > On Aug 21, 7:57 pm, technicaltitch  wrote:
>
> >> You are such stars for helping me with this - its incredible thank you
> >> so much!
>
> >> I tried the new redirect method but got errors (missing arguments for
> >> AppController::redirect(), $status and $exit undefined) when I tried
> >> to log in, as this involved a redirect to the login form, so I logged
> >> in and then copied across the redirect override - to no avail - when I
> >> save the changes it redirects to the homepage, which contains no hint
> >> of the error. Also got the site working locally (was my PHP version
> >> thanks so much AD7six) - and can't repeat the defect. Do these point
> >> to Apache or PHP as the cause?
>
> >> I tried disabling mod_security using:
> >> 
> >>         SecFilterEngine Off
> >>         SecFilterScanPOST Off
> >> 
> >> in every .htaccess file in my site, but it didn't make any difference
> >> (I sanitize everything, and it can't be this as it doesn't happen
> >> locally - unless it could be that local is Windows and host is Linux -
> >> seems very unlikely).
>
> >> I'd really appreciate any tips if anything's obvious about resolving
> >> the redirect override - or does the fact that it works locally mean
> >> this is unlikely to reveal anything?
>
> >> Tried creating a test subdirectory but suspected it wouldn't work - I
> >> get a 500 error probably related to my non-standard directory layout
> >> (so that my cake and app directories are outside my public_html
> >> directory - seemed safer).
>
> >> My reason for another site is in case the forum software has somehow
> >> added this filtering site-wide - it seems to be a server setting, (its
> >> only $11). I do get this error when I try the text in any table in the
> >> system (including tables that are nothing to do with tinyMCE and very
> >> little to do with the rest of the code). Will try baking an unrelated
> >> table to see if I can repeat it there but I very much expect to as it
> >> seems platform related.
>
> >> As far as I can tell, I don't have access to PHP settings - just
> >> CPanel on a shared hosting platform.
>
> >> Am I right in suspecting Apache or PHP? If so any ideas where I can
> >> look? I can't find anything likely by googling filters for either.
> >> Does Cake automatically use certain PHP filters on all POST and GET
> >> submissions or something?
>
> >> Thanks HUGELY, I'll be so incredibly happy when I/we crack this
> >> Chris/tt
>
> >> On Aug 18, 5:11 pm, "Brendon Kozlowski (Realm)"
>
> >>  wrote:
>
> >>> I like archF6's suggestion, it's easy to test, and if it doesn't solve
> >>> it, continue from there.  It might work, it might not.  I don't think
> >>> a 500 server error would automatically redirect (but instead stop
> >>> execution).  Regardless, it's about a 20 second test.  With Dreamhost
> >>> I can enable/disable mod_security, I'm not sure if you would be able
> >>> to test that on your host or not.  To be clear - I don't know why
> >>> mod_security would mess with this, but it can't hurt to take a look if
> >>> you're able to make such changes.
>
> >>> On Aug 17, 11:23 am, technicaltitch  wrote:
>
>  App was built Oct 2007 but it's taken the organization this long to
>  find funding for someone to test and work on it, (hence I'm struggling
>  to get my head round stuff again).
>
>  I will have a go at creating a test s

Re: Timing an AJAX effect

2009-08-24 Thread MattyHead

If you want to try to be as consistent as possible on the feel, time
the call and subtract it from your fake delay...  Drop delay if
calltime exceeds delay.

On Mon, Aug 24, 2009 at 9:46 AM, Brendon Kozlowski
(Realm) wrote:
>
> It is an ironic time when developers ask for a way to SLOW the
> response time.  If the user interaction interface you have chosen is
> not the most appropriate, perhaps a different route would be more
> desirable, such as flashing the background color once the action
> completes, or flashing a "completed" text somewhere.  Keep in mind
> that some people might be using a Satellite, or slow DSL connection
> (or, *gasp*, a telephone line!) to connect to your website, so it
> won't be as blazingly fast for them.
>
> If you still want to do what you're looking for, you might want to use
> a timer, in cooperation with something like this:
> http://www.sean.co.uk/a/webdesign/javascriptdelay.shtm
>
> On Aug 22, 9:43 am, Shaun  wrote:
>> I have a star rating system.  After a user clicks on a star, the
>> database is updated with the user's rating.  However, the processing
>> time is rather fast and ajax-loader.gif is displayed for less than a
>> second.  Is there a way to force a delay before $options['complete']
>> is called?
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: One app & db, many domains - what is the right mix?

2009-08-24 Thread Martin Westin

Did you check the bakery?
I think I remember seeing something like that in some article a while
back.

/Martin

On Aug 24, 3:38 pm, jonoa  wrote:
> Hello all
>
> Big thanks to all the people who contribute to CakePHP - has certainly
> put some structure in to my development and I'll be donating as soon
> as I can monetize what I'm working on. :)
>
> I'm writing an app at the moment - basically it will allow the user to
> login, fill out some forms and basically spit out a pre-fabricated
> website complete with a registered domain.
>
> The interface for the user to login and submit the content for the
> site and register domains etc is done, the content to be used for the
> user-generated website is spread across a few models. I've built a
> controller (web) and appropriate views (about, contact) to make this
> data available. The website is also themed using native cake
> functionality allowing users to pick from a bunch of different themes.
>
> My question is this - how can I present the newly generated website
> and maintain the domain it was registered with? i.e. I can easily make
> my themed website available using /web/about/id:1 and /web/contact/id:
> 1 - but I need to make it accessible through mydomain.com/about and
> mydomain.com/contact. Similarly /web/about/id:2 and /web/contact/id:2
> would be accessible through myotherdomain.com/about and
> myotherdomain.com/contact.
>
> So the workflow is something like this..
>
> 1. User logs into corpsite.com
>
> 2. User enters content information into, essentially a CMS and a
> domain is registered for the user-site in the backend (i.e.
> mydomain.com)
>
> 3. Domain is configured in DNS and Apache to point at the corpsite.com
> cake application
>
> 4. Anyone who visits mydomain.com/about or mydomain.com/contact is
> essentially seeing a view rendered by corpsite.com/web/about/id:1 or
> corpsite.com/web/contact/id:1
>
> The tricky part is ensuring the URL for anyone visiting is the same as
> the domain that was registered.
>
> I'd like to keep everything as one app - I'm not sure if this is
> something I should be tackling in cake (I looked at routes - but I
> don't think it can match on hostname? In any case, if there was
> several hundred of these sites, would surely degrade performance too
> much). I'm thinking that mod_rewrite will definitely be involved
> somehow. Apache I'm pretty sure I can just use a wildcard virtual host
> and point it at the same app directory.
>
> I considered having the app write out a new directory structure and
> copy views etc over for each site, but I think that is not going to be
> maintainable.
>
> I think I have the various pieces - just not sure how to architect
> them. The fact that my cake app has knowledge of the relationship
> between the domain and the model for the content makes me think I can
> do this in cake. Scaling out to potentially hundreds of domains needs
> to be kept in mind.
>
> I'm not sure if this makes sense - any advice is greatly appreciated.
>
> Kind Regards
>
> Jon
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ajax-form/form-create vs ajax-submit/form-end

2009-08-24 Thread Marcelo Andrade

Hi there,

I have an form that works well.  But as I've created a
component that write to a PDF file, the submit request
could take a long time to complete.  So, I'd like to convert
the normal submit to an AJAX one.

I can do it using the $ajax->submit and passing the
adequate value to the options array.  But I think it's not an
elegant solution as the $form->create is refering to the
main action and I have to make a second reference to the
action in the 'url' param of $ajax->submit.

So what's the right way of submitting a form with AJAX?
I mean without replicate the form action to the ajax url
options?  And can't I use the $ajax->form normally with
a $form->end?

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.com

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Find all

2009-08-24 Thread cakephp_rocks

figured it out thank you all

$questions = $this->Question->find('all', array('conditions' => array
('AND' => array('OR' => array('Question.tip' => 'yes'),'NOT'=> array
('Question.active' => '0');




On Aug 24, 7:15 am, cakephp_rocks  wrote:
> how to do this complex find with this table
>
> id
> question
> answer
> tip= 0/1 default is  0
> active = 0/1  default is 0
>
> so what i want to do is if its tip= 1  it should show tip or if its
> tip = 0 its show the question
>
> it should not show if its active = 0
>
> thanks
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Connecting to ORACLE Database !

2009-08-24 Thread Xanax

Hello,

I've been developing my cakephp application with MySQL sor far and now
i must migrate the database to an oracle one.

I've created an oracle database and import the tables, everything
wrked fine.
Here an extract of the tsnames.ora entry concerning this databse :

 ORACLE_DPRO =
  (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.50.114.21)(PORT = 1521))
(CONNECT_DATA = (SERVICE_NAME = DPRO11))
  )

In my databse.php, i've set up this :

var $default = array(
'driver' => 'oracle',
'persistent' => false,
'host' => '10.50.114.21',
'login' => 'AZIZM',
'password' => 'AZIZM',
'database' => 'DPRO11',
'encoding' => 'UTF-8',
'prefix' => '',
);

Whe i go to the test, cakephp show that the databse config gile is
present and then nothing else, i think it bugs when he try to verify
the connection... :

Release Notes for CakePHP 1.2.1.8004.
Read the changelog

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 present.


Do you have any idea of what should be the problem ? Thanks in
advande, me i have no clue...


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



One app & db, many domains - what is the right mix?

2009-08-24 Thread jonoa

Hello all

Big thanks to all the people who contribute to CakePHP - has certainly
put some structure in to my development and I'll be donating as soon
as I can monetize what I'm working on. :)

I'm writing an app at the moment - basically it will allow the user to
login, fill out some forms and basically spit out a pre-fabricated
website complete with a registered domain.

The interface for the user to login and submit the content for the
site and register domains etc is done, the content to be used for the
user-generated website is spread across a few models. I've built a
controller (web) and appropriate views (about, contact) to make this
data available. The website is also themed using native cake
functionality allowing users to pick from a bunch of different themes.

My question is this - how can I present the newly generated website
and maintain the domain it was registered with? i.e. I can easily make
my themed website available using /web/about/id:1 and /web/contact/id:
1 - but I need to make it accessible through mydomain.com/about and
mydomain.com/contact. Similarly /web/about/id:2 and /web/contact/id:2
would be accessible through myotherdomain.com/about and
myotherdomain.com/contact.

So the workflow is something like this..

1. User logs into corpsite.com

2. User enters content information into, essentially a CMS and a
domain is registered for the user-site in the backend (i.e.
mydomain.com)

3. Domain is configured in DNS and Apache to point at the corpsite.com
cake application

4. Anyone who visits mydomain.com/about or mydomain.com/contact is
essentially seeing a view rendered by corpsite.com/web/about/id:1 or
corpsite.com/web/contact/id:1

The tricky part is ensuring the URL for anyone visiting is the same as
the domain that was registered.

I'd like to keep everything as one app - I'm not sure if this is
something I should be tackling in cake (I looked at routes - but I
don't think it can match on hostname? In any case, if there was
several hundred of these sites, would surely degrade performance too
much). I'm thinking that mod_rewrite will definitely be involved
somehow. Apache I'm pretty sure I can just use a wildcard virtual host
and point it at the same app directory.

I considered having the app write out a new directory structure and
copy views etc over for each site, but I think that is not going to be
maintainable.

I think I have the various pieces - just not sure how to architect
them. The fact that my cake app has knowledge of the relationship
between the domain and the model for the content makes me think I can
do this in cake. Scaling out to potentially hundreds of domains needs
to be kept in mind.

I'm not sure if this makes sense - any advice is greatly appreciated.

Kind Regards

Jon

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Fulltext Index with schema console

2009-08-24 Thread miceno

I also has this problem,

The issue is that "schema generate" does not create valid MySQL syntax
to create the appropriate tables.

I know how to generate the right MySQL syntax, but I would like to
know how to automatically generate a valid CakePHP file schema. Or is
it a bug of "schema generate"? I googled but I didn't find anything
like this ;(

Regards.

On Aug 19, 9:54 am, PaSToReT  wrote:
> If you read my post, I said:
>
>      I know that it is because of the key length is not specified in
> the
>      schema.php, but I don't know how to do it.
>
> Of course, I have searched before. I know how to solve this problem in
> mysql (adding the key length when you define the index), but I would
> like to have a good executable schema.php for my migrations, and i
> don't know how to add this parameter to it.
>
> May be I'm not explaining so well... sorry... :(
>
> Thank you anyway!
>
> On Aug 18, 8:17 pm, brian  wrote:
>
>
>
> > This is a MySQL issue. Did you search 
> > first?http://www.google.ca/search?q=used+in+key+specification+without+a+key...
>
> > On Tue, Aug 18, 2009 at 12:05 PM, PaSToReT wrote:
>
> > > Hi!
>
> > > I have this table in mysql:
>
> > > CREATE TABLE `search_index` (
> > >  `id` int(11) NOT NULL auto_increment,
> > >  `association_key` varchar(36) collate utf8_unicode_ci NOT NULL,
> > >  `model` varchar(128) collate utf8_unicode_ci NOT NULL,
> > >  `data` longtext collate utf8_unicode_ci NOT NULL,
> > >  `created` datetime NOT NULL,
> > >  `modified` datetime NOT NULL,
> > >  PRIMARY KEY  (`id`),
> > >  KEY `association_key` (`association_key`,`model`),
> > >  FULLTEXTKEY `data` (`data`)
> > > ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8
> > > COLLATE=utf8_unicode_ci;
>
> > > I have generated a schema.php with 'cake schema generate'.
> > > When I try to execute it ('cake schema run create') i get this error.
>
> > > search_index: 1170: BLOB/TEXT column 'data' used in key specification
> > > without a key length
>
> > > I know that it is because of the key length is not specified in the
> > > schema.php, but I don't know how to do it.
>
> > > Could anyone help me?
>
> > > Thanks a lot!

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



class Overloadable2

2009-08-24 Thread Biaggi

I've been looking for a use of this class but i cant find any
changeset or documentation about the need of that class or what the
class resolves.

The main diference between class Overloadable and Overloadable2 are
the __get and __set functions, this functions appears in commit [3957]
and seems to be fully deprecated.

So, someone knows why the class Overloadable2 appears in the
Overloadable_php4.php and Overloadable_php5.php files.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Translate behavior and relation models

2009-08-24 Thread silentwf

Hi everyone
I'm trying to get CakePHP to translate stuff for me, and I recently
followed the book on the Translate behavior and all is working fine...
kind of.
I have a model (lets say 'UserProfile') that $actsAs Translate. The
UserProfile model belongsTo a User model, and User  hasOne
UserProfile. The problem arises when I try to use $UserProfile->find()
or $UserProfile->paginate(). CakePHP tells me that it's missing the
table User, even though it exists.

I googled it up and came across something similar (https://
trac.cakephp.org/ticket/5593), but the only difference is the author
uses a $recursive = -1, but I want the relations to be established.
(Like in my result array, I dont just want a 'UserProfile' but also a
'User') Is there any solution to this?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



CakePHP Install Issue

2009-08-24 Thread Lostprophetpunk

I get this error (plus many others that are basically the same) when
trying to view CakePHP on http://localhost/cake/

Deprecated: Assigning the return value of new by reference is
deprecated in C:\xampp\htdocs\cake\cake\libs\file.php on line 96

I look at the url in the address bar and it is http://localhost:8080/cake/

Can anyone help me fix this so I can get Cake working?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Changing datasource or database of a model during runtime

2009-08-24 Thread Marco Pietschmann

Hi,

got the following problem.

Need to combine several tables from different datasources that are
associated to each other. So far so good.

But I've got the following problem:
The data retreived from the default database defines which datasource
should be used.

Example:

Project belongsTo Customer belongsTo Address belongsTo Country
Project hasMany Invoices

The Invoices are stored in different databases depending on the
Customers country.

I tried different things with changing the datasource of the invoice
model, but since I set it with beforeFind the change only effects the
next query, not the current one and I had to start additional queries.

Since also a list of projects on one view is needed I need a solution
that changes the datasource easily during runtime, not only once at
the beginning of the lifecycle. I need a possibility to change the
models datasource after loading the default data and before the data
of the associated model is loaded.

Any ideas?

Thanks a lot,
Marco

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Data Validation

2009-08-24 Thread Juan Jose Marquez





I have a small problem with the validation of some fields in a model 
The particular problem is that the system validates the data if the
model 
but I painted the error messages in sight and it is not 
possible and have tried some things but nothing and I'm desperate. 

This is the code I have

  
    VISTA 
        echo $form->create('usuariosaplicacion',array('url' => 
'/clientes/add_acceso_aplicacion'))."\n"; 
        echo "\n"; 
        echo "Aplicación\n"; 
        echo $form->input('usuariosaplicacion.id_aplicacion',   
array('label'=>false,'div'=>false,'empty'=>true,'options'=>$lista_aplicaciones))."\n";
  
        echo "\n"; 
        echo $form->input('sm_precio_sms',  array('label'=>Precio
  
SMS,'size' => '5','maxlength'=>'4','div'=>false))."\n"; 
        echo $form->input('usuariosaplicacion.id_usuario', 
array('type'=>'hidden', 'value' => $id_cliente)); 
        echo $form->end('Submit'); 
  
      MODELO 
       var $validate = array(   
         'id_aplicacion'   => array( 
           'required' => array('rule' =>
array('notEmpty'),'message' => 
'Debe Seleccionar una aplicación') 
      ) 
    ); 
  
     
CONTROLADOR
  
  
      if
(!empty($this->data)) { 
            if ($this->usuariosaplicacion->save($this->data))
{ 
                $this->Session->setFlash(__('Se ha añadido el
acceso a 
esta aplicacion correctamente', true)); 
                //$this->redirect(array('action'=>'index')); 
            } else { 
                $this->Session->setFlash(__('No se ha podido dar
el 
acceso a esta aplicacion.', true)); 
            } 
        } 

Do not know if this table will have something to do with this table is
the table MIDDLE HABT a Relationship. 

A greeting and thank you very much 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---





Re: Timing an AJAX effect

2009-08-24 Thread Brendon Kozlowski (Realm)

It is an ironic time when developers ask for a way to SLOW the
response time.  If the user interaction interface you have chosen is
not the most appropriate, perhaps a different route would be more
desirable, such as flashing the background color once the action
completes, or flashing a "completed" text somewhere.  Keep in mind
that some people might be using a Satellite, or slow DSL connection
(or, *gasp*, a telephone line!) to connect to your website, so it
won't be as blazingly fast for them.

If you still want to do what you're looking for, you might want to use
a timer, in cooperation with something like this:
http://www.sean.co.uk/a/webdesign/javascriptdelay.shtm

On Aug 22, 9:43 am, Shaun  wrote:
> I have a star rating system.  After a user clicks on a star, the
> database is updated with the user's rating.  However, the processing
> time is rather fast and ajax-loader.gif is displayed for less than a
> second.  Is there a way to force a delay before $options['complete']
> is called?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Find all

2009-08-24 Thread cakephp_rocks

how to do this complex find with this table



id
question
answer
tip= 0/1 default is  0
active = 0/1  default is 0

so what i want to do is if its tip= 1  it should show tip or if its
tip = 0 its show the question

it should not show if its active = 0


thanks
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



HABTM not saving

2009-08-24 Thread Bryan Paddock
Hey all,
Ok I'm pulling my hair out here.

HABTM save/edit/removes are not happening.

I have two models. Channel and Area. The model definitions are configured
properly (channel: *var $hasAndBelongsToMany = array( 'Area' )* and area: *var
$hasAndBelongsToMany = array( 'Channel' )* )

I have no clue why this is not working because I am not getting any error
messages back from cake at all.

I am calling validates() before save() and it validates but it does not
save.

I am trying to save this array

$data =

Array
(
[Channel] => Array
(
[id] => 16
)

[Area] => Array
(
[0] => Array
(
[id] => 14
)

)

)

I have tried saving this too

Array
(
[Channel] => Array
(
[id] => 16
)

[Area] => Array
(
[0] => 14
)

)

Is there something I am doing incorrectly? When I push debug level up
to 3 I can see cake is not even trying to do any of the habtm queries.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: How to save a record but not clear an empty field?

2009-08-24 Thread gedm

delocalizer and Dr. Loboto,

It works a treat.

In the controller after fetching the data I unset the password field.
The password then comes up blank in the edit form.

I then entered the beforeValidate function, you gave me, in the model
and it works perfectly.

Thanks for your help.


On Aug 24, 3:23 pm, delocalizer  wrote:
> Yes nice, I hadn't though of that. So you would test for:
> if (isset($this->data['User]]['password']) && $this->data['User']
> ['password'] == Security::hash(Configure::read('Security.salt')))
>
> On Aug 24, 1:27 pm, "Dr. Loboto"  wrote:
>
> > > If you do this you'll have to hash your own password rather than let
> > > Auth do it automatically, because Auth will hash a blank password and
> > > the 'if' condition will never be true.
>
> > If do not touch Auth hashing behavior password field can be checked
> > not as "notBlank" but by comparison with hashed empty string.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Certain strings crashing CakePHP - where do I look first?

2009-08-24 Thread Chris P
Hi Brendon

Thank you SO much for helping me out with this - it was indeed a server 
issue - mod_security2 is the culprit and after a brief battle they 
agreed to turn it off.

As mentioned on the weekend, I couldn't have ascertained this without 
your and everyone else's help to rule out my code and cake, and 
establish that the server was a feasible culprit.

Thanks *hugely*,
Chris


Brendon Kozlowski (Realm) wrote:
> I've been thinking about this over the weekend, and...to be honest, if
> it's a server issue (you're testing with the same version of CakePHP
> on both your development machine, and production server, right?), I
> think you're probably going to have to resolve this with your host.
>
> To see what options are available/running on your host within PHP, you
> can use the phpinfo() function.  You simply run that on a page all of
> its own and view the output (both production and development) and
> compare the two results to see what might be different (other than
> paths and Operating Systems).
>
>  phpinfo();
> ?>
>
> On Aug 21, 7:57 pm, technicaltitch  wrote:
>   
>> You are such stars for helping me with this - its incredible thank you
>> so much!
>>
>> I tried the new redirect method but got errors (missing arguments for
>> AppController::redirect(), $status and $exit undefined) when I tried
>> to log in, as this involved a redirect to the login form, so I logged
>> in and then copied across the redirect override - to no avail - when I
>> save the changes it redirects to the homepage, which contains no hint
>> of the error. Also got the site working locally (was my PHP version
>> thanks so much AD7six) - and can't repeat the defect. Do these point
>> to Apache or PHP as the cause?
>>
>> I tried disabling mod_security using:
>> 
>> SecFilterEngine Off
>> SecFilterScanPOST Off
>> 
>> in every .htaccess file in my site, but it didn't make any difference
>> (I sanitize everything, and it can't be this as it doesn't happen
>> locally - unless it could be that local is Windows and host is Linux -
>> seems very unlikely).
>>
>> I'd really appreciate any tips if anything's obvious about resolving
>> the redirect override - or does the fact that it works locally mean
>> this is unlikely to reveal anything?
>>
>> Tried creating a test subdirectory but suspected it wouldn't work - I
>> get a 500 error probably related to my non-standard directory layout
>> (so that my cake and app directories are outside my public_html
>> directory - seemed safer).
>>
>> My reason for another site is in case the forum software has somehow
>> added this filtering site-wide - it seems to be a server setting, (its
>> only $11). I do get this error when I try the text in any table in the
>> system (including tables that are nothing to do with tinyMCE and very
>> little to do with the rest of the code). Will try baking an unrelated
>> table to see if I can repeat it there but I very much expect to as it
>> seems platform related.
>>
>> As far as I can tell, I don't have access to PHP settings - just
>> CPanel on a shared hosting platform.
>>
>> Am I right in suspecting Apache or PHP? If so any ideas where I can
>> look? I can't find anything likely by googling filters for either.
>> Does Cake automatically use certain PHP filters on all POST and GET
>> submissions or something?
>>
>> Thanks HUGELY, I'll be so incredibly happy when I/we crack this
>> Chris/tt
>>
>> On Aug 18, 5:11 pm, "Brendon Kozlowski (Realm)"
>>
>>
>>
>>  wrote:
>> 
>>> I like archF6's suggestion, it's easy to test, and if it doesn't solve
>>> it, continue from there.  It might work, it might not.  I don't think
>>> a 500 server error would automatically redirect (but instead stop
>>> execution).  Regardless, it's about a 20 second test.  With Dreamhost
>>> I can enable/disable mod_security, I'm not sure if you would be able
>>> to test that on your host or not.  To be clear - I don't know why
>>> mod_security would mess with this, but it can't hurt to take a look if
>>> you're able to make such changes.
>>>   
>>> On Aug 17, 11:23 am, technicaltitch  wrote:
>>>   
 App was built Oct 2007 but it's taken the organization this long to
 find funding for someone to test and work on it, (hence I'm struggling
 to get my head round stuff again).
 
 I will have a go at creating a test subdirectory and adding that debug
 code- fantastic fantastic ideas thanks - probably blindingly obvious
 to PHPers but not to me (a decade working with C, Java and .NET but
 only ever used PHP on volunteer projects).
 
 Is it possible that a phpBB install may have had this as a side-
 effect? Ie, can filters be set up on all form input for a given space
 on a shared CPanel server?
 
 I have commented out my controller method and seen the error, so I'm
 assuming the redirect is called elsewhere, where do I put the redirect
 override code pls?
 
 As

Re: logged in users list

2009-08-24 Thread Brendon Kozlowski (Realm)

Would a JavaScript/AJAX onunload event (or similar for navigation away
from current domain) called to a user/logout achieve the same result?

On Aug 24, 7:29 am, Junaed Halim  wrote:
> Thank you all for your advices. I am gonna apply them in my project.
>
>
>
> On Mon, Aug 24, 2009 at 6:15 PM, Dr. Loboto  wrote:
>
> > You _cannot_ know for sure is user logged in or not. That's why
> > "last_activity_time" column is used (not "last_login_time") and
> > updated on each user page request. And you just set user period of
> > inactivity value for yourself and query for all users which have
> > last_activity_time > now - inactivity period. As longer inactivity
> > period you take as more users you receive that already leaved site and
> > as shorter inactivity period you set as more users you do _not_
> > receive but they did not leave site yet.
>
> > On Aug 24, 11:42 am, Junaed Halim  wrote:
> > > Thank you all for your reply. I'll get the logged-in users by adding a
> > > datetime column and updating it.
> > > But how would I know whether someone has logged out or not?
> > > They can simply close the browser without logging out themselves.
> > > Am I missing something?
>
> > > On Mon, Aug 24, 2009 at 8:50 AM, Miles J 
> > wrote:
>
> > > > You would need a datetime column named "lastLoginTime" or something
> > > > equivalent.
>
> > > > Then you would update that with the current timestamp each login.
>
> > > > Then you would find all users that have logged in within the past x
> > > > minutes.
>
> > > --
> > > Junaed Bin Halim- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Certain strings crashing CakePHP - where do I look first?

2009-08-24 Thread Brendon Kozlowski (Realm)

I've been thinking about this over the weekend, and...to be honest, if
it's a server issue (you're testing with the same version of CakePHP
on both your development machine, and production server, right?), I
think you're probably going to have to resolve this with your host.

To see what options are available/running on your host within PHP, you
can use the phpinfo() function.  You simply run that on a page all of
its own and view the output (both production and development) and
compare the two results to see what might be different (other than
paths and Operating Systems).



On Aug 21, 7:57 pm, technicaltitch  wrote:
> You are such stars for helping me with this - its incredible thank you
> so much!
>
> I tried the new redirect method but got errors (missing arguments for
> AppController::redirect(), $status and $exit undefined) when I tried
> to log in, as this involved a redirect to the login form, so I logged
> in and then copied across the redirect override - to no avail - when I
> save the changes it redirects to the homepage, which contains no hint
> of the error. Also got the site working locally (was my PHP version
> thanks so much AD7six) - and can't repeat the defect. Do these point
> to Apache or PHP as the cause?
>
> I tried disabling mod_security using:
> 
>         SecFilterEngine Off
>         SecFilterScanPOST Off
> 
> in every .htaccess file in my site, but it didn't make any difference
> (I sanitize everything, and it can't be this as it doesn't happen
> locally - unless it could be that local is Windows and host is Linux -
> seems very unlikely).
>
> I'd really appreciate any tips if anything's obvious about resolving
> the redirect override - or does the fact that it works locally mean
> this is unlikely to reveal anything?
>
> Tried creating a test subdirectory but suspected it wouldn't work - I
> get a 500 error probably related to my non-standard directory layout
> (so that my cake and app directories are outside my public_html
> directory - seemed safer).
>
> My reason for another site is in case the forum software has somehow
> added this filtering site-wide - it seems to be a server setting, (its
> only $11). I do get this error when I try the text in any table in the
> system (including tables that are nothing to do with tinyMCE and very
> little to do with the rest of the code). Will try baking an unrelated
> table to see if I can repeat it there but I very much expect to as it
> seems platform related.
>
> As far as I can tell, I don't have access to PHP settings - just
> CPanel on a shared hosting platform.
>
> Am I right in suspecting Apache or PHP? If so any ideas where I can
> look? I can't find anything likely by googling filters for either.
> Does Cake automatically use certain PHP filters on all POST and GET
> submissions or something?
>
> Thanks HUGELY, I'll be so incredibly happy when I/we crack this
> Chris/tt
>
> On Aug 18, 5:11 pm, "Brendon Kozlowski (Realm)"
>
>
>
>  wrote:
> > I like archF6's suggestion, it's easy to test, and if it doesn't solve
> > it, continue from there.  It might work, it might not.  I don't think
> > a 500 server error would automatically redirect (but instead stop
> > execution).  Regardless, it's about a 20 second test.  With Dreamhost
> > I can enable/disable mod_security, I'm not sure if you would be able
> > to test that on your host or not.  To be clear - I don't know why
> > mod_security would mess with this, but it can't hurt to take a look if
> > you're able to make such changes.
>
> > On Aug 17, 11:23 am, technicaltitch  wrote:
>
> > > App was built Oct 2007 but it's taken the organization this long to
> > > find funding for someone to test and work on it, (hence I'm struggling
> > > to get my head round stuff again).
>
> > > I will have a go at creating a test subdirectory and adding that debug
> > > code- fantastic fantastic ideas thanks - probably blindingly obvious
> > > to PHPers but not to me (a decade working with C, Java and .NET but
> > > only ever used PHP on volunteer projects).
>
> > > Is it possible that a phpBB install may have had this as a side-
> > > effect? Ie, can filters be set up on all form input for a given space
> > > on a shared CPanel server?
>
> > > I have commented out my controller method and seen the error, so I'm
> > > assuming the redirect is called elsewhere, where do I put the redirect
> > > override code pls?
>
> > > As far as I can tell it isn't my code requesting the redirect but
> > > perhaps I'm missing something obvious? I commented out my controller
> > > method, route.php just has the default page specified. Tried debug
> > > level 1 and 2 and nothing is displayed about the error, or anything
> > > preceding the current page.
>
> > > Thanks SO much for your help - this is all so useful and despite my
> > > wandering off-subject, absolutely exactly how I hoped people would
> > > help me and I'm massively grateful,
> > > Chris- Hide quoted text -
>
> - Show quoted text -
--~--~-~--

Configure::listObjects() and bootstrap.php

2009-08-24 Thread Pixelastic

Hello,

I have some code I would like to put in my bootstrap.php that needs
the Configure::listObjects() function. Unfortunately, this function
does not return anything when called from inside the bootstrap.php,
likely because bootstrap is called very very early.

I finally had to put my code in the routes.php file, because that's
the only place I found to get my code loaded as early as possible, but
it is quite an unusual place. And not a very clean way of organizing
things.

Do any of you know a cleaner way to this ?

(P.S : As the listObject() method is quite heavy, I DO cache results
of my custom function for further requests, but I need the first one -
cache empty- to occur before any model creation)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Please Help!! my password is always null!!!

2009-08-24 Thread Martin Westin

If you want to do it all yourself then just remove "Auth" from your
list of components.
Most likely you want to let AuthComponent help you out and in that
case there are numerous tutorials to choose from. You can always start
with the cookbook:
http://book.cakephp.org/view/172/Authentication

/Martin


On Aug 24, 9:06 am, liaogz82  wrote:
> so if i want to use authentication, how should i go about doing it?
>
> Gangzheng
>
> On Aug 24, 2:03 pm, Martin Westin  wrote:
>
>
>
> > My guess is that Auth component is doing it.
> > If you are doing your own authentication you have to remove Auth from
> > your list of components. And if you do want to use Auth ten you
> > shouldn't do any of the authenticating stuff yourself.
>
> > /Martin
>
> > On Aug 24, 6:50 am, liaogz82  wrote:
>
> > > Hi all,
>
> > > I dont know why but my password is always sent as null in $this->data,
> > > which causes it to be unable to retrieve data for comparison. The
> > > following below are my codes:
>
> > > login.ctp
> > > 
> > > Login
> > >     create('User', array
> > > ('controller'=>'users','action'=>'login'));?>
> > >         input('User.username');?>
> > >         input('User.password',array
> > > ('type'=>'password'));?>
> > >         submit('Login');?>
> > >     end(); ?>
> > >   > > ?>
>
> > > users_controller.php
> > >     function login()
> > >     {
> > >         $this->layout = 'login';
> > >         if(!empty($this->data))
> > >         {
> > >             $user = $this->User->validateLogin($this->data['User']);
> > >             if($user != '')
> > >             {
> > >                 $this->Session->write('User', $user);
> > >                 $this->Session->setFlash('You\'ve successfully logged
> > > in.');
> > >                 $this->redirect(array('controller'=>'subscribers',
> > > 'actions'=>'index'));
> > >             }
> > >             else
> > >             {
> > >                 $this->Session->setFlash(json_encode($this->data));
> > >                 $this->redirect(array
> > > ('controller'=>'users','actions'=>'login'));
> > >             }
> > >         }
> > >     }
>
> > >     function logout()
> > >     {
> > >         $this->Session->destroy('user');
> > >         $this->Session->setFlash('You\'ve successfully logged out.');
> > >         $this->redirect($this->Auth->logout());
> > >     }
>
> > > user.php
> > > class User extends AppModel {
>
> > >     var $name = 'User';
> > > //    var $actsAs = array('Acl' => array('requester'));
> > >     var $useDbConfig = 'tracksdb';
>
> > >     function parentNode() {
> > >     }
>
> > >     /* To get the login ID of staff
> > >     function getStaffID()
> > >     {
> > >         return "gangzheng";
> > >         /* to change. The ID should be gotten from session
> > >     }*/
>
> > >     //The Associations below have been created with all possible keys,
> > > those that are not needed can be removed
> > >     var $belongsTo = array(
> > >             'Group' => array('className' => 'Group',
> > >                                 'foreignKey' => 'group_id',
> > >                                 'conditions' => '',
> > >                                 'fields' => '',
> > >                                 'order' => '',
> > >                                 'counterCache' => ''),
> > >     );
>
> > >     var $hasMany = array(
> > >             'Login' => array('className' => 'Login',
> > >                                 'foreignKey' => 'user_id',
> > >                                 'conditions' => '',
> > >                                 'fields' => '',
> > >                                 'order' => '',
> > >                                 'limit' => '',
> > >                                 'offset' => '',
> > >                                 'dependent' => '',
> > >                                 'exclusive' => '',
> > >                                 'finderQuery' => '',
> > >                                 'counterQuery' => ''),
> > >     );
>
> > >     function validateLogin($data)
> > >     {
> > >         $user = $this->find(array('username' => $data['username'],
> > > 'password' => sha1($data['password'])), array('id', 'username'));
> > >         if(empty($user) == false)
> > >             return $user['User'];
> > >         return false;
> > >     }
>
> > > }
>
> > > The flash message kept showing {"User":
> > > {"username":"gangzheng","password":null}}. So i am not sure what is
> > > going on. the password field is always set to null no matter what i
> > > type into the password field. Please help. Thanks
>
> > > Gangzheng
--~--~-~--~~~---~--~~
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
-~--~~~~--~~---

Prefix for Internationalization

2009-08-24 Thread blablu

Hi,

I want to internationalize a cake website. My intention was to use
prefixes like
/eng/posts/index
/fra/posts/index
/deu/posts/index
to differentiate the languages for the user, search machines and the
app itself.

Whit the routing I do something like that:
Router::connect('/:language/posts/:action/*', array('controller' =>
'posts'), array('language' => '[a-z]{3}'));

This works fine. Now what I don't get to work is the url generating
with the html helper function. I tried to overwrite the url Method
with the AppHelper class, so that the current, selected language will
automtically added to the url to match the above url layout:

function url($url = null, $full = false) {

if(!is_array($url)) {
$urlString = $url;
unset($url);
$url[] = $urlString;
}

if(isset($this->params['language'])) {
$url['prefix'] = $this->params['language'];
} else {
$url['prefix'] = Configure::read('App.defaultLang');
}

$result = parent::url($url, $full);

return $result;
   }


I tried some other ideas with $url['bare'] = '/fra'.$urlString; but
nothing works properly.


Do you have any ideas?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: logged in users list

2009-08-24 Thread Junaed Halim
Thank you all for your advices. I am gonna apply them in my project.


On Mon, Aug 24, 2009 at 6:15 PM, Dr. Loboto  wrote:

>
> You _cannot_ know for sure is user logged in or not. That's why
> "last_activity_time" column is used (not "last_login_time") and
> updated on each user page request. And you just set user period of
> inactivity value for yourself and query for all users which have
> last_activity_time > now - inactivity period. As longer inactivity
> period you take as more users you receive that already leaved site and
> as shorter inactivity period you set as more users you do _not_
> receive but they did not leave site yet.
>
> On Aug 24, 11:42 am, Junaed Halim  wrote:
> > Thank you all for your reply. I'll get the logged-in users by adding a
> > datetime column and updating it.
> > But how would I know whether someone has logged out or not?
> > They can simply close the browser without logging out themselves.
> > Am I missing something?
> >
> > On Mon, Aug 24, 2009 at 8:50 AM, Miles J 
> wrote:
> >
> > > You would need a datetime column named "lastLoginTime" or something
> > > equivalent.
> >
> > > Then you would update that with the current timestamp each login.
> >
> > > Then you would find all users that have logged in within the past x
> > > minutes.
> >
> > --
> > Junaed Bin Halim
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: logged in users list

2009-08-24 Thread Dr. Loboto

You _cannot_ know for sure is user logged in or not. That's why
"last_activity_time" column is used (not "last_login_time") and
updated on each user page request. And you just set user period of
inactivity value for yourself and query for all users which have
last_activity_time > now - inactivity period. As longer inactivity
period you take as more users you receive that already leaved site and
as shorter inactivity period you set as more users you do _not_
receive but they did not leave site yet.

On Aug 24, 11:42 am, Junaed Halim  wrote:
> Thank you all for your reply. I'll get the logged-in users by adding a
> datetime column and updating it.
> But how would I know whether someone has logged out or not?
> They can simply close the browser without logging out themselves.
> Am I missing something?
>
> On Mon, Aug 24, 2009 at 8:50 AM, Miles J  wrote:
>
> > You would need a datetime column named "lastLoginTime" or something
> > equivalent.
>
> > Then you would update that with the current timestamp each login.
>
> > Then you would find all users that have logged in within the past x
> > minutes.
>
> --
> Junaed Bin Halim
> Member, R & D Group
> Commlink Info Tech Ltd.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Export to Excel

2009-08-24 Thread Braindead

There are at least 2 articles in the bakery that describe how to
create a real Excel file (no csv):

http://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-from-your-database
http://bakery.cakephp.org/articles/view/excel-xls-helper

Personally I use the second one and it works quite good.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Announcing CakeXT: Bind CakePHP and ExtJS together

2009-08-24 Thread wirtsi

Hi ...

I have started a new project to bind CakePHP and ExtJS together. I've
been using CakePHP for the last few years and found that the further
you push your projects into the Web 2.0 / heavy Ajax domain, the more
difficult it gets to keep track of all the html / javascript
dependencies you need for your site to work.

ExtJs handles all this very nicely, it pushes ALL of the user
interface creation onto the browser ... so the V from MVC purely lives
on the client side. All the business logic like data validation is of
course still handled by Cake.

I've written a lengthy blog entry on how to use CakeXT (which consists
of a Cake Helper and an extended Ext class) including a demo of the
system. The cool part really is, that you don't need any further
configuration of Ext. Add a new field to your database and it will
automatically appear in your view.

The blog entry can be found at
http://blog.mykita.com/2009/08/introducing-cakext-create-slick-single-page-guis-with-cakephp-and-extjs/
and the project lives at http://cakext.mykita.com/trac.

Since this project is still very young I'd love to hear what you think
about it ... for sure there's plenty of room for improvements :)

Wirtsi
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



How to get admin to use the right login action

2009-08-24 Thread DavidH

Hi

I've been implementing an admin prefix route in my application because
I want only the admin user to be able to administer users and groups.

The admin prefix is enabled in core.php and I've created admin views
(admin_add.ctp, admin_edit.ctp etc) and the equivalent admin actions
in my controllers. All fine.

Where I've come unstuck is what happens if a user isn't logged in and
they try to access myapp/admin/users/add

What I want to happen is that they get redirected to the myapp/users/
login action/view; but what happens is (you've guessed it) they get
redirected to myapp/admin/users/login which doesn't exist.

I've tried all sorts of things to work around this; but nothing is
working for me. I've some before filters defined and these are:

1. In AppController

function beforeFilter() {
//Configure AuthComponent
// $this->Auth->authorize = 'actions';
// $this->Auth->loginAction = array('controller' => 'users',
'action' => 'login');
// $this->Auth->logoutRedirect = array('controller' =>
'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' =>
'dashboards', 'action' => 'showdashboard');

}

2. In my UserLevelsController (aka Groups)

function before_filter()
{
parent::before_filter();

// This was attempt to stop Auth doing it's own thing for this
controller
$this->Auth->autoRedirect = false;

// This was supposed to redirect to users/login without the
admin - admin => false
if (!$this->Auth->user())
{
$this->redirect(array('controller' => 'users', 'action' =>
'login', 'home', 'admin' => false));
}
}

The fact that none of this is working how I'd like makes me think I've
missed something essential somewhere. Can someone please point me in
the right direction?

Thanks

David
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: saveAll with a hasMany relationship

2009-08-24 Thread Luke

Hi Nancy,

I have a setup where I save the hasMany and HABTM in 1 go. It was a
bit tricky and took me aswell, I think 3 weeks (shame) to finally get
it sorted when I got the hint with the array setup.
It really is all about having the $this->data set up in the right
way.

I suppose you have a form where your data comes from, how do your
input fields are set up? What is the outcome of print_r($this->data)?

Luke
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: logged in users list

2009-08-24 Thread Miles J

Well you dont know if people log out. I guess you would have to save
sessions to a database or something, it can get quite complicated.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: sanitize and echoing in html

2009-08-24 Thread ezekfred

Vielen danke!

I didn't knew this "nl2br"!

here is my way to do (with sanitize...)

data)) {
   $this->data = Sanitize::clean($this->data);
   $this->Mydata->create();
   
 }

function edit($id = null) {
 if (!empty($this->data)) {
  $this->data = Sanitize::clean($this->data);
  if ($this->Mydata->save($this->data)) {
  
  }
 }

}
?>

and in my view template index.ctp


thanks again.

On Aug 21, 5:57 pm, "euromark (munich)" 
wrote:
> always the same^^
>
> no sanitizing neccessary
> just use h($var) in the view
>
> and for textareas
> nl2br(h($var))
>
> thats all
>
> On 21 Aug., 16:55, ezekfred  wrote:
>
> > Hello,
>
> > I'm having some issues with my views.
>
> > add.ctp: echo $form->input('theanswer');
> > view.ctp: echo $data['theanswer'];
>
> > in my database theanswer is a TEXT field
>
> > I just want to allow people make use of carriage return,
> > I want to display these CR in view.ctp and index.ctp
> > but I don't want them to write scripts like alert
> > ("EXPLETIVES!!!")
>
> > I've tried to sanitize::clean the input, to sanitize::html the output
> > but I'm unable to get an output like that:
> > "Line1
> > Line2
> > "
>
> > Has anyone an idea?
>
> > thanks for your help!
>
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: logged in users list

2009-08-24 Thread buzachis.a...@gmail.com

Hey,

I do the following thing to get all logged in users in my app:
- column lastActivity;
- in AppController, beforeRender I update that field with current
timestamp;
- then take from DB the users which did an action in the last 60
seconds or so (you choose a timeout).

(this is crappy I think, you do an update (on a possible large table -
depending on your app) each time an user does something; but it's the
most 'direct' solution... and classy also)


On Aug 24, 7:42 am, Junaed Halim  wrote:
> Thank you all for your reply. I'll get the logged-in users by adding a
> datetime column and updating it.
> But how would I know whether someone has logged out or not?
> They can simply close the browser without logging out themselves.
> Am I missing something?
>
> On Mon, Aug 24, 2009 at 8:50 AM, Miles J  wrote:
>
> > You would need a datetime column named "lastLoginTime" or something
> > equivalent.
>
> > Then you would update that with the current timestamp each login.
>
> > Then you would find all users that have logged in within the past x
> > minutes.
>
> --
> Junaed Bin Halim
> Member, R & D Group
> Commlink Info Tech Ltd.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Getting Xdebug to work under CakePHP 1.2 and NetBeans 6.5

2009-08-24 Thread Freight

Hi,

take a look here:
http://groups.google.ch/group/cake-php/browse_thread/thread/73bcf80a3d626c75

For me I have to set the webroot correct to the cake-webroot-dir in
project-properties.

Greetz

On 20 Jul., 20:16, MarcS  wrote:
> have you (or anyone else) figured this out?
>
> On Jun 15, 2:26 am, kdubya  wrote:
>
> > I have recently switched from a plain text development style to using
> > NetBeans 6.5. I figured I might like some of the niceties of a real
> > IDE (I have used them before) but my main motivation was to get
> > debugging with breakpoints, watches etc.
>
> > So, I have gotten Xdebug (verision 2.0.4) to work with a simple "Hello
> > World" script outside of PHP. I can set breakpoints and inspect
> > variables. Great!
>
> > Only it doesn't work in a CakePHP project. Actually, if I leave the
> > debug setting on to "Stop at first line", it does breakpoint there.
> > Where it stops (it says) is in the index.php from the /app folder. So
> > I do F8 (Step Over) and it does not stop at the next line of code. It
> > skips 10 lines of code and stops there. Do it a few more times and it
> > skips random chunks of code. It then gets about 5 lines from the
> > bottom of the file and one F8 sends it running, not stopping at any of
> > the subsequent breakpoints that I have set.
>
> > As I'm stepping through the file, it actually looks like it is showing
> > me the wrong file (there are several index.php files after all). I've
> > tried to match up the line number to figure out where it really is but
> > no luck.
>
> > BTW, my development machine is running Window XP Pro SP2. My webserver
> > is Apache 2.0.50 and PHP is 5.2.5, if that makes any difference.
>
> > I have searched the newsgroup for answers to this. There are a couple
> > of posts that are similar (like getting Xdebug to work under Eclipse
> > PDT) but they gave me no help.
>
> > Thanks in advance for any suggestions.
>
> > Ken
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Please Help!! my password is always null!!!

2009-08-24 Thread liaogz82

so if i want to use authentication, how should i go about doing it?

Gangzheng

On Aug 24, 2:03 pm, Martin Westin  wrote:
> My guess is that Auth component is doing it.
> If you are doing your own authentication you have to remove Auth from
> your list of components. And if you do want to use Auth ten you
> shouldn't do any of the authenticating stuff yourself.
>
> /Martin
>
> On Aug 24, 6:50 am, liaogz82  wrote:
>
> > Hi all,
>
> > I dont know why but my password is always sent as null in $this->data,
> > which causes it to be unable to retrieve data for comparison. The
> > following below are my codes:
>
> > login.ctp
> > 
> > Login
> >     create('User', array
> > ('controller'=>'users','action'=>'login'));?>
> >         input('User.username');?>
> >         input('User.password',array
> > ('type'=>'password'));?>
> >         submit('Login');?>
> >     end(); ?>
> >   > ?>
>
> > users_controller.php
> >     function login()
> >     {
> >         $this->layout = 'login';
> >         if(!empty($this->data))
> >         {
> >             $user = $this->User->validateLogin($this->data['User']);
> >             if($user != '')
> >             {
> >                 $this->Session->write('User', $user);
> >                 $this->Session->setFlash('You\'ve successfully logged
> > in.');
> >                 $this->redirect(array('controller'=>'subscribers',
> > 'actions'=>'index'));
> >             }
> >             else
> >             {
> >                 $this->Session->setFlash(json_encode($this->data));
> >                 $this->redirect(array
> > ('controller'=>'users','actions'=>'login'));
> >             }
> >         }
> >     }
>
> >     function logout()
> >     {
> >         $this->Session->destroy('user');
> >         $this->Session->setFlash('You\'ve successfully logged out.');
> >         $this->redirect($this->Auth->logout());
> >     }
>
> > user.php
> > class User extends AppModel {
>
> >     var $name = 'User';
> > //    var $actsAs = array('Acl' => array('requester'));
> >     var $useDbConfig = 'tracksdb';
>
> >     function parentNode() {
> >     }
>
> >     /* To get the login ID of staff
> >     function getStaffID()
> >     {
> >         return "gangzheng";
> >         /* to change. The ID should be gotten from session
> >     }*/
>
> >     //The Associations below have been created with all possible keys,
> > those that are not needed can be removed
> >     var $belongsTo = array(
> >             'Group' => array('className' => 'Group',
> >                                 'foreignKey' => 'group_id',
> >                                 'conditions' => '',
> >                                 'fields' => '',
> >                                 'order' => '',
> >                                 'counterCache' => ''),
> >     );
>
> >     var $hasMany = array(
> >             'Login' => array('className' => 'Login',
> >                                 'foreignKey' => 'user_id',
> >                                 'conditions' => '',
> >                                 'fields' => '',
> >                                 'order' => '',
> >                                 'limit' => '',
> >                                 'offset' => '',
> >                                 'dependent' => '',
> >                                 'exclusive' => '',
> >                                 'finderQuery' => '',
> >                                 'counterQuery' => ''),
> >     );
>
> >     function validateLogin($data)
> >     {
> >         $user = $this->find(array('username' => $data['username'],
> > 'password' => sha1($data['password'])), array('id', 'username'));
> >         if(empty($user) == false)
> >             return $user['User'];
> >         return false;
> >     }
>
> > }
>
> > The flash message kept showing {"User":
> > {"username":"gangzheng","password":null}}. So i am not sure what is
> > going on. the password field is always set to null no matter what i
> > type into the password field. Please help. Thanks
>
> > Gangzheng
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---