Re: user table with authenticate

2009-05-29 Thread Ricky Paz

If you use AuthComponent, you can get id from $this->Auth->user('id")
as said above, but functions like edit, view or delete, they receive
$id from URL. Make a simple application from bake and look at the URL
after click in edit. You'll see something like this: http://address/
{controllerName} / edit/ number, where number is id.

Your function can receive many parameters that you want from URL.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Routes and AJAX

2009-05-29 Thread Dave Maharaj :: WidePixels.com
Do you have to do anything special when you have custom routes and calling
an Ajax function?
 
Trying to do something simple and no luck.update a div
 
my routes take users/journals to /journals simply removing the "users" in
the url
 
Now on journals i want to load a entry (element) into a div and all i get is
users/journal/entry not found.
 
I have other ajax div updates on pages where there are no route changes and
it works fine
 
Checked:
render the entry.ctp in the elements folder 
 
Tried url in the html link helper using users/journals  and journals
 
Tried leaving controller action as # in the link and use
$("#page_load").load( id + '/entry' , {
 
What am I missing? The  div fades out where the new one should load...then
users/journal/entry not found.
 
What am I doing wrong / missing?
 
Thanks
 
Dave

--~--~-~--~~~---~--~~
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: Feedback from TranslateBehavior creator needed

2009-05-29 Thread jitka (poLK)

> There's ArticleVersion model, which have this fields: id, name:
> varchar, introduction:text, created:datetime.
>
> I've defined to name and introduction fields to be translatable:
> var $actsAs = array('Translate' => array('name', 'introduction'));

Table for ArticleVersion model should not contain fields 'name' and
'introduction', these fields are virtual.

> Quick adding a new ArticleVersion is made by filling just name field
> and submitting, and introduction doesn't need to be fulfilled.
> ...
> It returns no rows, because there's `I18n__introduction`.`locale` =
> 'pol' in where statement, and the introtuction field is't saved in
> Quick add operation.

Fastest possible way is save introduction as empty string in Quick add
operation.

> But I don't know how to make $locale variable an array?

>From controller, $this->ArticleVersion->locale = array('pol') should
do the trick, although purpose of possibility to pass array of locales
is - handle cases, where one wants record(s) preferrably in some
locale, but if this translation doesn't exist, provide fallback locale
(s) to use.
--~--~-~--~~~---~--~~
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: Database and Model Design for HABTM

2009-05-29 Thread adallas
Your code looks right, but you could combine main and sub categories
into a Category table that uses Tree behavior. Then a recipe would
HABTM categories, and subcategories could have sub-subcategories.

/alastair/

On May 28, 7:03 am, Luke  wrote:
> Hi,
>
> I am still a Cake newbie, but maybe someone give me a hint on my
> issue. I am trying to learn cake by developing a recipe site.
>
> There are Maincategories and Subcategories.
> F.e.
>
> BBQ -> (Pork, Beef, Vegetarian)
> Main Dish -> (Vegetarian)
>
> A recipe can belong to different Categories, so a "Steak" could show
> up under "BBQ" and "Main Dish" and there under Beef.
>
> I'm planing to have a Form which reads out the Maincategories from the
> DB and when you click on a checkbox, the subcategories should show up
> (AJAX Request?)
>
> I have been thinking about the DB Design now for a while and thought I
> first had a solution. Than I got doubts and re-designed the tables and
> the models. I am now rather confused if this design is correct and
> would hope that someone could give some feedback. Okay, here the
> tables:
> ===
> maincategories *** this table is filled manually
> - id
> - maincategory
> ===
> subcategories *** this table is filled manually
> - id
> - subcategory
> - maincategory_id
> ===
> recipes_subcategories ** this will be filled in when Add Recipe Form
> was send off
> - id
> - subcategory_id
> - recipe_id
> ===
> recipes ** this will be filled in when Add Recipe Form was send off
> - id
> - recipename
> ===
>
> My Models:
>
> == Recipe Model
> ===
> class Recipe extends AppModel {
>            var $name = 'Recipe';
>            var $belongsTo = array(
>                                             'User' => array(
>                                                           'className'
> => 'User'
>                                                            )
>                                             );
>
>            var $hasAndBelongsToMany = array(
>                                                         'Subcategory'
> =>
>
> array(
>
> 'className' => 'Subcategory',
>
> 'joinTable' => 'recipes_subcategories',
>
> 'foreignKey' => 'recipe_id',
>
> 'associationForeignKey' => 'subcategory_id'
>                                                                               
>        )
>                                                                  );
>
> 
>
> == Subcategory Model
> ===
>  class Subcategory extends AppModel {
>             var $name = 'Subcategory';
>             var $belongsTo = array('Maincategory');
>             var $hasAndBelongsToMany = array(
>
> 'Recipe' =>
>
> array(
>
> 'className' => 'Recipe',
>
> 'joinTable' => 'recipes_subcategories',
>
> 'foreignKey' => 'subcategory_id',
>
> 'associationForeignKey' => 'recipe_id'
>                                                                               
>       )
>                                                                 );
>
> }
>
> Is this setup correct or any advice how it should look instead? Thanks
> a lot 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
-~--~~~~--~~--~--~---



A collection of Coda clips for CakePHP

2009-05-29 Thread DanielMedia

Hi All,

Just wanted to drop in and let anyone know who might be interested
(And uses the Coda IDE) that I've put together a collection of clips
for CakePHP. You can check them out here:

http://code621.com/content/6/a-collection-of-coda-clips-for-cakephp

Hope someone finds the collection useful and sorry for the spam in the
group. But how else to let fellow bakers know?

Bake on,

Dan
--~--~-~--~~~---~--~~
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: Saving record HABTM

2009-05-29 Thread adallas

I may not understand the situation clearly, but I have several HABTM
relationships,
and I don't have controllers for the association tables. Can you work
from either
the products or the assets controller?

/alastair/


--~--~-~--~~~---~--~~
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: View Images

2009-05-29 Thread adallas

I have the same problem. My solution is to build the url using the
define FULL_BASE_URL (defined in CAKE/config/paths.php), and $this-
>webroot (where $this is a helper or a controller, but not a view),
plus a webroot-relative literal. There doesn't seem to be a define for
URL directory separators, but webroot has one before and after, like '/
mysite/'.

A view has a property called base which is the same as webroot,
without the '/' after.

So, in a controller or helper:

$url = FULL_BASE_URL . $this->webroot . 'img/user/photos/large';

In a view:

$url = FULL_BASE_URL . $this->base . '/img/user/photos/large';

If there's a better way to do this, I'd love to learn. Obviously, one
wants a site that transfers smoothly from localhost to a production
domain.
--~--~-~--~~~---~--~~
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: user table with authenticate

2009-05-29 Thread brian

Can you post an example? What do you mean by authenticate?

If you use the AuthComponent, you can get the ID from $this->Auth->user('id').

On Fri, May 29, 2009 at 1:21 PM, Paco Gomez  wrote:
>
> Hello everybody,
>
> I've seen a lot of examples that use in controllers function like
>
> some_function($id)
> {
> ...
> }
>
> - How functions can receive user id authenticate automaticaly?
> - Is there any variable that store user table in the session?
>
>
> 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: validation messages problems

2009-05-29 Thread brian

On Fri, May 29, 2009 at 10:52 AM, jrsh...@googlemail.com
 wrote:
>
>
> I keep getting the following message, after I have clicked 'add' on my
> form, when it is invalid in any way and when a submission is
> successful:
>
> Not Found
> Error: The requested address '/contacts/add' was not found on this
> server.


Set debug to 2 in core.php. Cake defaults to a 404 when there's an
error and debug is at 0.

> On a successful submission the e-mail is sent, but it still results in
> the above message. I have added a redirect to my controller to
> redirect back to the page, but no error messages are displayed
> accordingly. I have added $form->error('Contact.name').. etc but they
> do not display the messages defined in my model.
> I do not have a view file for the controllers action and I just want
> to call the method then go back to the initial page and display the
> appropriate error messages.

I don't see a redirect in your method. In any case, you want to avoid
doing that because your $validationErrors won't exist if you redirect.
The correct way to handle this is to only redirect when the save is
successful. That way, Cake will redisplay the form otherwise, and
FormHelper will know to display the error messages.

Think of it this way: When the user first browses to /contacts/add
Cake will display the add view, which contains a form. Your save code
will not be parsed because $this->data is empty (or, in your case,
because RequestHandler->isPost() returns false). FormHelper will
create the empty form.

When the form is submitted, RequestHandler->isPost() retrn true and
Cake will run through your save() operations. If that is successful,
your code should redirect somewhere else.

If the save fails, though, your code shouldbe allowed to finish
running therough the controller method. Cake will, in turn, re-display
the form. Because your $validationErrors is not empty, FormHelper
should display the error messages.

--~--~-~--~~~---~--~~
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: View Images

2009-05-29 Thread brian

Save the filename/path to a table?

On Thu, May 28, 2009 at 3:53 PM, Dave Maharaj :: WidePixels.com
 wrote:
> This is a simple question that has me stumped.
>
> A user uploads an image that gets saves to webroot/img/user/photos
>
> Now in the profile there is the thumbnails of the photos...but how do I get
> the url for that so when clicked they can view the full image in
> webroot/img/user/photos/large?
>
> thanks
>
> Dave
> >
>

--~--~-~--~~~---~--~~
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: Problem with DISTINCT query....

2009-05-29 Thread brian

try this:

$this->Invoice->findAll(null, array('DISTINCT Invoice.customer_id'));


On Thu, May 28, 2009 at 1:58 PM, Matt  wrote:
>
> I am trying to get a distinct list of invoices based on the
> customer_id using the following line:
>
> $this->set('invoices', $this->Invoice->findAll(null, 'DISTINCT
> customer_id'));
>
> Problem is that it doesn't work as it should since the query comes out
> like this:
>
> SELECT DISTINCT `Invoice`.`customer_id`, `Invoice`.`id` FROM
> `invoices` 
>
> Since it selects the Invoice.id as well as the distinct
> Invoice.customer_id, my results aren't distinct at all!
>
> Can anyone help me pleeease? :)
>
> Thanks,
> Matt
> >
>

--~--~-~--~~~---~--~~
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: Does CakePHP support Sqlite-3 yet?

2009-05-29 Thread Marcelo Andrade

On Fri, May 29, 2009 at 1:39 PM, Russ  wrote:
>
> Can anyone tell me if CakePHP 1.2 supports Sqlite-3?
> If not, is it reasonable to think that a CakePHP 1.3 will provide that
> support?

Check this ticket.  The attachment driver works fine.

https://trac.cakephp.org/ticket/3003

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: URL mapping of actions with camelCase names

2009-05-29 Thread Pablo Viojo
I defined this on my controller (TestingController):
function by_name(){
   echo "by_name";
die();
}
function byName(){
echo "byName";
die();
}

And the results are:

 /testing/by_name  --> by_name
 /testing/byName  --> byName

If I set the following route


Router::connect('/testing/by_name/*', array(
'controller' => "testing",
'action' => "byName",
));

the results are:

 /testing/by_name  --> byName
 /testing/byName  --> byName

Both urls are mapped to TestingController:byName
and  TestingController:by_name is no longer needed (I removed it to test
this case)

Saludos,

Pablo Viojo
pvi...@gmail.com
http://pviojo.net
(#260 y creciendo!)


Ayudar nos hace felices!
http://needish.com  - http://helperman.org



On Fri, May 29, 2009 at 5:21 PM, Pablo Viojo  wrote:

> Can you post the URL that allow to access and the URL that throws an error?
> (becuse I get lost! :) )
> Saludos,
>
> Pablo Viojo
> pvi...@gmail.com
> http://pviojo.net
> (#260 y creciendo!)
>
> 
> Ayudar nos hace felices!
> http://needish.com  - http://helperman.org
>
>
>
>
> On Fri, May 29, 2009 at 3:42 PM, smeenai  wrote:
>
>>
>> Hey all, just getting started with CakePHP and came across a small
>> problem. I have a controller with a function named byName. I'm quoting
>> http://book.cakephp.org/view/46/Routes-Configuration:
>>
>> "/products/view_clearance maps to the viewClearance() action of the
>> ProductsController"
>>
>> However, when I try to access this action using by_name in the URL, I
>> get an action not found error message. If I use byName in the URL it
>> works perfectly. I did a search and
>>
>> http://groups.google.com/group/cake-php/browse_thread/thread/e19f277a27dcef71/2d2bf4f18f9a671b?lnk=gst&q=urls+actions+underscores#2d2bf4f18f9a671b
>> has a similar issue as far as I can tell. In that thread, Pablo Viojo
>> also states in his second post that this is supposed to be the
>> standard behaviour, so it might be some sort of bug. I'm using Cake
>> 1.2.3.8166, downloaded from Sourceforge.
>>
>> Cheers.
>>
>> >>
>>
>

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



Routing an Admin dashboard

2009-05-29 Thread Beedge

Hi all, I have baked up a couple of simple controllers/models to add
news stories and the like to an app I am building (for no other reason
than to learn the ropes)

I want the administrator to be able to type www.siteurl.ie/admin and
be directed to a log in. I want there to be a dashboard with all the
CRUD functions available to the administrator after they successfully
log in

but I aint having much fun.

This is what Ive done:

turned on admin routing in config file

set up a controller called: administrators_controller.php

added the route: Router::connect('/admin', array('controller' =>
'administrators', 'action' => 'dashboard', 'admin' => true));

and set up dashboard method in my administrators controller

so now, when I go to www.siteurl.ie/admin it forwards me to the
dashboard view, no problem.

BUT when I try to do something like: www.siteurl.ie/admin/news/add I
get:

 Error:  AdminController could not be found.

Error: Create the class AdminController below in file: app\controllers
\admin_controller.php



any ideas?

Thanks (in advance)

Kev
--~--~-~--~~~---~--~~
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: URL mapping of actions with camelCase names

2009-05-29 Thread Pablo Viojo
Can you post the URL that allow to access and the URL that throws an error?
(becuse I get lost! :) )
Saludos,

Pablo Viojo
pvi...@gmail.com
http://pviojo.net
(#260 y creciendo!)


Ayudar nos hace felices!
http://needish.com  - http://helperman.org



On Fri, May 29, 2009 at 3:42 PM, smeenai  wrote:

>
> Hey all, just getting started with CakePHP and came across a small
> problem. I have a controller with a function named byName. I'm quoting
> http://book.cakephp.org/view/46/Routes-Configuration:
>
> "/products/view_clearance maps to the viewClearance() action of the
> ProductsController"
>
> However, when I try to access this action using by_name in the URL, I
> get an action not found error message. If I use byName in the URL it
> works perfectly. I did a search and
>
> http://groups.google.com/group/cake-php/browse_thread/thread/e19f277a27dcef71/2d2bf4f18f9a671b?lnk=gst&q=urls+actions+underscores#2d2bf4f18f9a671b
> has a similar issue as far as I can tell. In that thread, Pablo Viojo
> also states in his second post that this is supposed to be the
> standard behaviour, so it might be some sort of bug. I'm using Cake
> 1.2.3.8166, downloaded from Sourceforge.
>
> Cheers.
>
> >
>

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



Test table creation failing

2009-05-29 Thread Leo Mendoza

Hey all -

I'm trying to run a simple test, and CakePHP is failing when it tries
to access a table it should be automatically creating. Like so:

---
Missing Database Table

Error: Database table test_event_admins for model EventAdmin was not
found.

Notice: If you want to customize this error message, create app/views/
errors/missing_table.ctp
---

The "event_admins" table is there, and I see it getting "DESCRIBE"ed
in the output below the error, and I know it's not permissions because
I see it creating 2 or 3 other tables before failing.

Any ideas?
leo

Running: Cake 1.2.3.8166
O/S: linux
www server: apache 2.2.3 (CentOS)
db: mysql 5.0.45

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



URL mapping of actions with camelCase names

2009-05-29 Thread smeenai

Hey all, just getting started with CakePHP and came across a small
problem. I have a controller with a function named byName. I'm quoting
http://book.cakephp.org/view/46/Routes-Configuration:

"/products/view_clearance maps to the viewClearance() action of the
ProductsController"

However, when I try to access this action using by_name in the URL, I
get an action not found error message. If I use byName in the URL it
works perfectly. I did a search and
http://groups.google.com/group/cake-php/browse_thread/thread/e19f277a27dcef71/2d2bf4f18f9a671b?lnk=gst&q=urls+actions+underscores#2d2bf4f18f9a671b
has a similar issue as far as I can tell. In that thread, Pablo Viojo
also states in his second post that this is supposed to be the
standard behaviour, so it might be some sort of bug. I'm using Cake
1.2.3.8166, downloaded from Sourceforge.

Cheers.

--~--~-~--~~~---~--~~
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("list") doesn't bring back the user choice that is written in the database

2009-05-29 Thread simon...@gmail.com

Good Afternoon,

I did create a listbox using find(list). It did write the choise 3 in
the database.

But when I want to edit this choice, it doesn't appear selected.


I'm new to this function so I don't know if there is a method or
something I should use in this function.


Regards,

--~--~-~--~~~---~--~~
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() and javascript validation

2009-05-29 Thread Celso

Hi!

how can I do a simple validation in my form:

echo $ajax->form('adicionar','post',
array('model'=>'Cargo'
, 'update'=>'ajax-mensagem'
, 'complete'=> "Effect.Pulsate('ajax-mensagem');"
, 'id' => 'form-inclusao'
, 'before' => 'error()'
));



Re: getNumRows()

2009-05-29 Thread Miles J

Why would it be 3, if the rows are 100?
--~--~-~--~~~---~--~~
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 dependencies

2009-05-29 Thread dkT

Thx Gwoo ;)

On 29 Maj, 18:20, Gwoo  wrote:
> http://book.cakephp.org/view/28/Requirements

--~--~-~--~~~---~--~~
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: 2 Models - one form

2009-05-29 Thread jgadbois

Thanks that helps a lot...I got it working. Now I have another
problem :)  I would like the user to add as many ingredients as he/she
wants.  Basically I have a link ("Add another ingredient") that
executes javascript and adds the new form fields.  This is all working
fine and saving to the db via saveAll().  However, if for some reason
validation fails, I lose the form fields added via javascript.  Is
there any way to get around this?  In other words I think somehow the
controller needs to detect the count of submitted ingredients and pass
that back to the view.  Any ideas on how to do this?

On May 29, 11:22 am, Ithaka  wrote:
> Pretty simple Jgadbois,
>
> Here could be a little example of what u would want. (in cakephp 1.2)
>
> //this doesn't have to be so complicated but im just showing u the
> options of the create
> //function. create('Recipe'); would automagically bring you to the add
> action.
> echo $form->create('Recipe', array('method' => 'post', 'url' => array
> ('action' => 'add')));
>   echo $form->input('Recipe.name');
>   echo $form->input('Ingredients.name');
>   echo $form->input('Ingredients.quantity');
> echo $form->end();
>
> That is the code within the view, in the controller you can do all the
> logic you want with this stuff by looking at $this->data.
> $this->data would look something like this:
> array (
>        [Recipe] => array (
>                                   [name] => hot fudge cake
>                                  )
>        [Ingredients] => array (
>                                        [name] => flower
>                                        [quantity] => 2
>                                        )
> )
>
> and to save this information all you need to do is use the saveAll
> function
> $this->Recipe->saveAll($this->data);
>
> the saveAll method looks for associations and saves the information
> properly.
>
> I hope this helped you, i'm not sure how new you are so i tried to put
> it as simple as possible and explain things.
>
> Happy Baking.
>
> On May 29, 10:44 am, jgadbois  wrote:
>
> > What is the preferred way for handling a form with elements for
> > mutitple models?  In my case, I'd like to have a form where you can
> > add a Recipe with all of it's Ingredients (a recipe hasMany
> > ingredients).  How would I handle this?  I'm new to CakePHP so I'm a
> > little confused.

--~--~-~--~~~---~--~~
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: Auth component cache problem in Internet Explorer

2009-05-29 Thread jackb

I'm experiencing the same problem, but I have managed to isolate it to
occur only when I'm making ajax requests that make use of parameters.
That is, in Cake if I am using the $ajax helper and use the "with"
option for a function to return a string, or if the request is created
in javascript using the parameters option in the prototype
ajax.request.

I have not reviewed flash enough to determine if it plays a part in my
problems. I only use setFlash.

This was not happening for me in IE7 only IE8 beta 1 and IE 8.0.6001

On May 8, 3:03 am, remy  wrote:
> Still haven't solved the problem, but I did found what the problem
> is..
>
> It seems that something went wrong with Flash. When I disabled all
> Flash parts in my site, theAuthcomponent works fine in IE.
> It looks like that the Flash 'resets' thecachewith also the userdata
> for theAuthcomponent.
>
> Anybody else who knows how to solve this problem?
>
> On 7 mei, 23:51, rartavia  wrote:
>
> > > The weirdest part is that even when I toldauthto allow that specific
> > > action, I checked my data that arrived correctly but still the save()
> > > didn't occurred.
>
> > About that, do ignore it, that happen because in that saving, user_id
> > is required and as in that request is null so a db error occurred. The
> > problem is the user in session beaning null.
>
> > Thanks for any 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: Handling "minute" and "hour" elements in forms

2009-05-29 Thread Bs

Now there's still one problem...sorry:)

Saving to a mysql time field works.
But in my edit view the time is not read from the mysql time field.
--> probably because it's a "datetime" field in cake and cake wants a
year, month, day?

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



user table with authenticate

2009-05-29 Thread Paco Gomez

Hello everybody,

I've seen a lot of examples that use in controllers function like

some_function($id)
{
...
}

- How functions can receive user id authenticate automaticaly?
- Is there any variable that store user table in the session?


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: Determine which database driver is being used

2009-05-29 Thread blake

Thanks for the suggestion, that worked out for me.

I was disappointed to have to finally use a custom query, but it
seemed necessary this time. I have to go about 3 levels deep through
the models to get everything I need, which resulted in over 8000
queries per page of results. It was done the Cake way (as best as I
could tell), but just seemed unreasonable since a single fairly simple
query could be written to accomplish the same thing.

-Blake


On May 29, 10:42 am, jperras  wrote:
> > Determine which database driver is being used
>
> http://api.cakephp.org/class/model#method-ModelgetDataSource
>
> As for your custom query, it really depends. Cake does a lot for you,
> but sometimes it makes sense to drop down to the bare metal and write
> a custom query.
>
> -j.
>
> On May 28, 12:46 pm, blake  wrote:
>
> > Hello,
>
> > Not sure if this has been discussed before, but I couldn't find it. As
> > much as I hate to do it, I think I may need to use my first custom
> > query out of this entire website (either that or use a recursive
> > search, which is running thousands of queries instead of just 1).
>
> > My biggest issue with a custom query is that for my local development
> > machine, I use MySQL and the production server uses MS SQL (not my
> > choice). Obviously a custom query won't work when copying code between
> > these two, so I wanted to try coding something like:
>
> > if ($database_driver == 'mssql') {
> >     $query = 'select';}
>
> > elseif ($database_driver == 'mysql') {
> >     $query = 'select';
>
> > }
>
> > I'm open to suggestions if there's a way to avoid a custom query here,
> > but if not, is there at least a good way I can determine which DB
> > driver is being used so I can do something similar to the above?
>
> > 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
-~--~~~~--~~--~--~---



Setting a date-Field to default values

2009-05-29 Thread GetIT

Hi,

I´m having a problem to set the values of a date-field.

A little example:

The table "users":
id, int(11), auto_increment, primary key
today, date

I know that this example doesn´t make sense, but it´s only a example.

My Controller:
...
$this->set('user', $this->user->read(null, $id)
...

And the view:
...
echo $form->input('User.today', array('dateFormat' => 'DMY'));
...

cake creates a field existing out of
a day
a month
and a year field
(forgive me for my bad english - I do my best)

How set this field to, lets say 1.2.2003

This doesn#t work:

echo $form->input('User.today', array('dateFormat' => 'DMY',
'selected' => '01-02-2003'));
or
echo $form->input('User.today', array('dateFormat' => 'DMY',
'selected' => '2003-02-01'));

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: Handling "minute" and "hour" elements in forms

2009-05-29 Thread Bs

P.S.: Now i've tested it with a "time" column type and it worked!!!

Thanks!!!

On 27 Mai, 17:02, Stu  wrote:
> ps: The view code should look something like this:
>
> echo $form->dateTime('column_name', 'NONE', '12');
>
> The '12' just represents the format, you can either choose '12' (e.g.
> 11:15 am)  or '24' (e.g. 23:15)
--~--~-~--~~~---~--~~
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: Handling "minute" and "hour" elements in forms

2009-05-29 Thread Bs

Thanks,

the input fields work but cake still saves NULL values in the database
in this case. The problem seems to be that only "hour" and "minute"
get set but cake doesn't set any year, month or day informations in
the datetime field. The result is a null value in my datetime column
in mysql.

My view code:

datetime('OpeningStart','NONE','24');?>

When saving, the cake debug output says:

 [OpeningStart] => Array
(
[hour] => 06
[min] => 0
)


--> mysql won't save the field. I have to set the date values for
"OpeningStart" by myself in the controller.



On 27 Mai, 17:02, Stu  wrote:
> ps: The view code should look something like this:
>
> echo $form->dateTime('column_name', 'NONE', '12');
>
> The '12' just represents the format, you can either choose '12' (e.g.
> 11:15 am)  or '24' (e.g. 23:15)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Does CakePHP support Sqlite-3 yet?

2009-05-29 Thread Russ

Can anyone tell me if CakePHP 1.2 supports Sqlite-3?
If not, is it reasonable to think that a CakePHP 1.3 will provide that
support?

I haven't been able to find out much information on this subject.
I guess most people aren't using Sqlite. I thought it would be a great
database to use when you're prototyping a web application for a
client, not to mention it works quite well for production sites that
only require a small-to-medium size database.

Any information you would like to share would be greatly appreciated.

Thanks for your help!

Russ Chaffin
Regional Webmaster
USDA Forest Service
Southern Region
--~--~-~--~~~---~--~~
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 dependencies

2009-05-29 Thread Gwoo

http://book.cakephp.org/view/28/Requirements
--~--~-~--~~~---~--~~
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 dependencies

2009-05-29 Thread dkT

Hi,

Does cakephp depend on any third-party software or special php
configurations?


/Daniel

--~--~-~--~~~---~--~~
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: 2 Models - one form

2009-05-29 Thread Ithaka

Pretty simple Jgadbois,

Here could be a little example of what u would want. (in cakephp 1.2)

//this doesn't have to be so complicated but im just showing u the
options of the create
//function. create('Recipe'); would automagically bring you to the add
action.
echo $form->create('Recipe', array('method' => 'post', 'url' => array
('action' => 'add')));
  echo $form->input('Recipe.name');
  echo $form->input('Ingredients.name');
  echo $form->input('Ingredients.quantity');
echo $form->end();

That is the code within the view, in the controller you can do all the
logic you want with this stuff by looking at $this->data.
$this->data would look something like this:
array (
   [Recipe] => array (
  [name] => hot fudge cake
 )
   [Ingredients] => array (
   [name] => flower
   [quantity] => 2
   )
)

and to save this information all you need to do is use the saveAll
function
$this->Recipe->saveAll($this->data);

the saveAll method looks for associations and saves the information
properly.

I hope this helped you, i'm not sure how new you are so i tried to put
it as simple as possible and explain things.

Happy Baking.

On May 29, 10:44 am, jgadbois  wrote:
> What is the preferred way for handling a form with elements for
> mutitple models?  In my case, I'd like to have a form where you can
> add a Recipe with all of it's Ingredients (a recipe hasMany
> ingredients).  How would I handle this?  I'm new to CakePHP so I'm a
> little confused.
--~--~-~--~~~---~--~~
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: Moving a webapp from Windows to Linux

2009-05-29 Thread brian

On Thu, May 28, 2009 at 12:44 AM, ShiVik  wrote:
>
> Hello Brian
>
> I checked the include_path...its value is ".:/opt/lampp/lib/php"

The problem is with the ".:" at the beginning.

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



getNumRows()

2009-05-29 Thread PaulMan

Hello Everybody,
On Product Model
public $hasAndBelongsToMany = array('Category' ,'Catalog');


On Products_Controller

$this->data=$this->Product->find('all',array('conditions'=>array
('Product.active'=>1),'limit'=>'100'));
$this->Product->getNumRows()
it returns 100 Products , this is OK

but
$this->Product->Catalog->getNumRows()
also returns 100 ( number of Products )  instead of 3 ??

is this a bug?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



validation messages problems

2009-05-29 Thread jrsh...@googlemail.com


I keep getting the following message, after I have clicked 'add' on my
form, when it is invalid in any way and when a submission is
successful:

Not Found
Error: The requested address '/contacts/add' was not found on this
server.

On a successful submission the e-mail is sent, but it still results in
the above message. I have added a redirect to my controller to
redirect back to the page, but no error messages are displayed
accordingly. I have added $form->error('Contact.name').. etc but they
do not display the messages defined in my model.
I do not have a view file for the controllers action and I just want
to call the method then go back to the initial page and display the
appropriate error messages.



View

  create('Contact'); ?>
input('Contact.name');  //text ?>
input('Contact.email');  //text ?>
input('Contact.comment', array('rows' => '8',
'cols' => '44')); ?>
end('add'); ?>

Controller

RequestHandler->isPost()) {
  $this->Contact->set($this->data);
  if ($this->Contact->validates())
  {
$Name = $this->data['Contact']['name']; //senders name
$email = $this->data['Contact']['email'];   //senders
e-mail adress
$recipient = "EMAIL ADDRESS"; //recipient
$mail_body = $this->data['Contact']['comment']; //mail
body
$subject = 'Contact message from ' . $this->data
['Contact']['name']; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //
optional headerfields
mail($recipient, $subject, $mail_body, $header); //
mail command :)
  }
  }

}
}

