choice of table name

2006-09-28 Thread dkni

Can I have a table name that is singular and how should I implement it
in model?
Everytime when I run it, it asked for a table name 'models'.

regards,


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Model bake meet Fatal error: Call to undefined function mysql_connect()

2006-09-28 Thread ptree

I can install and  run cake and some cakeapps very well,but when i
tried to use bake.php ,the fatal error occurs.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



beginner: help with sql + database

2006-09-28 Thread dkni

Hi!

I have tried to do a select from multiple tables.
Could you please give me some idea on how to do that in Cake?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



CakePHP cheatsheet

2006-09-28 Thread Raquel

Is there a non-.pdf version of the CakePHP cheatsheet?

-- 
Raquel

And indeed people sometimes speak of man's "bestial" cruelty, but
this is very unfair and insulting to the beasts: a beast can never
be so cruel as a man, so ingeniously, so artistically cruel.
  --Ivan Karamazov


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: CakePHP Test Suite -- 'Inflector' not found

2006-09-28 Thread Brian Wisti

On 9/28/06, Sonic Baker <[EMAIL PROTECTED]> wrote:
> Hi Brian, maybe this will be of hekp to you:
> http://groups.google.ie/group/cake-php/browse_thread/thread/8815708bcb1c8b/c054815ad5d09804?lnk=gst&q=test+suite&rnum=1#c054815ad5d09804
>
>  Cheers,
>
>  Sonic
>

It was helpful, but not in the way I expected. I got a 404 when I
tried for /tests/, so I took a closer look at my setup. I eventually
realized that I never got around to changing "AllowOverride None" to
"AllowOverride All" in my conf file for localhost when I added this
new Cake App.

Such a small thing, but so very important!

Then there was a minor issue with the test links going nowhere: "Core
Test Cases" went to '/cases' from '/tests', although the links were
correct if I first manually went to '/tests/cases'. My temporary
workaround was to change $groups and $cases on line 208-209 of
/app/tests/tests.php to:

$groups = '/tests/?show=groups';
$cases = '/tests/?show=cases;

Not an ideal workaround, I'm sure, but it works. I can access my tests
from /tests/ and no more worries about undefined constants.

Now that everything is basically working as advertised, it looks like
I'm going to experiment with the ModelUnitTestCase class at
http://cakephp.org/pastes/show/99b95734fbb3b5a90d9b20adbc381aa9 to
streamline the test database interaction.

Kind Regards,

Brian Wisti
http://coolnamehere.com/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: CakePHP Test Suite -- 'Inflector' not found

2006-09-28 Thread Brian Wisti

On 9/28/06, Sonic Baker <[EMAIL PROTECTED]> wrote:
> Hi Brian, maybe this will be of hekp to you:
> http://groups.google.ie/group/cake-php/browse_thread/thread/8815708bcb1c8b/c054815ad5d09804?lnk=gst&q=test+suite&rnum=1#c054815ad5d09804
>
>  Cheers,
>
>  Sonic
>

It was helpful, but not in the way I expected. I got a 404 when I
tried for /tests/, so I took a closer look at my setup. I eventually
realized that I never got around to changing "AllowOverride None" to
"AllowOverride All" in my conf file for localhost when I added this
new Cake App.

Such a small thing, but so very important!

Then there was a minor issue with the test links going nowhere: "Core
Test Cases" went to '/cases' from '/tests', although the links were
correct if I first manually went to '/tests/cases'. My temporary
workaround was to change $groups and $cases on line 208-209 of
/app/tests/tests.php to:

$groups = '/tests/?show=groups';
$cases = '/tests/?show=cases;

Not an ideal workaround, I'm sure, but it works. I can access my tests
from /tests/ and no more worries about undefined constants.

Now that everything is basically working as advertised, it looks like
I'm going to experiment with the ModelUnitTestCase class at
http://cakephp.org/pastes/show/99b95734fbb3b5a90d9b20adbc381aa9 to
streamline the test database interaction.

Kind Regards,

Brian Wisti
http://coolnamehere.com/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: ACM Project To Reach 1.0

2006-09-28 Thread emiliano

rpeterson, ACM is one of the greatest project in CakeForge.

I think that letting users to be in more than one group is a must.
Also it would be great not to have to reset the permissions everytime a
user changes which group he or she belongs.

I was using version 0.10.0.7.

I hope I can help you!

emiliano


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Pocky: CakePHP on a Stick (lighttpd+php for windows)

2006-09-28 Thread Lokkju

I've managed to put together a Lighttpd+PHP+CakePHP environment
neutral package for windows.

It is actually very simple, my package has a control script, a couple
batch files, and some template configuration files. When you start
Pocky, it will look in the "sites" directory for cakephp
directories (each directory in the sites directory should contain a
complete cakephp package), and ask you to choose which one to run. You
pick the one you want, and it will take the template config files, spit
them out into the lighttpd and php directories with the correct
absolute paths for where the files currently are, and then start
lighttpd.

