working with different databases with same table names

2011-08-15 Thread abhimanyu bv
Hi all,
I have two databases with same table names. i have to save a record in
both the tables in different databases.how should i implement this in
cakephp.
thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


No CSS styling in Cake setup - tried everything

2011-08-15 Thread koreill1
I've been trying for hours and days to get cake setup on my new mac
laptop.  I've got it setup on my iMac fine, so I'm not sure what the
problem is.

I have cake unpacked in /Users/koreill1/Sites/ ... the .htaccess files
are there and readable.

I modified my httpd.conf file so that mod_rewrite is uncommented and
enabled.

I set DocumentRoot to '/Users/koreill1/Sites/'

I have "Allowoverride All" set in both Directory / and my document
root.

I'm trying to open cake at http://localhost/cake/... it opens without
CSS styling, even though I can see 
http://localhost/cake/app/webroot/css/cake.generic.css
is there.

I feel like i'm going crazy, but I can't get css/mod_rewrite working!
Appreciate your help.

-Kyle

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Setting default value with a query

2011-08-15 Thread David Brotman
I have an input field in a form called transaction_amount and a select field 
called transaction_type and a select field called tenant. What I would like 
to do is populate the transaction_amount field with the most recent 
transaction entry (transaction_date) for the selected tenant where the 
transaction_type = 1 or transaction_type = 2. In this scenario, I want the 
transaction_amount to be repopulated each time the tenant is changed and 
each time the transaction_type is changed between 1 and 2.


Form View:
input('tenant_id',array('label'=>''));?>
input('transaction_type_id',array('label'=>''));?>
input('transaction_date',array('label'=>''));?>
input('transaction_amount',array('label'=>'','class'=>'textsmall'));?>

In the transaction controller, I have a function to find the transaction 
amount:

function getAmount()
{
  $tenant_id = $this->data['Transaction']['tenant_id'];
  $transaction_type = $this->data['Transaction']['transaction_type'];
  
  $result = $this->Transaction->query("select transaction_amount from 
transactions WHERE transaction_date = 
  (SELECT MAX(transaction_date) FROM transactions WHERE tenant_id = 
\"$tenant_id\" and transaction_type = $transaction_type)"); 
 $this->set('transaction_amount',$result);
}

Is this the right way to approach this problem? All of the examples on the 
internet assume I am populating a select box. Any help would be appreciated.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Running javascript on render

2011-08-15 Thread Randy
I'm trying to format input boxes based on the input data.
In particular there is an asset field that is available (or not) based
on a type field.
If the type field is changed to one of several options the asset field
display is turned on and off.

I have it working using a small javascript function within the view,
when an item type is changed.   But I want to use the same javascript
to run when the view is loaded for default behavior.

I tried the windows.onload, but this runs before the page is rendered,
and crashes because the fields on the page have not been created yet.

Anybody have an Idea how to accomplish this?

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Missing Database Table

2011-08-15 Thread culp
Hello, I'm new to cake so please bear with me here.

I've set up an application locally, tested it and all runs fine.  I've
uploaded it to a remote production server and, with exactly the same
settings I'm getting the following error message

Missing Database Table

Error: Database table shipments for model Shipment was not found.

Troubleshooting so far:-

I've checked through phpmyadmin and the table does exist.

I've cross checked core.php and phpmyadmin and the database names do
match

I've emptied the tmp/cache directories on the remote server.

I've uncommented the line "Configure::write('Cache.disable', true);"
in core.php

Configure::write('debug', 3); on the remote site.

Stilll having the same error messages.

Possible theories:-

The database name is "gacworld_shipments" the table name is
"shipments" on the remote server, is the similar name causing a clash?
My local version that works has a database named gacworldwide.

On my local version I'm using the root mysql user, on the remote
version I'm not, is it some sort of user priviledge problem?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Wrestling with *very* basic Auth

2011-08-15 Thread LCR
Hi there,

Hoping someone can help me keep the rest of my hair... I've spent the
last day looking over so many Auth tutorials and haven't got anywhere.
For some reason I haven't been able to get my head around it so far,
so I've come on here in the hope of getting a specific example that
helps me with my specific case (which I don't think is uncommon). For
someone with more experience with the framework, this should be a
piece of cake! wink.gif

I'm building a site in CakePHP (v1.3.10) that needs an admin back-end
accessed via "/cms". The back end must be accessed by a single user
log-in. Once they are logged in, they can use all the features of the
CMS, and if they try to access any of the CMS while not logged in,
they should get redirected to the CMS login page. It's that simple!

In routes.php I have the following:

Router::connect('/cms', array('controller' => 'homepages', 'action' =>
'index', 'admin' => true));

My homepages_controller is responsible for showing the public-facing
home page, and currently the index() action also takes care of
checking to see if it should display the CMS login page:

function index() {
 if ( isset($this->params['admin']) && $this->params['admin']) {
  $this->layout = false; # We'll just use the view for now
  $this->viewPath = 'cms';
  $this->render('index');
 }

 $this->Homepage->recursive = 0;
 $this->set('homepage', $this->Homepage->find('first'));
 $this->set('title_for_layout', 'my title');
}

There's also a cms_index() action in the homepages_controller which is
currently commented out, and ideally I think I'd like that to
automatically take care of showing the CMS login page without me
having to check the 'admin' parameter in the front-end index() action.

In my core.php I have the following:

Configure::write('Routing.prefixes', array('cms'));


I also know that in my app_controller file I need to put:

var $components = array('Auth')


I have set up my users table with id, username and password.

It's where to go from here, and how to configure the Auth component,
that has me stumped.

Would any kind souls like to share with me what the next step might
be? (Incidentally, I can't use the .htaccess method to achieve this -
I need to use the Auth component if at all possible.)

Many thanks in advance.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How to specify a count(id) field for find method

2011-08-15 Thread gremlin
Or use a virtual field.

On Aug 15, 11:44 am, Roland Pish  wrote:
> Thanks Jeremy.
> I looked at the cookbook with the link you provided and I realized
> that I'm having the same output as the example showed there, the
> 'MIN(Product.price) as price' field is returned in the array with 0 as
> its index but not 'Product' as its index.
> Now I know that I'm doing it the right way :) and I will have to deal
> with the 0 index, but no problem at all.
>
> Thanks!
>
> On 14 ago, 22:26, Jeremy Burns | Class Outfit
>
>
>
>  wrote:
> > From the cookbook 
> > (http://book.cakephp.org/view/1030/Complex-Find-Conditions):
>
> >         • array('fields'=>array('Product.type','MIN(Product.price) as 
> > price'), 'group' => 'Product.type');
>
> > Jeremy Burns
> > Class Outfit
>
> >http://www.classoutfit.com
>
> > On 14 Aug 2011, at 22:54, Roland Pish wrote:
>
> > > Thanks for your reply euromark.
> > > I tried the find->('count' but it just returns a number, not the
> > > records grouped by 'status' field.
>
> > > On 14 ago, 15:09, euromark  wrote:
> > >> $this->Member->find('count', ...)
> > >> it should be in the cookbook, the documentation of cakephp
>
> > >> On 14 Aug., 22:29, Roland Pish  wrote:
>
> > >>> Hello.
> > >>> I need to issue a query like:
>
> > >>> select count(id) as total,status from members group by status
>
> > >>> When specifying the fields for the model find method I do this:
>
> > >>> $fields = array('count(Member.id) as total','Member.status');
> > >>> $members = $this->Member->find('all',array('fields'=>
> > >>> $fields,'group'=>'Member.status'));
>
> > >>> But the resulting array doesn't put 'total' field within
> > >>> $members['Member'] but in $members[0]. How should I write the 'total'
> > >>> field in order to be pushed into $members['Member']?
>
> > >>> Thanks in advance
>
> > > --
> > > Our newest site for the community: CakePHP Video 
> > > Tutorialshttp://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: console errors when running 2.0 Console/cake

2011-08-15 Thread #2Will
Hi Jose,

i am on 2.0.0-beta

I downloaded again just now and tried it again without the debug_kit
plugin.  Same result.

i'm trying to fiddle about with debug statements, but not getting
far.

The $matches array for that first missing index ('tag') is:

## DEBUG ##
Array
(
[0] => Notice Error:
[1] => error
[2] => Notice Error:
[3] => error
)

###

which dosn't look good. Looking up at whats calling this function,

return preg_replace_callback(
'/<(?[a-z0-9-_]+)>(?.*?)<\/(\1)>/ims', 
array($this,
'_replaceTags'), $text
);
where $text is

Notice Error: Undefined index:  tag in [/Users/
willbarker/Dropbox/elip/lib/Cake/Console/ConsoleOutput.php, line 197]

Obviously if i amend my styleText function to just dish out the $text
as it is fed it, i get something quite passable,

Welcome to CakePHP v2.0.0-beta Console
---
App : app
Path: /Users/willbarker/dropbox/elip/app/
---
Interactive Bake Shell
---
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)


and the < question > tags etc are ok.  But all this makes me wonder
whats up with my set up.

Thanks for checking this for me. its sort of working with the hacked
ConsoleOutput.php, but I'd be interested in getting to the bottom of
it still.  It makes me wonder what could be up with my setup?

will




On Aug 16, 1:17 am, José Lorenzo  wrote:
> I am on the same setup as you are, and just ran the command as you described
> without any errors. Can you confirm you have the latest 2.0 code?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Multiple model

2011-08-15 Thread Mohd Hasnol
FYI, Im using ACL for this case.

On Tue, Aug 16, 2011 at 12:26 PM, nOLL  wrote:

> Hi,
>
> Let say, I'm admin and i would like to add agents but i would like to
> use different model (not users model). For example, agents model. the
> reason i use different model because there is other attributes i would
> like to fill in rather than username and password in users model. What
> is the best solution for this?
>
> Thanks.
> nOLL
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Multiple model

2011-08-15 Thread nOLL
Hi,

Let say, I'm admin and i would like to add agents but i would like to
use different model (not users model). For example, agents model. the
reason i use different model because there is other attributes i would
like to fill in rather than username and password in users model. What
is the best solution for this?

Thanks.
nOLL

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Load components in components

2011-08-15 Thread Điển vũ
Thanks a lot.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Load components in components

2011-08-15 Thread Điển vũ
I asked in cakephp IRC, A person answer is not:

> [11:05]  it will not be slow, I believe it passes those around via 
reference 
>
>[11:05]  so you have nothing to worry about

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Load components in components

2011-08-15 Thread Điển vũ
if i use and create much components and that components use other components 
.It will make  app is very slow?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Accessing another controllers function.

2011-08-15 Thread Tilen Majerle
$this->requestAction();
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2011/8/15 Michael Gaiser 

> So I have 2 controllers. Domain, & Location. Domains have several
> locations. The Location controller has a function called "report"
> which I want to be able to call from my domain controller to generate
> the reports for each of its locations. I was thinking that I could
> just do it like this:
> $report = $this->Domain->Locations->report($id)
>
> But that doesn't seem to work. Is there a way to do this or is my
> thinking backwards on this one? Thanks.
>
>
> ~Michael
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Accessing another controllers function.

2011-08-15 Thread Michael Gaiser
So I have 2 controllers. Domain, & Location. Domains have several
locations. The Location controller has a function called "report"
which I want to be able to call from my domain controller to generate
the reports for each of its locations. I was thinking that I could
just do it like this:
$report = $this->Domain->Locations->report($id)

But that doesn't seem to work. Is there a way to do this or is my
thinking backwards on this one? Thanks.


~Michael

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Using SELECT... FOR UPDATE in cakephp

2011-08-15 Thread 0x20h
Am 15.08.2011 21:08, schrieb Teddy Zeenny:
> Oh you are definitely right.  I made up the example as I was writing
> the post, this is not a real case in my application.. Besides, I use
> ACL for privileges :)
>
> But such cases do happen (inserting or updating based on a SELECT
> result) and it can't always be solved with 1 save as it might depend
> on results from multiple queries from multiple tables (Hence the need
> for locking).
>
> GET_LOCK almost always solves it. (I had never used it before. I
> researched it when you mentioned it).  Correct me if I'm wrong, but I
> noticed that the drawback of GET_LOCK is that you need to know which
> scripts might have common results in order to make them require the
> same lock.
>
> example:
>
> script 1:  SELECT * FROM employees WHERE position='manager';
>if (condition)
>UPDATE employees SET  ...
>
> script 2:  SELECT * FROM employees WHERE salary>= 2000;
>   if(condition)
>   UPDATE employees SET ...
>
>
> Here one would probably make them both require the same lock ( like
> GET_LOCK('employee_update')) to ensure they don't change each others'
> results if run at the same time, and therefore make them wait for each
> other every time they run concurrently. SELECT FOR UPDATE on the other
> hand would only make them wait for each other if, in that particular
> instance, they had common records.
Yup, thats the difference between adivsory and explicit locking.
Personally, I used GET_LOCK when doing cache updates to prevent
stampeding (e.g. multiple clients start refreshing an expensive cache
entry, your server ends up doing the same multiple times, then after
waiting a while the users start to press F5 :-) ).
As I mentioned before, GET_LOCK returns immediately so all following
processes could be served the old content while only 1 process builds up
the new one.
In this case the choice on the lock key is easy as it is the equivalent
of the cache key itself. In other cases it might be possible to generate
a key for the lock
that would do the locking the way you want.
If you are working on a site thats used by a lot of users then SELECT
FOR UPDATE is probably a showstopper.

Anyway, to get back to your original question:
Although FOR UPDATE is in the SQL standard, it might not be supported by
all datasources. I think its a good case
for the usage of a custom query() (this method might only exist for a
case like this).

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Using SELECT... FOR UPDATE in cakephp

2011-08-15 Thread Teddy Zeenny
Oh you are definitely right.  I made up the example as I was writing the
post, this is not a real case in my application.. Besides, I use ACL for
privileges :)

But such cases do happen (inserting or updating based on a SELECT result)
and it can't always be solved with 1 save as it might depend on results from
multiple queries from multiple tables (Hence the need for locking).

GET_LOCK almost always solves it. (I had never used it before. I researched
it when you mentioned it).  Correct me if I'm wrong, but I noticed that the
drawback of GET_LOCK is that you need to know which scripts might have
common results in order to make them require the same lock.

example:

script 1:  SELECT * FROM employees WHERE position='manager';
   if (condition)
   UPDATE employees SET  ...

script 2:  SELECT * FROM employees WHERE salary>= 2000;
  if(condition)
  UPDATE employees SET ...


Here one would probably make them both require the same lock ( like
GET_LOCK('employee_update')) to ensure they don't change each others'
results if run at the same time, and therefore make them wait for each other
every time they run concurrently. SELECT FOR UPDATE on the other hand would
only make them wait for each other if, in that particular instance, they had
common records.



On Mon, Aug 15, 2011 at 9:29 PM, 0x20h wrote:

> Am 14.08.2011 12:46, schrieb Teddy Zeenny:
> > That is an interesting idea. (Although I don't think it would give me
> > the exact SELECT .. FOR UPDATE functionality, but I guess it's as
> > close as I can get).
> It would only allow 1 Process to access the if clause and it would
> return *immediately* on *all* clients while FOR UPDATE blocks all other
> processes that try to
> SELECT the particular id (could be many, could be long). Of course,
> while SELECT...FOR UPDATE explicitly locks the row, the GET_LOCK
> functionality is an advisory technique where all participating sides
> have to obtain the lock (e.g. the code part that takes away the is_admin).
>
> Anyway, I think your concerns are a bit overkill and probably a flaw in
> your application design (e.g. why would you have an is_admin flag and
> then later set privileges => 'all' in another query)
> Would it not solve the problem if you had a save() that does both at once?
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How to specify a count(id) field for find method

2011-08-15 Thread Roland Pish
Thanks Jeremy.
I looked at the cookbook with the link you provided and I realized
that I'm having the same output as the example showed there, the
'MIN(Product.price) as price' field is returned in the array with 0 as
its index but not 'Product' as its index.
Now I know that I'm doing it the right way :) and I will have to deal
with the 0 index, but no problem at all.

Thanks!

On 14 ago, 22:26, Jeremy Burns | Class Outfit
 wrote:
> From the cookbook (http://book.cakephp.org/view/1030/Complex-Find-Conditions):
>
>         • array('fields'=>array('Product.type','MIN(Product.price) as 
> price'), 'group' => 'Product.type');
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 14 Aug 2011, at 22:54, Roland Pish wrote:
>
>
>
>
>
>
>
> > Thanks for your reply euromark.
> > I tried the find->('count' but it just returns a number, not the
> > records grouped by 'status' field.
>
> > On 14 ago, 15:09, euromark  wrote:
> >> $this->Member->find('count', ...)
> >> it should be in the cookbook, the documentation of cakephp
>
> >> On 14 Aug., 22:29, Roland Pish  wrote:
>
> >>> Hello.
> >>> I need to issue a query like:
>
> >>> select count(id) as total,status from members group by status
>
> >>> When specifying the fields for the model find method I do this:
>
> >>> $fields = array('count(Member.id) as total','Member.status');
> >>> $members = $this->Member->find('all',array('fields'=>
> >>> $fields,'group'=>'Member.status'));
>
> >>> But the resulting array doesn't put 'total' field within
> >>> $members['Member'] but in $members[0]. How should I write the 'total'
> >>> field in order to be pushed into $members['Member']?
>
> >>> Thanks in advance
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Using SELECT... FOR UPDATE in cakephp

2011-08-15 Thread 0x20h
Am 14.08.2011 12:46, schrieb Teddy Zeenny:
> That is an interesting idea. (Although I don't think it would give me
> the exact SELECT .. FOR UPDATE functionality, but I guess it's as
> close as I can get).
It would only allow 1 Process to access the if clause and it would
return *immediately* on *all* clients while FOR UPDATE blocks all other
processes that try to
SELECT the particular id (could be many, could be long). Of course,
while SELECT...FOR UPDATE explicitly locks the row, the GET_LOCK
functionality is an advisory technique where all participating sides
have to obtain the lock (e.g. the code part that takes away the is_admin).

Anyway, I think your concerns are a bit overkill and probably a flaw in
your application design (e.g. why would you have an is_admin flag and
then later set privileges => 'all' in another query)
Would it not solve the problem if you had a save() that does both at once?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: security component

2011-08-15 Thread Özgür Demir
Thanks a lot Jens,

I think I'll model it this way. Perhaps using a small ajax popup which
contains the token instead of a new frame just asking if the record
should be deleted.

On 13 Aug., 13:03, Jens Dittrich  wrote:
> No or it depends on what you want to happen when a delete link is clicked.
> No one forces you to commit a delete on a click on a link. As an example,
> you could always display a page requesting a confirm for the delete request,
> which could carry a token for that request. That way you could not delete by
> just firing a get request.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


URL problem

2011-08-15 Thread leafchild
I have 2 subdomain for my sites:
-mysite.mydomain.com   <- cakePHP
-myforum.mydomain.com   <- open source forum

I want to make it forum URL like this:
mysite.mydomain.com/forum

so basically my cliant want to llok like form is under mysite.

I tried to use .htaccess to make URL look like "mysite.mydomain.com/
forum"

but when I do that "mysite.mydomain.com" site which I have cakephp
site complaines that I don't have controller for that or something
like that so mod_wririte is not working.

Is there any way I can make URL looks like the way I want to??

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: console errors when running 2.0 Console/cake

2011-08-15 Thread José Lorenzo
I am on the same setup as you are, and just ran the command as you described 
without any errors. Can you confirm you have the latest 2.0 code?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


pagination trouble with umlauts & named parameters

2011-08-15 Thread Anja Liebermann

Hello,

I have inherited a big application based on cake 1.2. The search works 
via named parameters in the URL because the search form is  placed in 
the layout header *ouch* and works for more than one model.


So the search parameter is passed like 
http://www.mynicedomain.de/gruppen/suche:Köln


this is passed through a huge routes.php file:

  // Group Overview (with searchword)
  Router::connect(
'/gruppen/suche::search',
array(
  'controller' => 'groups',
  'action' => 'index'
),
array(
  'search' => '[^/?&:]+'
)
  );

Since it is a German page with all those nasty umlauts I already 
intervene via JavaScript in the search form and encode "Köln" to 
"K%C3%B6ln" which I successfully catch in the controller via


$suche = explode(':',$_SERVER['REQUEST_URI']);
if(isset($suche[1]) && isset($this->params['search'])){
$suchbegriffe = explode(':',$suche[1]);
$suchbegriff = explode('/',$suchbegriffe[0]);
$search = urldecode($suchbegriff[0]);
}
So now "K%C3%B6ln" is back to "Köln". and my search works just fine 
until I get more than one page of results. And woe is me!


What I try now is
in the controller:
$urlsearch = urlencode(trim($search));
$urloption =array(
'controller' => 'groups',
'action' => $this->action,
'suche:'.$urlsearch,
);
$paginator_params = array(
'pass' => $urloption,
);
and in the view (in an element):

$paginator->options(array(
  'url' => 
$paginator->params['paging'][$model]['options']['url']['pass']));


latter containing my array:
url array(
controller => groups
action => index
0 => suche:K%C3%B6ln
)

But the url of the paging numbers still results in
/gruppen/suche:Köln/seite:2
Köln again with "ö" causing my paging to break.

Where have I missed to pass on my encoded parameters?

Thanks for any advice

Anja




--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.



To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php
<>

Re: See the design

2011-08-15 Thread Sam Sherlock
If you want the code view to show you the built page as it would when
working with static html pages then I can't see how that is going to work.
Syntax checking and code highlighting of cake projects within dreamweaver is
possible.

http://www.geekyboy.com/archives/347
http://www.jamesfairhurst.co.uk/posts/view/opening_cakephp_files_in_dreamweaver/
http://cakephp.1045679.n5.nabble.com/Dreamweaver-Getting-Code-Coloring-and-Design-View-to-work-on-CTP-files-td1314627.html

test css/js with a static set of html files.

 - S




On 15 August 2011 06:01, Mohd Hasnol  wrote:

> is there any configuration i need to do in dreamweaver to view the design?
>
>
> On Mon, Aug 15, 2011 at 12:54 PM, Mohd Hasnol wrote:
>
>> But, i still cant see the design. i need to go to the browser to see the
>> design.
>>
>>
>> On Mon, Aug 15, 2011 at 12:51 PM, Nitin Hittalamani 
>> wrote:
>>
>>> Yup..If u r using Dream viewer then its possible...
>>>
>>> On 8/15/11, nOLL  wrote:
>>> > Hi,
>>> >
>>> > is there any way to view the design of the webpage using cakephp in
>>> > dreamweaver? or is there any software to view it.Since, i use phpStorm
>>> > for the programmming part.
>>> >
>>> > Thanks.
>>> >
>>> > --
>>> > Our newest site for the community: CakePHP Video Tutorials
>>> > http://tv.cakephp.org
>>> > Check out the new CakePHP Questions site http://ask.cakephp.org and
>>> help
>>> > others with their CakePHP related questions.
>>> >
>>> >
>>> > To unsubscribe from this group, send email to
>>> > cake-php+unsubscr...@googlegroups.com For more options, visit this
>>> group at
>>> > http://groups.google.com/group/cake-php
>>> >
>>>
>>>
>>> --
>>> Thanks and Regards,
>>>
>>> Nitin Hittalamani.
>>>
>>> --
>>> Our newest site for the community: CakePHP Video Tutorials
>>> http://tv.cakephp.org
>>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>>> others with their CakePHP related questions.
>>>
>>>
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
>>> at http://groups.google.com/group/cake-php
>>>
>>
>>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Fatal error: Call to a member function scripts_for_layout() on a non-object in app/views/layouts/default.ctp on line 38

2011-08-15 Thread O.J. Tibi
Hey Shawn,

I'm thinking that you did this in your layout code:

scripts_for_layout(); ?>

You should've just done this:



Cheers,
OJ

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How to specify a count(id) field for find method

2011-08-15 Thread euromark
sry for that
i just saw your count statement.
jeremy is right, of course.

On 15 Aug., 06:26, Jeremy Burns | Class Outfit
 wrote:
> From the cookbook (http://book.cakephp.org/view/1030/Complex-Find-Conditions):
>
>         • array('fields'=>array('Product.type','MIN(Product.price) as 
> price'), 'group' => 'Product.type');
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 14 Aug 2011, at 22:54, Roland Pish wrote:
>
>
>
>
>
>
>
> > Thanks for your reply euromark.
> > I tried the find->('count' but it just returns a number, not the
> > records grouped by 'status' field.
>
> > On 14 ago, 15:09, euromark  wrote:
> >> $this->Member->find('count', ...)
> >> it should be in the cookbook, the documentation of cakephp
>
> >> On 14 Aug., 22:29, Roland Pish  wrote:
>
> >>> Hello.
> >>> I need to issue a query like:
>
> >>> select count(id) as total,status from members group by status
>
> >>> When specifying the fields for the model find method I do this:
>
> >>> $fields = array('count(Member.id) as total','Member.status');
> >>> $members = $this->Member->find('all',array('fields'=>
> >>> $fields,'group'=>'Member.status'));
>
> >>> But the resulting array doesn't put 'total' field within
> >>> $members['Member'] but in $members[0]. How should I write the 'total'
> >>> field in order to be pushed into $members['Member']?
>
> >>> Thanks in advance
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Fatal error: Call to a member function scripts_for_layout() on a non-object in app/views/layouts/default.ctp on line 38

2011-08-15 Thread shawn e
hello  all,
i am new to  cake, just  got  this  error, after  installing  a
script, please help...

i  deleted cache, the paths  correct.


any  help  is  higly appreciated

shawn

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php