?>

Model

 array('type'=>'string', 'length'=>100),
'email' => array('type'=>'string', 'length'=>255),
'comment' => array('type'=>'text')
);

var $validate = array(
'name' => array('rule' => array('minLength', 1), 'message' =>
'enter your name'),
'email' => array('rule' => 'email', 'message' => 'Must be a valid
email address'),
'comment' => array('rule' => array('minLength', 1), 'message' =>
'Comment is required'));
}
?>


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



copying table data from one table to another in cakephp controller method

2009-05-29 Thread Darshan

hi,

i am new to cakephp.

i am working on a project in which we have two tables

one is product and the other is product repository,

both the tables have same structure.

what i want to do is create a repository for product so that we don't
have to put all

product information again and again, and just to copy it from
repository table to main

product table whenever we need to add the same product.

i have created product controller, model and  view

as well as productrepository controller, model and  view

please help me how can i do that

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



2 Models - one form

2009-05-29 Thread jgadbois

What is the preferred way for handling a form with elements for
mutitple models?  In my case, I'd like to have a form where you can
add a Recipe with all of it's Ingredients (a recipe hasMany
ingredients).  How would I handle this?  I'm new to CakePHP so I'm a
little confused.

--~--~-~--~~~---~--~~
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: Determine which database driver is being used