You can unzip it anywhere, and run - it does not affect your current
windows environment, and is entirely self-contained. (I specifically
use it for running my dev environment from a usb stick, since the usb
stick never has the same drive letter, and I needed something that
didn't care if it was in a specific directory).

I would love some of the people who need something like CupCake, but
for windows, to try it out and give me feedback.

you can check it out here:
http://www.lokkju.com/blog/?p=41


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



ACM Project To Reach 1.0

2006-09-28 Thread rpeterson

Dear Cake Bakers,

Things have finally reached a point where I can devote more time to
finishing version 1.0 of ACM. Being that it has been a little while
since I have been able to work on the project, I am looking for people
to email me or post here things they would like to see available in the
1.0 release, from there I will take old request on the CakeForge site
and new information and build a 1.0 and possibly start a 2.0 roadmap.
If you would like to email me, shoot an email to ryan (a) yesperiod
(dot) com with requests.

Thank you in advanced for those who contribute input to make ACM a
powerful, and handy tool.

~rpeterson


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Restrictive Bakery Terms of Service

2006-09-28 Thread emiliano


John Zimmerman wrote:
> On 9/28/06, emiliano <[EMAIL PROTECTED]> wrote:
> >
> >
> > > As was stated above, this is to restrict people with commercial interest
> > > from taking articles from the site, and using them on their own site
> > without
> > > permission. It in no way restricts the original creator.
> >
> > My opinion is this is against CakePHP growth. The Foundation should let
> > everyone take advantage of the submited code and articles, even if they
> > want to use it in a commercial application.
> >
>
> Before posting re-read PHPNut's WHOLE post very carefully before replying.
>
> The commercial restriction deals with re-publication of content.  Use of the
> code depends on the license used by the author.  PHPNut is encouraging (as
> stated in his post) that you license the code under the MIT license so that
> it can be used in the same way the core CakePHP code can.
>
> I know sometimes a non-legal description and possibly examples are helpful
> when determining what a Terms of Service agreement is actually trying to
> define, but having those won't even help users who choose to just skim it
> and remember what they want.


I'm sorry, english is not my first language. I understood something
diferent from PHPNut statement.

I hope i didn't bother anyone in the Foundation, and as I said I want
the best for the Foundation and the dev team.

cheers
emiliano


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: over write default autocomplete function

2006-09-28 Thread nate

I don't know if this makes a difference, but the method is
$ajax->autoComplete, not $ajax->autocomplete.  That looks like it
should work, but you might be having some other kind of problem.  I'd
say use FireBug to see if anything is even being sent back to the
client.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Strange behavior with saveField()

2006-09-28 Thread Sonic Baker
Nop, an absolutely useless piece of information!

Just kidding :-) That was spot on Nate. I wouldn't have spotted that in a million years. Seriously appreciate it dude.

Cheers,

Sonic

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: over write default autocomplete function

2006-09-28 Thread bingo

Hi Nate,

I tried what you suggested but its not working...here is what I tried

I tried this in my Author AppModel

var $displayField = 'full_name';
function afterFind($results)
{
foreach ($results as $key => $val)
{

$results[$key]['Author']['full_name'] =
$val['Author']['lname'] . ', ' . $val['Author']['fname'];
}
return $results;
}

and here is my view code