2009-05-29 Thread jperras

> Determine which database driver is being used

http://api.cakephp.org/class/model#method-ModelgetDataSource

As for your custom query, it really depends. Cake does a lot for you,
but sometimes it makes sense to drop down to the bare metal and write
a custom query.

-j.

On May 28, 12:46 pm, blake  wrote:
> Hello,
>
> Not sure if this has been discussed before, but I couldn't find it. As
> much as I hate to do it, I think I may need to use my first custom
> query out of this entire website (either that or use a recursive
> search, which is running thousands of queries instead of just 1).
>
> My biggest issue with a custom query is that for my local development
> machine, I use MySQL and the production server uses MS SQL (not my
> choice). Obviously a custom query won't work when copying code between
> these two, so I wanted to try coding something like:
>
> if ($database_driver == 'mssql') {
>     $query = 'select';}
>
> elseif ($database_driver == 'mysql') {
>     $query = 'select';
>
> }
>
> I'm open to suggestions if there's a way to avoid a custom query here,
> but if not, is there at least a good way I can determine which DB
> driver is being used so I can do something similar to the above?
>
> 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
-~--~~~~--~~--~--~---



Re: Determine which database driver is being used

2009-05-29 Thread jperras

> Determine which database driver is being used

http://api.cakephp.org/class/model#method-ModelgetDataSource

As for your custom query, it really depends. Cake does a lot for you,
but sometimes it makes sense to drop down to the bare metal and write
a custom query.

-j.

On May 28, 12:46 pm, blake  wrote:
> Hello,
>
> Not sure if this has been discussed before, but I couldn't find it. As
> much as I hate to do it, I think I may need to use my first custom
> query out of this entire website (either that or use a recursive
> search, which is running thousands of queries instead of just 1).
>
> My biggest issue with a custom query is that for my local development
> machine, I use MySQL and the production server uses MS SQL (not my
> choice). Obviously a custom query won't work when copying code between
> these two, so I wanted to try coding something like:
>
> if ($database_driver == 'mssql') {
>     $query = 'select';}
>
> elseif ($database_driver == 'mysql') {
>     $query = 'select';
>
> }
>
> I'm open to suggestions if there's a way to avoid a custom query here,
> but if not, is there at least a good way I can determine which DB
> driver is being used so I can do something similar to the above?
>
> 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
-~--~~~~--~~--~--~---



radio buttons and observeField

2009-05-29 Thread Ithaka

Hi everybody,

I was just wondering if any has come across this or knows what i might
be doing wrong.

the problem:
I have a couple of radio buttons, i am observing these radio buttons
with ajax observeField.  When clicked the radio buttons update a div
which has a select box in it.  I have another observeField on the
select box that will update another select box.  All of this works
fine.  Except for one small thing with the radio buttons.  They only
set the XHR request once.  So after i use them once, nothing updates.