labelTag('Author/full_name', 'Related
Authors');?>
autocomplete('Author/full_name', "",
array('cols' => '45', 'rows' => '5'), "textarea");?>


I have added an option for display textarea instead of textfield in
ajax.php. 

Regards


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Strange behavior with saveField()

2006-09-28 Thread nate

My only guess is that the status field is a tinyint with a field length
of 1.  Within MySQL, Cake reserves this field type for boolean values,
so status is probably being cast as a boolean.  If you change the field
length to 2 or higher, it *should* stop doing that.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: over write default autocomplete function

2006-09-28 Thread nate

Your best bet is to concatenate the fields in the model itself,
specifically in the afterFind model callback.  This allows you to
create a virtual field, i.e. "full_name," so that you can tell your
auto-complete field to use "Person/full_name," and everything else
should work automatically as expected.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Where is the correct place to put this...

2006-09-28 Thread nate

Yeah, you just define it as a method in the model.  It takes the query
results as a parameter, and returns those results to the findAll
method, i.e.:

function afterFind($results) {
for ($i = 0; $i < count($results); $i++) {
// Edit the arrays here...
}
return $results;
}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Paypal Integration

2006-09-28 Thread Jon Bennett

> Thanks for the great reply! I am trying this with a Paypal component I
> found on this list but I think it may be gone, as I can't find it
> again.

ahh, sorry, that would be me. I'll try to sort some time out to write
something on the bakery about it.

jb


 I would like to use the IPN system and test it with a sandbox. I
> have the sandbox and test accounts setup. Do I need to install the PHP
> APIs from the Paypal Integration Centre??
> If you could send me the script that would be great. I will email you
> now.
>
> Thanks!
>
>
> >
>


-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Where is the correct place to put this...

2006-09-28 Thread [EMAIL PROTECTED]

So how does afterFind() work? It sounds just like what i need to add
the comment count to the array.

There does not seem to be much documention about how you use it, im i
right in thinking i just add the function in the model and add any
ammendments to it there?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Strange behavior with saveField()

2006-09-28 Thread Sonic Baker
On 9/28/06, nate <[EMAIL PROTECTED]
> wrote:
No real way to spot the issue without a little more context.  Can youshow where $status comes from?
It's coming from a unit test callint the model Function. Here's the actual test.







	function testUpdateContents()
	{
		$data = array(
'Item' => array(
			'0' => array(
	'item_id' => 2,
	'quantity' => 10,
	'discount_percent' => 15),
			'1' => array(
	'item_id' => 3,
	'quantity' => 12,
	'discount_percent' => 3)));
		debug('$data:');
		debug($data);
		
		$this->assertTrue($this->model->updateContents
($this->validQuoteId, $data));
		$this->model->cacheQueries = false;
		$cart = $this->model->getContents($this
->validQuoteId);
		$this->model->cacheQueries = true;
		
		$this->assertEqual($cart[
'ItemsQuote']['0']['item_id'
], 2);
		$this->assertEqual($cart[
'ItemsQuote']['0']['quantity'
], 10);
		$this->assertEqual($cart[
'ItemsQuote']['0']['item_discount_percent'
], 15);
		$this->assertEqual($cart[
'ItemsQuote']['0']['item_total'
], 465.00);
		$this->assertEqual($cart[
'ItemsQuote']['0']['item_total_discount'
], 69.75);
		
		$this->assertEqual($cart[
'ItemsQuote']['1']['item_id'
], 3);
		$this->assertEqual($cart[
'ItemsQuote']['1']['quantity'
], 12);
		$this->assertEqual($cart[
'ItemsQuote']['1']['item_discount_percent'
], 3);
		$this->assertEqual($cart[
'ItemsQuote']['1']['item_total'
], '528.00');
		$this->assertEqual($cart[
'ItemsQuote']['1']['item_total_discount'
], 15.84);
		
		$this->assertEqual($cart[
'quote_sub_total'], '993.00');
		$this->assertEqual($cart[
'quote_total_discount'], 85.59);
		$this->assertEqual($cart[
'quote_net_value'], '907.41');
		
		$this->assertEqual($cart[
'quote_total_tax'], 190.56);
		
		$this->assertEqual($cart[
'quote_total_price'], '1,097.97');
		
		$this->assertEqual($cart[
'Quote']['status'], 0
);
		
		$this->assertTrue($this->model->updateContents
($this->validQuoteId, $data, 
2));
		$this->model->cacheQueries = false;
		$cart = $this->model->getContents($this
->validQuoteId);
		debug('$cart:');
		debug($cart);
		$this->model->cacheQueries = true;
		$this->assertEqual($cart[
'Quote']['status'], 2
);
	}

Have you tried writing the value of$status to the screen right before the call to saveField? 

Yes, and it  comes out at whatever  I have it set at in the unit test. 
 Do you haveDEBUG up to 2, to see the SQL that is being generated.


Yes  also, the generated SQL gives the folowing no matter what the calue of status:

UPDATE `quotes` SET `status` = '1',`modified` = '2006-09-28 22:18:01' WHERE `id` = '21'

I'm at a loss with this one.

Sonic


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Cake Transactions

2006-09-28 Thread Sonic Baker
Hi Nate,

Thank you for your detailed answer. That's certainly cleared a few things up.

Cheers,

Sonic

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: More Fuel for the "What Is A Model" Debate

2006-09-28 Thread [EMAIL PROTECTED]

If it helps anyone to decide on their approach, I've always thought of
data validation vs process validation. The 'Cake Way' seems to fit very
nicely with that concept.

Data validation logically sits nearest the data model - even as far as
triggers and/or stored procedures within the database if that's your
bag. So data *integrity* is protected no matter what.

Complex inter-model business rule and process validation then seperates
out fairly comfortably into the controller.

There is a nicely textured grey are between all of the letters for some
of us to play in - for the rest there are many long threads on the
merits of 'how best to display negative numbers in red - I don't want
to put business rules in my view' to study and comment on :)

~Philip


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Restrictive Bakery Terms of Service

2006-09-28 Thread nate

I'm pretty sure the whole "reasonable expectation of privacy" thing
has more to do with surveillance and search & seizure


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Strange behavior with saveField()

2006-09-28 Thread nate

No real way to spot the issue without a little more context.  Can you
show where $status comes from?  Have you tried writing the value of
$status to the screen right before the call to saveField?  Do you have
DEBUG up to 2, to see the SQL that is being generated.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Cake Transactions

2006-09-28 Thread nate

They're only implemented at the DBO layer right now, and they don't
happen automatically for anything, so you have to get a reference to
the db in order to use them.  Also, at present, we have no emulation
for non-supporting databases.  So for MySQL for example, you'd need
InnoDB tables.

Each DBO object implements being(), commit(), and rollback(), and you
can use these methods to implement transactions.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Paypal Integration

2006-09-28 Thread [EMAIL PROTECTED]

Thanks for the great reply! I am trying this with a Paypal component I
found on this list but I think it may be gone, as I can't find it
again. I would like to use the IPN system and test it with a sandbox. I
have the sandbox and test accounts setup. Do I need to install the PHP
APIs from the Paypal Integration Centre??
If you could send me the script that would be great. I will email you
now.

Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Cake Transactions

2006-09-28 Thread Sonic Baker
Can anyone tell me the current state of cake Transactions, i.e.
Do they work? 
Do I need to use a particular type of database engine (e.g. MyISAM)?
Is there a tutorial?

Alternatively, can anyone give an expamle of how they are mimicing transaction functionality?

I want to so a series of updates on a few records at once but want to know about (and undo) it if it doesn't work.

Cheers,

Sonic

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Strange behavior with saveField()

2006-09-28 Thread Sonic Baker
Hi there,

I'm using the saveField() function from within a model, like so:


...
...
        if (!is_null($status))
        {
            $this->id = $quote_id;
            $ret[] = $this->saveField('status', $status, true);
        }
...
...
?>
"
The status field is always updated to have a value of '1' no matter what the actual value of $status is.
Can anyone spot why?

Cheers,

Sonic


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: Restrictive Bakery Terms of Service

2006-09-28 Thread [EMAIL PROTECTED]

I think anyone makes the reasonable assumption that if we posted our
code to the Bakery makes it part of the public domain and shareable
regardless of the license for the application from whence that code
originated.  So, I make an application and it is not under a free
license.  But if I extract my code and post to a public domain like the
Bakery then I am forfeighting my rights to the code since no one has to
login to view the code.

Has to do with public domain and reasonable expectation of privacy.  A
code developer has no reasonable expectation of privacy when they post
to a publicly available no login site.  I am not a lawyer either, but
after things getting pretty hairy on a forum I was on this is the gist
of what the lawyer told us.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Paypal Integration

2006-09-28 Thread [EMAIL PROTECTED]

I have worked with Paypal in two ways.  The first way is the
traiditional form submit method.  I make a screen that says nothing,
but sending order to process.  It has hidden variables and then onLoad
uses document.form[''].submit.  That works well.  You could just as
easily make the same form and show the order and have the submit button
actually show up and it say "Accept Order" or something similiar.

The second method I am using now is IPN.  This way I can verify
payments in my app.  You still submit the same form except this time
you can pass invoice, and the IPN postback address as part of the form.
 So, once they successfully pay, Paypal posts to your postback and you
capture the post variables.  Then, you post back to them with fputs or
curl and they post back again with VERIFIED and all the post variables.
 That way you know the post is good.  There are other things to check
to make sure people aren't faking it, but that is the gist of it.  This
way your app knows not only did they go to Paypal, but they paid and
here is how much and details.

I downloaded a sample PHP script that posts to a database from the
Paypal Developer Network.  Email me at support at thephotoedge dot com
and I will email you that script.  Basically I am just working that
into an action.  Nothing real fancy.  The controller is based on the
model of the database they wanted created.

The biggest problem I have had is with tax.  In that sometimes the
tax_cart value wouldn't override the Paypal default settings and would
either double tax or not tax at all.

If you have any specific questions once you look at the intergration
PDF that Paypal puts out and getting the script I will email you later
you can email me questions and I can try and help out.  Once I get my
IPN script working I will try and do a wiki on it.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Paypal Integration

2006-09-28 Thread Chris Hartjes

On 9/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi all,
> I'm trying to integrate Paypal and am having no luck. To be honest I
> don't really know where to start! Does anyone have any experience using
> Paypal with Cake???
>

My first question is this:  do you have any code you've tried to use?
If you've done any sort of work with PHP talking to PayPal using
CakePHP is not really any different.  As I understand it, you talk to
PayPal via some sort of REST interface and interpret the response that
comes back.  Sounds pretty simple to me.

-- 
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Restrictive Bakery Terms of Service

2006-09-28 Thread John Zimmerman
On 9/28/06, emiliano <[EMAIL PROTECTED]> wrote:
> As was stated above, this is to restrict people with commercial interest> from taking articles from the site, and using them on their own site without> permission. It in no way restricts the original creator.
My opinion is this is against CakePHP growth. The Foundation should leteveryone take advantage of the submited code and articles, even if theywant to use it in a commercial application.
Before posting re-read PHPNut's WHOLE post very carefully before replying.  The
commercial restriction deals with re-publication of content.  Use of the
code depends on the license used by the author.  PHPNut is encouraging
(as stated in his post) that you license the code under the MIT license
so that it can be used in the same way the core CakePHP code can.
I know sometimes a non-legal description and possibly examples
are helpful when determining what a Terms of Service agreement is
actually trying to define, but having those won't even help users
who choose to just skim it and remember what they want.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Paypal Integration

2006-09-28 Thread [EMAIL PROTECTED]

Hi all,
I'm trying to integrate Paypal and am having no luck. To be honest I
don't really know where to start! Does anyone have any experience using
Paypal with Cake??? 

Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Restrictive Bakery Terms of Service

2006-09-28 Thread emiliano

> As was stated above, this is to restrict people with commercial interest
> from taking articles from the site, and using them on their own site without
> permission. It in no way restricts the original creator.

My opinion is this is against CakePHP growth. The Foundation should let
everyone take advantage of the submited code and articles, even if they
want to use it in a commercial application.

I think (maybe I`m wrong) that only after using CakePHP in commercial
projects, people would contribute to the Fundation and not the other
way around. If someone is making money using CakePHP, he or she should
contribute if they want. As more one gets from the Bakery, the more
quantity of money the Foundation will receive.

If its not clear, I want the Foundation to get as resources as posible
because I want to use CakePHP!!

cheers


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Where is the correct place to put this...

2006-09-28 Thread Sohei Okamoto
Like other people said, if you already have data set, count($comments) would be good.If you are only interested to the count and not having the data, then I would do$num_comment = $this->Comment->findCount(array("post_id" => $post_id));
$this->set("num_comment", $num_comment);For the formatting functions, if you are formatting data to fit the database format, then I would put them in a component. If you are are formatting data for the view, I would put in a helper.
I think that is the difference and the purpose. Although, I feel that there should be one more thing that combines these two, but that's off topic.Sohei

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: More Fuel for the "What Is A Model" Debate

2006-09-28 Thread Sonic Baker
I agree, here here!!! :-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: over write default autocomplete function

2006-09-28 Thread bingo

hi bakers,

It seems my post was confusing. I will try to explain my problem again.
I am trying to concatenated result from two fields in the autocomplete.
Specifically, I have person name as first_name and last_name. In the
autocomplete box, I want to show the full name of the person. Can
anyone tell me how can I do this. I am using autocomplete component
written by Nate. I also having another problem with the size. I tried
setting the size using array('size' => '200') for autocomplete input
box, but it didn't set the size.

Regards


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: save given values in database

2006-09-28 Thread [EMAIL PROTECTED]

You could also do a form with hidden input.  And then stylize the
submit button to be a link.  Or make a link out of it.

Input
Add


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: save given values in database

2006-09-28 Thread [EMAIL PROTECTED]

function index($value1 = null, $value2 = null) {
  if (!empty($value1)) {
$data['Input']['value1'] = $value1;
$data['Input']['value2'] = $value2;
if ($this->Input->save($data)) {
  $this->Session->setFlash('Data saved.');
  $this->redirect('/users');
}
}

Then in your view the call would be $html->link('Link',
'/input/index/value1/value2');

This is more CakePHP like and definitely gets you away from playing
with the URL or $_GET arrays.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: generateList with Value combined from 2 table fields?

2006-09-28 Thread [EMAIL PROTECTED]

Good job at putting it altogether Shoei.

Remember to use your callbacks where you can people!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Where is the correct place to put this...

2006-09-28 Thread [EMAIL PROTECTED]

If you are using recursion and association you simply count the related
array to get the records.  count($data['Comment']).  I would advise
against making a requestaction call to retrieve it or putting hack code
in the view.

Another more elegant solution is to utilize the afterFind.  Just
remember that any "virtual" fields you add only work on find calls.  So
you would need to use findById() instead of read(null, $id).  or even
the setid, read.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: generateList with Value combined from 2 table fields?

2006-09-28 Thread Sohei Okamoto
I am sure this was mentioned somewhere before, adding the field to the result in afterFind() is one way.Additionally, if you specify $displayField, you don't need to have that last two arguments.So, with the $displayField,
$this->set('user', $this->Transaction->User->generateList(null, 'last_name ASC, first_name ASC'));
Otherwise,$this->set('user', $this->Transaction->User->generateList(null, 'last_name ASC, first_name ASC', null, '{n}.User.id', '{n}.User.full_name'));And here is the User with afterFind:
class User extends AppModel{    var $name = 'User';    var $displayField = 'full_name';    function afterFind($results)    {    foreach ($results as $key => $val)     {    $results[$key]['User']['full_name'] =
    $val['User']['last_name'] . ', ' . $val['User']['first_name'];    }    return $results;    }    }Hope this helps.Sohei

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Re: More Fuel for the "What Is A Model" Debate

2006-09-28 Thread [EMAIL PROTECTED]

Sonic Baker:

I guess I was kind of loose in that other posting about my definition
of business logic.  Business logic to me is what RUNS the show.  The
manager (controller) is what runs the show.  That doesn't mean that
model (Regional Manager) doesn't enforce their own logic.  Good that we
went back to the key DRY.  As long as you are ahdering to that you
should be fine.  I just didn't want you to be sititng struggling for
hours trying to figure out how to move all code into the models and
have the controllers only callling a bunch of methods.

I must admit that I probably have used a protected action in a
controller when I should have put it in the model.

Chris:  I just redid my application to remove a lot of the confusion
from my controllers.  I am calling more methods in my controller and it
is controlling and the model is doing more data manipulation.

Just now I thought of code I have replicated between two actions that I
can place in the model.  I just tend to forget that you can still use
associated model calls in the models.  It isn't limited to the
controller since I used to overuse the $uses array.  So to help me keep
things simple I have cut WAY down on the uses array, placed code that
is used more than one in the model.  This has simplified my controllers
and made the logic of what happens much easier to follow.

Nice post.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Javascript only for a specific controller

2006-09-28 Thread [EMAIL PROTECTED]

I love that Cake 1.2 is going to get some more automagic!!  I love
automagic!!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Load Text from a textfile

2006-09-28 Thread Daniel Pape

hi.
ok, and now it works?! fine.


cheers.



> I used that piece of code:
>  $textfile = "text1.txt";
>  readfile($textfile);
>
> The only problem i had, was that the textfile was in the wrong folder
> so he couldn't find that file.
>
> Thanks
>
>
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: incorporating many views

2006-09-28 Thread Daniel Pape

oh, right. my fault. sorry! :o)

nate schrieb:
> Also, in the example above, you don't add the ".thtml" to the file
> name. So it's just:
>
> $this->renderElement('partofview');
>
> Just FYI.
>
>
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: incorporating many views

2006-09-28 Thread nate

Also, in the example above, you don't add the ".thtml" to the file
name. So it's just:

$this->renderElement('partofview');

Just FYI.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: incorporating many views

2006-09-28 Thread nate

That could mean you're trying to use a helper in the element that's not
being loaded in the main (calling) controller.  What do you mean by
"link the view back to it's controller"?  Make an  link back to an
action in that controller?

Elements aren't view specific, so they aren't bound to a given
controller, but what you could do is use the requestAction method like
so:

$this->requestAction("/controller/action/param");

which allows you to render one view inside of another.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: ordering in associations

2006-09-28 Thread nate

This is off-the-cuff and completely untested, but it's going to work
out something like this:

class Movie extends AppModel {
var $hasAndBelongsToMany = array("Director" => array(
"fields" => "DISTINCT Director.name",
"limit" => 30
);
}

Then you can do:
$this->Movie->findAll(null, null, "Movie.position");


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Javascript only for a specific controller

2006-09-28 Thread nate

In Cake 1.2, we've added a layout variable called $scripts_for_layout.
You can drop it in your  and do the following in a view:

$javascript->link('prototype', false);

and it automagically gets inserted there.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Load Text from a textfile

2006-09-28 Thread [EMAIL PROTECTED]

I used that piece of code:
 $textfile = "text1.txt";
 readfile($textfile);

The only problem i had, was that the textfile was in the wrong folder
so he couldn't find that file.

Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: More Fuel for the "What Is A Model" Debate

2006-09-28 Thread nate

I've posted a few thoughts on this topic as well:
http://groups.google.com/group/cake-php/msg/9cd850341af29136

Also keep in mind that just because we have done something one way,
doesn't mean (unless we say so ;-) ) that that way is the best or only
way to do it.  You're right in your thinking that business logic can be
in the model.  In almost all cases, the overriding principle is DRY.
If putting a piece of logic in a model helps you maintain that, then
that's where the logic most likely belongs.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: incorporating many views

2006-09-28 Thread michael234

Thanks, that's very interesting.
Can you tell me once called, how do you link the view back to it's
controller.
At the moment I get
 Fatal error: Call to a member function on a non-object in
 /app/views/elements/tasks/index.thtml on line 9

the file index.thtml i'm calling from being in /app/views/enquiries


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: ordering in associations

2006-09-28 Thread D. Pape

hi spark.

can you post your association code please?
i am a little bit confused. ;o)

cheers.
daniel


>  I have a Movie and a Director models, both with HABTM associations.
> The movie is ranked in my site and have a Movie.position field.
>  I could not find a way to show , let's say, the 30 first directors
> (DISTINCT) ordered by the Movie.position. Any ideas ? custom SQL calls
> only ?
>
>  thanks
>  spark
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



ordering in associations

2006-09-28 Thread DJ Spark

 I have a Movie and a Director models, both with HABTM associations.
The movie is ranked in my site and have a Movie.position field.
 I could not find a way to show , let's say, the 30 first directors
(DISTINCT) ordered by the Movie.position. Any ideas ? custom SQL calls
only ?

 thanks
 spark

-- 
[web] http://synapsisdi.com.br
[livesets] http://djspark.com.br/mp3

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Load Text from a textfile

2006-09-28 Thread D. Pape

hi felix.

i think you can use the file class.

there?s a post on cakebaker: 
http://cakebaker.42dh.com/2006/09/20/how-to-use-the-file-class-from-the-core/

cheers.


> Hi there,
>
> i need to load some text from a atextfile and show it on the screen.
> I placed my textfile (text1.txt) in the webroot-folder and try to open
> it that way:
>
> index.thtml:
>  $textfile = "text1.txt";
>  readfile($textfile);
>
> but i get the message: "Warning: readfile(text1.txt): failed to open
> stream: No such file or directory"
>
> What is wrong? and can i use a html-helper?
>
> Thanks,
> Felix
>   

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Load Text from a textfile

2006-09-28 Thread [EMAIL PROTECTED]

Hi there,

i need to load some text from a atextfile and show it on the screen.
I placed my textfile (text1.txt) in the webroot-folder and try to open
it that way:

index.thtml:
 $textfile = "text1.txt";
 readfile($textfile);

but i get the message: "Warning: readfile(text1.txt): failed to open
stream: No such file or directory"

What is wrong? and can i use a html-helper?

Thanks,
Felix


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: incorporating many views

2006-09-28 Thread D. Pape

hi michael.

there is a folder in the views folder called elements! This folder 
contains views (*.thtml) which can rendered in a view with

$this->renderElement('partofview.thtml');

Check out: http://manual.cakephp.org/chapter/views

Cheers.


> What I want to know is what is the best way of bringing together many
> views into one page. For example if I want a report from my database
> but also a ToDo application running in the same page. Is there a way to
> include .thtml pages into one single page?
>
>
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



incorporating many views

2006-09-28 Thread michael234

What I want to know is what is the best way of bringing together many
views into one page. For example if I want a report from my database
but also a ToDo application running in the same page. Is there a way to
include .thtml pages into one single page?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Where is the correct place to put this...

2006-09-28 Thread Mathieu Gagnon

If the model where pass as object to the view instead of array you would 
use it right away.
For now i think you either set it in the controller or write it in the 
view, either inline if its very trivial (i think count($comments) count 
as it) or inside a custom helper.

Or if its very trivial, have a  inside the view.

I think the best way would be to use a custom helper in the view.
$custom->countComment($comments)

[EMAIL PROTECTED] wrote:
> Sorry to once again start another new thread but im having trouble
> finding where i should put functions to which i would use inside the
> view.
>
> I wish to create a countComment($post_id) function that will do... well
> what it says on the tin and return a count of the comments for the
> $post_id given.
>
> Would this function go in the model? and if so how do a reference it in
> the view?
>
> I also have a number of formatting functions i will be creating that
> will need to take data, change it then return it back.
>
> Im assume these should go in the model as well? or should i be creating
> these as components?
>
>
> >
>
>   


-- 
Mathieu Gagnon, programmation web
2649 Bourbonnière appt. 6Tel.: (514) 256-9437
Montréal (Québec) H1W 3P5Courriel.: [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Where is the correct place to put this...

2006-09-28 Thread Chris Hartjes

On 9/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Sorry to once again start another new thread but im having trouble
> finding where i should put functions to which i would use inside the
> view.
>
> I wish to create a countComment($post_id) function that will do... well
> what it says on the tin and return a count of the comments for the
> $post_id given.
>
> Would this function go in the model? and if so how do a reference it in
> the view?

Having seen the light two days ago, I would advise to put the
functionality in the model.  Then, in your controller you would grab
the results of this function and then use a $this->set('foo', $bar)
type of assignment ot make it available in the view.

> I also have a number of formatting functions i will be creating that
> will need to take data, change it then return it back.
>
> Im assume these should go in the model as well? or should i be creating
> these as components?
>

If you are going to take the same data and display it multiple ways in
the view, then I think a component would be the best way to go.  I'm
sure other people will correct me if I'm wrong.


-- 
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: CakePHP Test Suite -- 'Inflector' not found

2006-09-28 Thread Sonic Baker
Hi Brian, maybe this will be of hekp to you:
http://groups.google.ie/group/cake-php/browse_thread/thread/8815708bcb1c8b/c054815ad5d09804?lnk=gst&q=test+suite&rnum=1#c054815ad5d09804


Cheers,

Sonic

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/cake-php  -~--~~~~--~~--~--~---


Where is the correct place to put this...

2006-09-28 Thread [EMAIL PROTECTED]

Sorry to once again start another new thread but im having trouble
finding where i should put functions to which i would use inside the
view.

I wish to create a countComment($post_id) function that will do... well
what it says on the tin and return a count of the comments for the
$post_id given.

Would this function go in the model? and if so how do a reference it in
the view?

I also have a number of formatting functions i will be creating that
will need to take data, change it then return it back.

Im assume these should go in the model as well? or should i be creating
these as components?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: save given values in database

2006-09-28 Thread [EMAIL PROTECTED]

I found a solution by myself:

My controller looks like this:

function index()
   {
if (!empty($this->params['url']))
   {
   if($this->Input->save($this->params['url']))
   {
   $this->Session->setFlash('Daten übernommen');
   $this->redirect('/users');
   }
   }
}


Thanks for the help!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: save given values in database

2006-09-28 Thread Bert Van den Brande

Just a quickie, don't have a lot of time :

$array['attribute1'] = $_GET['value1'];
$array['attribute2'] = $_GET['value2'];

$this->Input->save($array);

On 9/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Could you please give me an example how something like that would look
> like in my index.thtml and inputs_controller.php files?
> Sorry, for the beginner question.
>
> Thanks
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: save given values in database

2006-09-28 Thread [EMAIL PROTECTED]

Could you please give me an example how something like that would look
like in my index.thtml and inputs_controller.php files?
Sorry, for the beginner question.

Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: save given values in database

2006-09-28 Thread Bert Van den Brande

Simply pass an array of keys and values into the save method and Cake
will try to map those keys to columns and save the values for you ...


On 9/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Sorry, i still habe a little Problem understanding the way i pass the
> params.
>
> In my "index.thtml" I have this code:
>
> if (isset($_GET['value1'])){
>   $value1=$_GET['value1'];
> }
>
> And now i would like to have a solution to save this value to into the
> table "Input".
> Something like:
> $this->data['Input']['value1'] = $value1;
>
> Is that possible?
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: save given values in database

2006-09-28 Thread [EMAIL PROTECTED]

Sorry, i still habe a little Problem understanding the way i pass the
params.

In my "index.thtml" I have this code:

if (isset($_GET['value1'])){
  $value1=$_GET['value1'];
}

And now i would like to have a solution to save this value to into the
table "Input".
Something like:
$this->data['Input']['value1'] = $value1;

Is that possible?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: save given values in database

2006-09-28 Thread Bert Van den Brande

http://wiki.cakephp.org/docs:controller:params should help :)

Alternatively you can setup your routing to pass arguments to the
index() method 



On 9/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
> i have a table in the database called "input" and an index-page, where
> the controller looks like that:
>
> function index()
>{
>   if (!empty($this->data['Input']))
>{
>if($this->Input->save($this->data['Input']))
>{
>  $this->Session->setFlash('given Data saved');
>  $this->redirect('/users');
>}
>}
> }
>
> I get some values of variables with a query string
> ("http://127.0.0.1/index.php?value1=1&value2=2";).
> How can i save those values in the "input"-table of the database. The
> only way to save things i found, was with the use of forms.
>
> Thanks
>
> Felix
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Playing with Ajax... not very well!

2006-09-28 Thread RosSoft

put var $helpers=array('Html','Javascript','Ajax') in your
APPCONTROLLER. You're using javascript helper in default.thtml
template, then put Javascript helper available to all controllers.

lorenzo ha escrito:

> $javascript->('prototype') !
> This must be :
> echo $javascript->link('prototype');


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



save given values in database

2006-09-28 Thread [EMAIL PROTECTED]

Hi there,

i have a table in the database called "input" and an index-page, where
the controller looks like that:

function index()
   {
  if (!empty($this->data['Input']))
   {
   if($this->Input->save($this->data['Input']))
   {
 $this->Session->setFlash('given Data saved');
 $this->redirect('/users');
   }
   }
}

I get some values of variables with a query string
("http://127.0.0.1/index.php?value1=1&value2=2";).
How can i save those values in the "input"-table of the database. The
only way to save things i found, was with the use of forms.

Thanks

Felix


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Playing with Ajax... not very well!

2006-09-28 Thread lorenzo

$javascript->('prototype') !
This must be :
echo $javascript->link('prototype');


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: MySQL request in controller

2006-09-28 Thread [EMAIL PROTECTED]

Thanks for the hint with "findById"!
My solution now is:

function delete($id)
{
$myuser = $this->User->findById($id);
   if ($this->User->del($id))
   {
   $this->Session->setFlash('Customer 
:'.$myuser['User']['name'].'
deleted.');
   $this->redirect('/users');
   }
}

Thanks for the help!
Cheers


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Is this the correct use of Models?

2006-09-28 Thread Jon Bennett

> It seems a bad idea to me to do it like this from a performance point
> of view. A findAll() fetches all rows from the database, while a
> count(*) in the database returns only one row with the count.

umm, yes, it would be a bad thing - however, this is probably
happening anyway because of the 'hasMany' and 'belongsTo' association.
Unless you disable the associations with unbindModel or by setting
recursive to 0, you might as well use the existing data, rather than
run an extra findCount on the Comments model.

if you find it slow, then you do want to look into using unbindModel
so you're not returning hundreds of records for each post.

// this line turns off the hasMany asssociation
$this->Post->unbindModel (array('hasMany'=>array('Comment')));

// this line turns off all associations
$this->Post->recursive = -1;

hth,

jon

-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Playing with Ajax... not very well!

2006-09-28 Thread [EMAIL PROTECTED]

I've no deleted the entire page and looking at starting again...

All that was on line 14 was a $javascript->('prototype'); which worked
on the page untill you submitted the form...

I have just try grahambird's Ajax tutorial and got it working, so im
going to give it another go from scratch.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Playing with Ajax... not very well!

2006-09-28 Thread lorenzo

Post your #14 please ;)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Playing with Ajax... not very well!

2006-09-28 Thread [EMAIL PROTECTED]

Yeah, they are set in both controllers - it submits the data, it just
does not update the comments div afterwards and shows the above error


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Playing with Ajax... not very well!

2006-09-28 Thread lorenzo

Be sure that in your controller you have:
var $helpers = array('Html','Javascript','Ajax');


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Playing with Ajax... not very well!

2006-09-28 Thread lorenzo

Be sure that in your controller you have:
var $helpers = array('Html','Javascript','Ajax');


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Playing with Ajax... not very well!

2006-09-28 Thread lorenzo

Be sure that in your controller you have:
var $helpers = array('Html','Javascript','Ajax');


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: MySQL request in controller

2006-09-28 Thread Martin Schapendonk

On 9/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Thanks for the reply,
> but I still don't know how to save the name of the user. Sorry for the
> beginner questions, but I'm new to cakePHP.

I recommend you read some more tutorials and code examples to get more
familiar with the basic CakePHP functionality.

It would look something like

$user = $this->User->findById($id);

then you set the message with:

$this->Session->setFlash('Customer ' . $user['name'] . ' deleted.');

Regards,

Martin

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Route : defaut action for a controller

2006-09-28 Thread AD7six

This conversation seems much bigger than the problem being discussed :)

Why not
Define one route for /galleries/ (that uses the method index or
whatever you want to call it)
Define one route for /galleries/history/* (that uses the method
history)
Define one route for /galleries/* (that calls the method view, and
expects parameters).

But the url should be the last thing to consider, especially as most
people don´t bother to look at it :).

Anyway, just an idea,

AD7six


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: MySQL request in controller

2006-09-28 Thread [EMAIL PROTECTED]

Thanks for the reply,
but I still don't know how to save the name of the user. Sorry for the
beginner questions, but I'm new to cakePHP.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: MySQL request in controller

2006-09-28 Thread Martin Schapendonk

On 9/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> function delete($id)
> {
>   if ($this->User->del($id))
>   {
>  $this->Session->setFlash('Customer '.$id.' deleted.');
>  $this->redirect('/users');
>   }
> }
>
> Instead of $id, i would like to print out the name of the customer. My
> table in the database is calles "users" and the field's name is "name".
> How can i request that name in cakephp?

Do a $this->User->findById($id) before the del() and store the name in
a variable.

-- 
  Martin Schapendonk, [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Route : defaut action for a controller

2006-09-28 Thread [EMAIL PROTECTED]

xOrster: what a user want's to have a gallery named "list" ? what then?
I think it's not a good way to define the second url parameter as a
method parameter

I think the best way would be something like
http://host/galleries/gallery/foo

but I know it would be better your way, is just you are limiting your
users.

And if you want this functionallity anyway (you would need to make sure
a user doesn't name their galleries as your controller's methods) is
not that hard add routes for each of your methids manually... is not
that you are adding new methods each hour!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Playing with Ajax... not very well!

2006-09-28 Thread [EMAIL PROTECTED]

Right, im trying to get my head around the Ajax helper but im having a
bit of trouble.

http://cake.phunky.co.uk/posts/view/3

The form submits and updates mysql, but when it comes to updating the
div#comments it throws back a error

Fatal error: Call to a member function on a non-object in
/home/cake/public_html/app/views/layouts/default.thtml on line 14

Line 14 is where i user the javascript helper to include prototype.js

Any ideas why? i've set the $helpers in both $comments and $posts
controller


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



MySQL request in controller

2006-09-28 Thread [EMAIL PROTECTED]

Hi there!

I have got this function in my controller, which deletes the selected
customer from the table:

function delete($id)
{
   if ($this->User->del($id))
   {
  $this->Session->setFlash('Customer '.$id.' deleted.');
  $this->redirect('/users');
   }
}

Instead of $id, i would like to print out the name of the customer. My
table in the database is calles "users" and the field's name is "name".
How can i request that name in cakephp?

Thanks,

Felix


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---