here is the code i use, maybe some one could give em some pointers or
see something i don't.  Maybe it's not even the code it's just
something that happens with the radio buttons.

[code]
/*** within the Reservation_sites/add.ctp view ***/





radio('ReservationSiteOptions.findByRegion', array(__
('Region', true), __('Province', true)), array('legend' => false,
'separator' => ''));
?>






 'update_category', 'update' => 'category');
//checking the source file showed me the ids of the radio buttons.
echo $ajax->observeField('ReservationSiteOptionsFindByRegion0',
$optCat);
echo $ajax->observeField('ReservationSiteOptionsFindByRegion1',
$optCat);
?>

/*** function of update_category in reservation_sites controller ***/
function update_category()
{
Configure::write('debug', 0);
$frenchFlag = $this->_getCurrentLang(); // used for dynamic setting
of DB data in proper language.
$name = 'region_id';
$id = $this->data['ReservationSiteOptions']['findByRegion'];
if($id == 0) {
//region selected.
if($frenchFlag == true) {
$category = $this->Region->find('list', array('fields' 
=> array
('Region.id', 'Region.nom')));
} else {
$category = $this->Region->find('list', array('fields' 
=> array
('Region.id', 'Region.name')));
}
$name = 'region_id';
} else {
//province selected.
if($frenchFlag == true) {
$category = $this->Province->find('list', 
array('fields' => array
('Province.id', 'Province.nom')));
} else {
$category = $this->Province->find('list', 
array('fields' => array
('Province.id', 'Province.name')));
}
$name = 'province_id';
$this->log($category);
}
$this->set(compact('category', 'name'));
}

/*** within the Reservation_sites/update_category.ctp view **/
select('ReservationSiteOptions.'.$name, $category, null,
array('id' => 'categoryList'));
} else {
__('There are no buildings in this region or province.');
}
echo $form->select('ReservationSiteOptions.building_id', array(),
null, array('id' => 'buildings'));
$options = array('url' => 'update_select', 'update' => 'buildings');
echo $ajax->observeField('categoryList', $options);
?>
[/code]

All other things are for the 2nd select box but there are no problems
with that section so i did not include it.

Thank you for those who take the time to help.  See you guys later.
--~--~-~--~~~---~--~~
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 can i make a paginate for products of one shop

2009-05-29 Thread islam4hak

hi how can i make the paginate for a products of a shop in the data
base for example

i now want to make a view function of the shopController

function view($id) {

 $this->Shope->id = $id;
 $this->set('shope', $this->Shope->read());

 $this->set('prod', $this->paginate('Product'));

 $this->set('users', $this->Session->read());
 $views_value=$this->Shope->field('views');

 $views_value++;

 $this->Shope->updateAll(
array('Shope.views' => "$views_value"),
array('Shope.id' => $id)
);

so when i view it on the site it's make the paginate right, but it's
paginate all the Products not the Products that's belong to this shop


so how i can make it paginate  just the Products that's belong to this
shop

?!

--~--~-~--~~~---~--~~
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: Cake php connection with MS Sql Server 2000

2009-05-29 Thread Stinkbug

I haven't seen anyone ever comment that they actually figured out how
to make this work.  We attempted it, but there were all kinds of
problems.  First, trying to find a driver for linux that would allow
us to make a connection through cake to SQL Server was a huge
problem.  We could manually make connections, but couldn't get cake to
connect.

Second, the queries that cake was generating weren't really compatible
with SQL Server.  The only solution for this that I know of is to
write your own queries.  Which kind of defeats the purpose of all the
auto magicness.

We ended up writing some custom code that would sync data across our
databases.  What a pain!  It's the only way we knew how to get the
data we needed from SQL Server though.  If possible I would suggest
just moving your data to mysql and starting there.  it will probably
save you a lot of pain and headache.  In our case we couldn't do that
because we're still using a legacy app that requires SQL Server.

Good luck!  If you figure it out, I would love to see everything that
you had to do to get it to work, including linux driver configurations
and everything.  I'm sure other people would find it useful.


On May 28, 11:59 pm, manohar  wrote:
> hi,
>
>  When I am trying to connect with MS Sql Sever 2000 database, it
> shows
>
> Notice (1024): Please change the value of 'Security.salt' in app/
> config/core.php to a salt value specific to your application [CORE\cake
> \libs\debugger.php, line 556]
>
> 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.
>
> Cake is NOT able to connect to the database.
>
> Any help would be greatly appreciated!
>
> --Manohar
> manohar...@gmail.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
-~--~~~~--~~--~--~---



Admin routing and i can't switch language...

2009-05-29 Thread kicaj

Hi,

I create simple system for articles and multilanguage, everything is
working perfectly:)

But when i use admin routing for administartion site, i can't switch
to other language then default, why?
--~--~-~--~~~---~--~~
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: Forms with math computations and multiple buttons

2009-05-29 Thread Mark

i guess you use cake 1.1

as in 1.2 cake seems not to use $this->params['form']
(always an empty array)

mark


On 29 Mai, 03:43, espontaneo  wrote:
> Thanks for answering my questions. The number helper is only for the view
> right? Can I use it on my component/controller? I have search through the
> internet and people don't recommend it.
>
> brian-263 wrote:
>
> > OK, I understand. Why don't you use the currency method?
>
> >http://api.cakephp.org/class/number-helper#method-NumberHelpercurrency
>
> > You might want to override the defaults with the $options array if you
> > don't want a dollar sign, etc.
>
> > Note that the comment for format() method ("Formats a number into a
> > currency format.") is bogus. That's just been copied from currency().
>
> --
> View this message in 
> context:http://www.nabble.com/Forms-with-math-computations-and-multiple-butto...
> Sent from the CakePHP mailing list archive at Nabble.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: Problem Uploading Flash

2009-05-29 Thread Arak Tai'Roth
Anyone able to help with this?

On May 28, 7:29 am, "Arak Tai'Roth"  wrote:
> So I have a problem uploading a flash video using MeioUpload in
> CakePHP. Here is my controller code for the add function:
>
>                 function add()
>                 {
>                         if (!empty($this->data['Video']))
>                         {
>                                 $mrClean = new Sanitize();
>                                 $id = $this->Session->read('buildId');
>                                 $slug = $this->Session->read('buildSlug');
>
>                                 $this->data['Video']['build_id'] = $id;
>
>                                 if ($this->Video->save($this->data['Video']))
>                                 {
>                                         $this->Session->setFlash('New video 
> for build ' . $slug . ' have
> been added.');
>
>                                         $this->redirect('/builds/view/' . 
> $slug);
>                                         $this->exit();
>                                 }
>                                 else
>                                 {
>                                         $this->Session->setFlash('New video 
> for build ' . $slug . ' could
> not be added.');
>
>                                         $this->redirect('/builds/view/' . 
> $slug);
>                                         $this->exit();
>                                 }
>                         }
>                 }
>
> and the code for the Video model:
>
>         class Video extends AppModel
>         {
>                 var $name = 'Video';
>
>                 var $actsAs = array(
>                         'MeioUpload' => array(
>                                 'video' => array(
>                                         'dir' => 'videos/builds/uploads',
>                                         'create_directory' => false,
>                                         'allowed_mime' => 
> array('video/x-flv'),
>                                         'allowed_ext' => array('.flv')
>                                 )
>                         )
>                 );
>         }
>
> and the code for the add view:
>
> echo $form->create('Video', array('action' => 'add', 'type' =>
> 'file'));
>         echo $form->label('Video.video', 'Video:');
>         echo $form->input('Video.video', array('label' => false, 'type' =>
> 'file'));
>
>         echo $form->submit('background.png');
> echo $form->end();
>
> I've been through this now for the past 2 days and can't figure out
> anything wrong with the code, yet the video will not get uploaded and
> as such the database entry never gets created. I have no idea what the
> problem is so I have no clue what to look for. Is anyone able to help
> me with 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
-~--~~~~--~~--~--~---



Re: problem with cake console

2009-05-29 Thread number9

This gives a brief overview: 
http://amarenderguda.blogspot.com/2008/12/set-path-for-cakephp-on-windows.html

You need to restart for the change to take effect, and it is the path
to the individual cakephp application.

Also, something that I managed to get confused about when I was first
starting, you need to cd to the /app/ folder to get to cake bake.

On May 29, 9:32 am, paulos nikolo  wrote:
> Unfortunately the link is broken.it can't load  the file.:(
>
> 2009/5/29 Sam Sherlock 
>
>
>
> > I think you have not added cake to your path, anyway you don't need to
> > alter the cake.bat file
> > This screencast helped me set up cake console
> >http://cakephp.org/screencasts/view/6
>
> > as a result I am now a happy baker :)
>
> > - S
>
> > 2009/5/28 Paulos23 
>
> >> Hi ppl,
> >> I have read some previous posts about cake console but nothing rly
> >> helped me.I want to use cake console to build an ACL app but i am
> >> facing a problem.I am using Xampp and the directory is: C:\Program
> >> Files\xampp ,my app path is at: C:\Program Files\xampp\htdocs\my_cake
> >> \app.
> >> Then i open the cake.bat file and change the path from:php -q "%lib
> >> %cake.php" -working "%CD%" %*      to :C:\Program Files\xampp\php
> >> \php.exe -q "%lib%cake.php" -working "%CD%" %*  .
> >> After that i open a cmd window and i work on this dir:
>
> >> C:\Program Files\xampp\htdocs\my_cake\cake\console>cake bake
>
> >> 'C:\Program' is not recognized as an internal or external command,
> >> operable program or batch file.
>
> >> And the line above is the error i take!
>
> >> Any help plz???
>
> >> P.S:I tried also the -app command but still same
--~--~-~--~~~---~--~~
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: Multiple Accounts w/ Multiple Users in one Cake app

2009-05-29 Thread number9

You sound as if you probably have more cakephp experience than myself,
so feel free to disregard this, but you could perhaps make use of
access control lists and authentication here.

I have no experience of setting this up, but I'm assuming that all
companies/employees will access a fairly generic system, so you could
first of all setup that system, then setup the groups and users,
whereby logged in users are only allowed to view things related to
their group (company). I think the built in cakephp stuff could handle
this although I only messed around with it briefly.

It is like a user only being able to edit their post on a forum,
except you would take that further and only allow a user to view/
retrieve their posts and group posts.

On May 28, 11:02 pm, modethirteen  wrote:
> Hello,
>
> I'm fairly saavy at writing cake apps at this point but I am not sure
> where to start with this one. What I need to accomplish is a single
> Application with a single database but multiple accounts (companies),
> each with multiple users (employees).
>
> As much as would love to put each company in its own app directory
> with its own db its not an option.
>
> All accounts would share the single database, but each one would need
> to be able to restrict access to their data.
> I would prefer a different point of entry/portal for each company, I
> assume I would use Router to accomplish this?
>
> /appname.com/company1/users/login
> /appname.com/company2/users/login
> etc.
>
> So obviously ALL controllers are prefixed by the company name:
>
> /appname.com/company1/reports/view
> etc..
>
> I'm not sure how I should seperate the data between different
> companies
>
> 1) Multiple tables with a company name prefix (ie companyname1_people,
> companyname2_people, etc.) and a dynamic table prefix based on the
> User.session?
>
> 2) All companies share the same tables but each row has a unique
> company_id, and based on the company name in the session, only the
> data belonging to said company is accessed by users with the same
> company_id.
>
> (In other words, is better to seperate tables and potentially have
> hundreds or share them and have 20 or so with thousands and thousands
> of rows? Its my minimal understanding that the latter is better)
>
> Further more, assuming everyone is sharing tables, where should the
> logic to seperate this data be located? Is there a $this->params that
> extracts the company name prefixing the controller (/companyname/
> controller) and could that be tested against the user's company id/
> name when fetching data? If so, in the model or the controller?
>
> I tried using $this->params['prefix'] but it seemed to only prefix the
> controller calls (ie. /companyname/controller =
> companyname_controller)
>
> I don't expect everyone to write this app for me, but a bit of
> direction so I can at least start it correctly would we very 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: Involuntary logouts - WHY?

2009-05-29 Thread foldiman

Thanks. I've implemented this change and pushed another build for
testing. Meanwhile, would the following setting in the core.php file
have any effect?

Configure::write('Session.start', true);
Configure::write('Session.checkAgent', true);

Do these have anything to do with the Auth component?

Thanks.

On May 26, 7:51 pm, Miles J  wrote:
> Try changing this:
>
> $this->Auth->allow('display');
> $this->Auth->allow('recoverpassword_submit');
> $this->Auth->allow('*');
>
> To this:
>
> $this->Auth->allow('display', 'recoverpassword_submit');
>
> By putting the * your overwriting the other 2. You also only need to
> call allow() once but supply many arguments for each action.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Getting an undefined index on a containable - what am I doing wrong?

2009-05-29 Thread number9

I'm starting to get my head around the containable stuff, but am
having problems with this. I have a simple "view" action, which shows
an overview of a category and related "tips". "Tips" belong to a
"Site".

I.e. Category -> Tip -> Site.

What I'm trying to do is show the site name in the table with the rest
of the data (the field is a name field). This works fine with
recursive set to 2, but I want to reduce the number of queries by
using containable, since it is overkill otherwise. I can get the FK
field to show up no problem, but the "site.name" gives this error:

Notice (8): Undefined index:  name [APP\views\categories\view.ctp,
line 54]

I suspect I am not implementing the join correctly somehow. Or is it a
problem with the code in the view? I am referencing the field like
this:

$category['Site']['name'];

I have tried a few variations on the code below, including nesting
etc. would be very grateful for any assistance.

$data = $this->Category->find('first', array(
'fields' => array(
'Category.name',
'Category.description'
),
'conditions' => array(
'Category.slug' => $slug
),
'contain' => array(
'Tip' => array(
'fields' => array(
'Tip.site_id',
'Tip.id', 'Tip.name', 'Tip.description', 'Tip.created', 'Tip.expires',
'Tip.rating', 'Tip.slug'
)
),
'Site' => array(
'fields' => array(
'Site.name',
'Site.id', 'Site.slug', 'Site.category_id'
),
)
)
));

$this->set('category', $data);


If anybody has a working example of a recursive 2 replicated with
containable I would love to see it.

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



Re: Count array

2009-05-29 Thread rich...@home

or count($this->data['Entry'])

On May 29, 4:13 am, Marcelo Andrade  wrote:
> On Thu, May 28, 2009 at 11:05 PM, Dave Maharaj :: WidePixels.com
>
>  wrote:
>
> > Whats the easiest way to count the number of items in an array? I use the
> > data in the array so its more than just a count.
>
> > I simply want to find if the array has more than 5 items then pass a
> > variable to the view to use a different div.
>
> > Example:
>
> > [Entry] => Array
>
> Ahn... have you tried
>
> sizeof( $this->data['Entry'] )
>
> ???
>
> 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: problem with cake console

2009-05-29 Thread paulos nikolo
Unfortunately the link is broken.it can't load  the file.:(

2009/5/29 Sam Sherlock 

> I think you have not added cake to your path, anyway you don't need to
> alter the cake.bat file
> This screencast helped me set up cake console
> http://cakephp.org/screencasts/view/6
>
> as a result I am now a happy baker :)
>
> - S
>
>
> 2009/5/28 Paulos23 
>
>
>> Hi ppl,
>> I have read some previous posts about cake console but nothing rly
>> helped me.I want to use cake console to build an ACL app but i am
>> facing a problem.I am using Xampp and the directory is: C:\Program
>> Files\xampp ,my app path is at: C:\Program Files\xampp\htdocs\my_cake
>> \app.
>> Then i open the cake.bat file and change the path from:php -q "%lib
>> %cake.php" -working "%CD%" %*  to :C:\Program Files\xampp\php
>> \php.exe -q "%lib%cake.php" -working "%CD%" %*  .
>> After that i open a cmd window and i work on this dir:
>>
>>
>> C:\Program Files\xampp\htdocs\my_cake\cake\console>cake bake
>>
>> 'C:\Program' is not recognized as an internal or external command,
>> operable program or batch file.
>>
>> And the line above is the error i take!
>>
>> Any help plz???
>>
>> P.S:I tried also the -app command but still same
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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: set and field of more words

2009-05-29 Thread fain182

i found the solution reading the code..

cake/libs/view/helpers/form.php: 635
$varName = Inflector::variable(
Inflector::pluralize(preg_replace('/_id$/', '', $this->field()))
);

thank you

-- 
pietro

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