Re: DboSource->query() increases memory unlimitedly

2009-10-14 Thread AD7six



On 15 oct, 00:01, Sho Shimauchi  wrote:
> My Program's memory usage increses when Model->query() is called.
> I found out that a cache DboSource->_queryCache is not flushed in
> source code.
>
> https://trac.cakephp.org/browser/trunk/cake/1.2.x.x/cake/libs/model/d...
> In DboSource->query(), DboSource->fetchAll() is called when number of
> arguments is 
> 1.https://trac.cakephp.org/browser/trunk/cake/1.2.x.x/cake/libs/model/d...
> DboSource->fetchAll() has second argument $cache, which default is
> true.
> So, whenever DboSource->query() is called with only one argument,
> caching is always used.
> And I could not found any code to flush this cache.
>
> How do I flush the cache?
>
> If there are no method for flushing the cache, I put two proposal:
> (1) make available to choose whether caching is used or not when
> DboSource->query() is called.
> (2) introduce some caching algolithm like LRU to avoid increasing
> memory infinitely.

At a guess, whatever code you've got that prompted you to write this
message (show it) is wrong.

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ajax call with external redirect doesn't work

2009-10-14 Thread Dr. Loboto

AJAX proxy works other way. You call your proxy action via AJAX, this
action call other server via cURL and output result.

On Oct 14, 10:59 pm, "marco.rizze...@gmail.com"
 wrote:
> Hi
> I must do a ajax call to an external site.
> I use a proxy to circumvent the Same Origin Policy.
> My action-controller proxy is:
>
> function  proxy($url) {
>                 $this->redirect($url,301,true);
>
> }
>
> In my view when I do the ajax call I get the error :
>
> Error:  Http:Controller could not be found.
>
> If I call directly the action "proxy" it works correctly.
> It seems that CakePHP can't do  ajax call external.
> Is it correct or I do some mistake?
> Many Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Selecting empty rows?

2009-10-14 Thread AD7six



On 14 oct, 23:00, BeroFX  wrote:
> How can I select records where a column doesn't contain any value,
> like ''.
>
> Doing it like this $this->Document->find('all', array
> ('conditions'=>array('Document.title'=>''))); produces a WHERE
> `Document`.`title` = NULL query and that's not right.

are you sure that example matches your code? cake would normally
generate:
Model.field IS NULL
OR
Model.field = ""

in any event you could use 'Document.title = ""'

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Refresh page on login / out

2009-10-14 Thread Dave Maharaj :: WidePixels.com

I have a login module on the side of each page if not logged in. 
Problem is when a user logs in or out from the home page which is the
$this->Auth->loginRedirect and $this->Auth->logoutRedirect it still shows
logged in or login. How can i refresh the page or something so the page
updates correctly? If i manually refresh the page the correct look is there
but that's not going to work in a live environment.
 
Ideas how to fix this?
 
Dave


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: gwoo Leaving CakePHP??

2009-10-14 Thread O.J. Tibi

Thanks Garett for all the good Cake. May you find joy in your life's
new direction.

Larry, our faith is in you. You guys are the best. Bake on!

Cheers,
OJ
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: gwoo Leaving CakePHP??

2009-10-14 Thread Larry E. Masters aka PhpNut
Adam,

Since being informed by gwoo that he was leaving the project a couple weeks
ago, I have stepped back into a more active role in the project.
At this time I have not selected a new project manager but you can be
assured the project will go on. The lead developers are as active as ever on
the current codebase, and work on it is increasing rapidly. A change in the
project manager position for the CakePHP project at this juncture will allow
us to realign the team to the development roadmap, and better achieve our
goals in terms of development and release moving forward.

Look forward to what is in store with the 1.3 and 2.0 releases, more to be
announced on these later :).

-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/
On Wed, Oct 14, 2009 at 5:18 PM, Adam  wrote:

>
> "[gwoo] resigned from the Cake Software Foundation and cakephp
> project. Thank you all for 4 great years. Best of luck to the team and
> community."
>
> https://www.ohloh.net/accounts/gwoo/messages
>
> Is this true? Any reason behind this decision? Who will step up and
> manage this great project?
>
> In the event it is true, Garrett you did a fantastic job! I love
> CakePHP and thank you for your time and dedication.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: New to CakePHP issue loggin IP

2009-10-14 Thread Brett Wilton

I haven't tried getClientIP() but I'd check that you have the field
name correct etc, try putting something known in.  As an alternative
I've used  $_SERVER['REMOTE_ADDR'] in the past which does work.


http://wiltonsoftware.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



DboSource->query() increases memory unlimitedly

2009-10-14 Thread Sho Shimauchi

My Program's memory usage increses when Model->query() is called.
I found out that a cache DboSource->_queryCache is not flushed in
source code.

https://trac.cakephp.org/browser/trunk/cake/1.2.x.x/cake/libs/model/datasources/dbo_source.php#L211
In DboSource->query(), DboSource->fetchAll() is called when number of
arguments is 1.
https://trac.cakephp.org/browser/trunk/cake/1.2.x.x/cake/libs/model/datasources/dbo_source.php#L329
DboSource->fetchAll() has second argument $cache, which default is
true.
So, whenever DboSource->query() is called with only one argument,
caching is always used.
And I could not found any code to flush this cache.

How do I flush the cache?

If there are no method for flushing the cache, I put two proposal:
(1) make available to choose whether caching is used or not when
DboSource->query() is called.
(2) introduce some caching algolithm like LRU to avoid increasing
memory infinitely.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



New to CakePHP issue loggin IP

2009-10-14 Thread PatrickTalmadge

I'm new to CakePHP and working on a project where I need to log the
client IP when they register. When it saves to the DB the IP doesn't
save. This is the code I currently have in the controller:

class UsersController extends AppController {

var $name = 'Users';
var $helpers = array('Html', 'Form', 'Javascript', 'Ajax', 'Cache');
var $components = array('RequestHandler');

function register()
{
if (!empty($this->data))
{
$this->data['User']['creation_ip'] = $this->RequestHandler-
>getClientIP();

$this->User->create();

if ($this->User->save($this->data))
{
$this->Session->setFlash(__("The User has been saved", 
true));
$this->redirect(array('action'=>'index'));
}
else
{
$this->Session->setFlash(__("The User could not be 
saved. Please,
try again.", true));}
}
$jobs = $this->User->Job->find('list');
$this->set(compact('jobs'));
}

}

When I add the following code to the top of the method the page
redirects with the IP in the Flash message.

$this->Session->setFlash(__($this->RequestHandler->getClientIP(),
true));
$this->redirect(array('action'=>'index'));

What am I doing wrong?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem to select right value on $form->input (select) with text index

2009-10-14 Thread brian

Cake only handles integer primary keys, AFAIK.

On Wed, Oct 14, 2009 at 4:41 PM, Leonardo "Hackin" Freire
 wrote:
> Hi dudes,
> I'm getting a little problem when populate a select through the
> $form->input.
> In my controller "Contato", where i save the client_id field, I populate an
> variable calling "clientes" with this line:
> $clientes = $this->Cliente->find('list', array('order' =>
> array('Cliente.razaoSocial ASC')));
> In my view, I uses:
> input('cliente_id', array('options' => $clientes, 'label'
> => '', 'empty' => 'selecione um cliente', 'class' => 'campoform')); ?>
> In my "Cliente" model, I set the primayKey as "codigo" and displayName as
> "razaoSocial". The codigo field is a text field with letters and numbers.
> The variable populates ok and, in my insert action of Contato controller,
> everything is ok: the data is saved and the input field too.
> But, in my update action, the $form->input, that renders in a form of
> select, don't select the right value. =/
> Ex.: I'm saved a client_id value "J51", and in my update view this not
> select;
> Ex.: I'm saved a client_id value "290-1", and in my update view this select
> more than one single value;
> Somebody helps me or this is a bug/limitation from Cake ?
> Hug.
> Leonardo C. Freire
> Diretor Executivo
> +55 27 97230015
> leonardo.fre...@giran.com.br
> http://www.leohackin.com.br
>
> Giran Soluções e Ensino
> http://www.giran.com.br
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Selecting empty rows?

2009-10-14 Thread brian

On Wed, Oct 14, 2009 at 5:00 PM, BeroFX  wrote:
>
> How can I select records where a column doesn't contain any value,
> like ''.
>
> Doing it like this $this->Document->find('all', array
> ('conditions'=>array('Document.title'=>''))); produces a WHERE
> `Document`.`title` = NULL query and that's not right.
>
> What I need is a WHERE title='' query returned.

You could test for 0 length:

'conditions' => array('CHAR_LENGTH(Document.title) = 0')

But it'd be simpler to just ensure that an empty title is always NULL
in the first place.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do I set session.save_path?

2009-10-14 Thread number9

OK - I have managed to find this value, but I have no idea what to set
it to.

I have moved the TMP folder into the webroot - but "WEBROOT . TMP /
settings/" doesn't seem to be working?

On Oct 15, 1:58 am, number9  wrote:
> Hi,
>
> I've setup an install so the cake and app folder are in the /etc/
> folder and the webroot/tmp/config folders are in the webroot (so many
> sites can share the same codebase).
>
> I'm getting the following errors however:
>
> Warning (2): session_start() [function.session-start]: open(/tmp/
> sess_0da65f3698c6c25541f21b127669dccc, O_RDWR) failed: Permission
> denied (13) [CORE/cake/libs/session.php, line 539]
>
> Warning (2): session_start() [function.session-start]: Cannot send
> session cache limiter - headers already sent (output started at /home/
> site/etc/cake/basics.php:111) [CORE/cake/libs/session.php, line 539]
>
> Warning (2): Unknown: open(/tmp/sess_0da65f3698c6c25541f21b127669dccc,
> O_RDWR) failed: Permission denied (13) [Unknown, line ??]
>
> Warning (2): Unknown: Failed to write session data (files). Please
> verify that the current setting of session.save_path is correct ()
> [Unknown, line ??]
>
> I'm guessing to fix it I need to adjust the session.save_path so that
> it points to the new tmp folder? Where can I update this?
>
> If not, can anybody suggest a fix? The sessions folder is set to 755
> so it should be writeable (I also tried 777). I have searched but
> nothing has worked.
>
> Thanks in advance
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How do I set session.save_path?

2009-10-14 Thread number9

Hi,

I've setup an install so the cake and app folder are in the /etc/
folder and the webroot/tmp/config folders are in the webroot (so many
sites can share the same codebase).

I'm getting the following errors however:


Warning (2): session_start() [function.session-start]: open(/tmp/
sess_0da65f3698c6c25541f21b127669dccc, O_RDWR) failed: Permission
denied (13) [CORE/cake/libs/session.php, line 539]

Warning (2): session_start() [function.session-start]: Cannot send
session cache limiter - headers already sent (output started at /home/
site/etc/cake/basics.php:111) [CORE/cake/libs/session.php, line 539]

Warning (2): Unknown: open(/tmp/sess_0da65f3698c6c25541f21b127669dccc,
O_RDWR) failed: Permission denied (13) [Unknown, line ??]

Warning (2): Unknown: Failed to write session data (files). Please
verify that the current setting of session.save_path is correct ()
[Unknown, line ??]



I'm guessing to fix it I need to adjust the session.save_path so that
it points to the new tmp folder? Where can I update this?

If not, can anybody suggest a fix? The sessions folder is set to 755
so it should be writeable (I also tried 777). I have searched but
nothing has worked.

Thanks in advance
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: gwoo Leaving CakePHP??

2009-10-14 Thread Adam

Looking at some irc logs its true and he left a week ago.

Starts Oct 15th, 15:40
PhpNut: jose_zap actually he [gwoo] resigned over a week ago
PhpNut: right before I took the project over again
Ceeram: wouldnt it be great if PhpNut and Gwoo were both still on the
project
Ceeram: disagreement about strategies?
PhpNut: sometimes things do not work out the way people think
PhpNut: something like that
Ceeram: often people find out about that quicker then 4 years
jose_zap: ...so, which direction is the project taking now? what is
the difference with gwoo's vision?
PhpNut: what was gwoo's vision?
jose_zap: ...I hope you tell me about both :)
jose_zap: ...What's yours?
PhpNut: nothing has changed with the project itself, we are focusing
on cakephp and the community as always
PhpNut: ...continue to improve current code base, refactor making it
better
PhpNut: ...I will be finding a new PM over next few weeks
jose_zap: What I could say about gwoo's visions is that he brought
some cadence to the project. There were more frequent releases and a
clear increase of core contributors during his leadership
PhpNut: really?
PhpNut: I think releases slowed down when I was asked to let others
lead
Phally: so who are the candidates for PM? nate?
PhpNut: haha no
dogmatic69: i would vote for markstory to be pm
dogmatic69: hes on the ball
jose_zap: PhpNut: As new lead developer, could give us an estimate of
when will 1.3 and 2.0 will be released?
PhpNut: new lead?
PhpNut: I am not a new lead haha
PhpNut: markstory is leading 1.x
PhpNut: I am heading up future releases of 2.x with the help of others
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: gwoo Leaving CakePHP??

2009-10-14 Thread robustsolution

If this is true good luck for him and for everyone in this great
community.
everyday I discover that cake is something that should be delivered as
a curriculum in the academic institutes like cisco and c#

On Oct 15, 1:18 am, Adam  wrote:
> "[gwoo] resigned from the Cake Software Foundation and cakephp
> project. Thank you all for 4 great years. Best of luck to the team and
> community."
>
> https://www.ohloh.net/accounts/gwoo/messages
>
> Is this true? Any reason behind this decision? Who will step up and
> manage this great project?
>
> In the event it is true, Garrett you did a fantastic job! I love
> CakePHP and thank you for your time and dedication.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



gwoo Leaving CakePHP??

2009-10-14 Thread Adam

"[gwoo] resigned from the Cake Software Foundation and cakephp
project. Thank you all for 4 great years. Best of luck to the team and
community."

https://www.ohloh.net/accounts/gwoo/messages

Is this true? Any reason behind this decision? Who will step up and
manage this great project?

In the event it is true, Garrett you did a fantastic job! I love
CakePHP and thank you for your time and dedication.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to create a gettext-catalogue on Windows??

2009-10-14 Thread Miles J

You use the command line and it has an option of building it.

On Oct 14, 2:31 pm, DigitalDude  wrote:
> Hey,
>
> I'm using the gettext-method in my app to make it multilingual. For
> the catalogue, I installed PoEdit on my Windows XP machine. That's not
> such a big problem, as I can open a catalogue file and edit it.
>
> But how can I let cake build up a catalogue on my XP machine? There is
> a way, I know that because a friend of mine did this all the time, but
> he's gone for a long time and I cannot communicate with him, so I hope
> someone here has a simple and easy to use solution for me :)
>
> Regards,
>
> DD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to create a gettext-catalogue on Windows??

2009-10-14 Thread DigitalDude

Hey,

I'm using the gettext-method in my app to make it multilingual. For
the catalogue, I installed PoEdit on my Windows XP machine. That's not
such a big problem, as I can open a catalogue file and edit it.

But how can I let cake build up a catalogue on my XP machine? There is
a way, I know that because a friend of mine did this all the time, but
he's gone for a long time and I cannot communicate with him, so I hope
someone here has a simple and easy to use solution for me :)

Regards,

DD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: retrieve online status of a user while logged in

2009-10-14 Thread DigitalDude

Hey,


that sounds nice, I think I'll give it a try and make an example of
this.
I think most apps use a separate Javascript-Client for these purposes,
but
I have to look for infos about that a little longer the next few
weeks...

Regards,

DD



On 13 Okt., 07:39, John Andersen  wrote:
> Add a last activity time field, and update it whenever the user does
> something on the site.
> If the user has not done anything for 5 min, show the usersonlinestatusas 
> away.
> If the user has not done anything for 10 min, show the usersonlinestatusas 
> offline.
>
> If a user has a contact (friend) relationship with another user, and
> the other user logs in, then using the contact relationship, add a
> note to the user, that the other user has logged in and delete the
> note when it has been presented.
>
> Best wishes,
>    John
>
> On Oct 12, 4:07 am, DigitalDude  wrote:
>
> > Hey,
>
> > I need to figure out a solution for a problem. Let's say I have an app
> > which is controlled bei Auth and ACL, so the user can log in into a
> > system and do stuff.
>
> > Everyone knows from several social networks or chat clients that when
> > a user is logged in, and one or more friends areonline, too, the
> >statusof these users is shown.
>
> > The question is, how could I do such a thing in Cake? Is there any
> > chance to retriebe thestatusof a user, and "flag" it so another user
> > (which is his/her friend or so) can see that he's actually "online"?
>
> > I think I could use a flag in the user's table like "online" with 1 or
> > 0 as flag, and set the "online"-statusto 1 as a user logs in. But if
> > a user does not log out, maybe because he just closes the browser,
> > there is no way to set thestatusback to 0 so an indicator could show
> > the user as "offline" (which means, that the field "online" would be
> > set back to 0).
>
> > I'm very interested in solutions for such problems, so if you have any
> > suggestions, please let me know.
>
> > Regards,
>
> > DD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to deal with empty data in index-views (example inside...)

2009-10-14 Thread DigitalDude

Hey Martin,


interesting idea, really! I thought of such a solution for maybe new
messages that a user has or like you pointed out, files etc.
I think I should take some time to think about my database structure,
there may be a few things I could improve and make things a little
smoother and better.

For now I check whether a data-containing variable is empty or not,
and then I display the belonging part of the view.
I guess that's quite ok, but to be honest, I'm not a big fan of much
logic in views...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread gimperdan...@gmail.com

ok, thanks everyone, I got something going on. It works, i just hope
it's the proper way to do it.

On Oct 14, 3:15 pm, Eber Freitas Dias  wrote:
> Hey!
>
> First of all, you never route something to a Model...
>
> Take a look at this portion of the CakePHP 
> Book:http://book.cakephp.org/view/13/Basic-Principles-of-CakePHP
>
> In fact, you should read all the CakePHP Book in order to understand things
> better. For instance, you should need to write any queries in order to get
> the data you want. Try to read something related to MVC as well, and you
> understand CakePHP 
> better:http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
>
> Hope it helps somehow!
>
> On Wed, Oct 14, 2009 at 4:06 PM, gimperdan...@gmail.com <
>
>
>
> gimperdan...@gmail.com> wrote:
>
> > Ok... thanks for the tutorial. It helped some. This is my main problem
> > right now... that in order to use model and controllers they need to
> > be attached to a database table. And I don't always want to have a
> > database table that corresponds to that model.
>
> > For instance:
>
> > I have 3 tables:
>
> > artists
> > albums
> > tracks
>
> > I my home page I want to pull...
>
> > Latest artists added
> > Latest albums added
> > And just a featured artist
>
> > My question is, where would I write the queries? On a element? on a
> > helper? Because if I create a model (and route it to be the index)
> > than that model would need a corresponding database table, which I
> > wouldn't have. Can someone give me an example?
>
> > Thanks!
>
> > On Oct 14, 12:14 pm, red  wrote:
> > > As I understand, you try to build some kind of dashboard. Check this
> > > tutorial, maybe this works for you:
> >http://teknoid.wordpress.com/2008/12/16/how-to-build-a-dashboard-for-...
>
> > > On Oct 14, 5:54 pm, "gimperdan...@gmail.com" 
> > > wrote:
>
> > > > I kinda understand what you're saying, but I am rather lost with some
> > > > concepts in Cake. I have to read more first... Thanks...
>
> > > > PS: legal seu site!
>
> > > > On Oct 14, 11:20 am, Eber Freitas Dias  wrote:
>
> > > > > Hi!
>
> > > > > The fact that "home.ctp" is the default home for your app it doesn't
> > mean
> > > > > you have to use it!
>
> > > > > You can just re declare a new home in your routes using the
> > controller you
> > > > > want. Something like:
>
> > > > > Router::connect('/', array('controller' => 'mycontroller', 'action'
> > =>
> > > > > 'index'));
>
> > > > > The second argument on the connect method works just like the url on
> > your
> > > > > link methods from the html helper.
>
> > > > > There is some basic understanding related to behaviours, components
> > and
> > > > > helpers... See:
>
> > > > > Helpers extends functionality to views.
> > > > > Components extends functionality to controllers.
> > > > > Behaviours extends functionality to models.
>
> > > > > If you need some custom data, instead of using requestAction, I would
> > > > > consider creating a new function on your model and simply calling it
> > > > > instead. You can create as many functions you like in your modesl,
> > and once
> > > > > you start doing that, you won't stop. It makes things really simpler!
>
> > > > > On Wed, Oct 14, 2009 at 11:57 AM, gimperdan...@gmail.com <
>
> > > > > gimperdan...@gmail.com> wrote:
>
> > > > > > Thanks. That helps a little. From what I've been reading it's
> > better
> > > > > > to use Elements for HTML chunks and Helpers for logic. But
> > > > > > requestAction seems like a good option too.
>
> > > > > > On Oct 14, 10:54 am, Céryl  wrote:
> > > > > > > I don't really know the answer, but just to add to that, the
> > home.ctp
> > > > > > > has a controller, it's the pages_controller.
> > > > > > > And also, you can of course use actions from other controllers
> > and
> > > > > > > models in the pages-views by using Cake's requestAction. I use it
> > > > > > > sometimes to get for instance  number of posts, users, pictures
> > or
> > > > > > > whatever on the sites main index page.
>
> > > > > > > On 14 okt, 16:38, "gimperdan...@gmail.com" <
> > gimperdan...@gmail.com>
> > > > > > > wrote:
>
> > > > > > > > On the index of my website I get content from several different
> > tables
> > > > > > > > in the database. Which is best to use? Elements? Behaviors? or
> > > > > > > > Helpers? As far as I understand the index(home.ctp) page
> > doesn't have
> > > > > > > > a  model or controller.
>
> > > > > --
> > > > > Éber Freitas Dias
>
> > > > >www.eberfdias.comwww.dejamps.net
>
> --
> Éber Freitas Dias
>
> www.eberfdias.comwww.dejamps.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--

Re: Ajax update div, cakephp 1.2

2009-10-14 Thread hahmadi82


I'd like to know the same thing... How do you add something or remove
something from a div via ajax

Laburno wrote:
> 
> 
> Hi all!
> Could someone explain to a total noob like me, what is the best method
> to simply update a div with ajax, using cake 1.2?
> I wish to have a link that call a search function and update a div
> with the results.
> 
> Thank you
> 
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Ajax-update-div%2C-cakephp-1.2-tp11687387p25899148.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Problem to select right value on $form->input (select) with text index

2009-10-14 Thread Leonardo "Hackin" Freire
Hi dudes,
I'm getting a little problem when populate a select through the
$form->input.

In my controller "Contato", where i save the client_id field, I populate an
variable calling "clientes" with this line:

$clientes = $this->Cliente->find('list', array('order' =>
array('Cliente.razaoSocial ASC')));

In my view, I uses:
input('cliente_id', array('options' => $clientes, 'label'
=> '', 'empty' => 'selecione um cliente', 'class' => 'campoform')); ?>

In my "Cliente" model, I set the primayKey as "codigo" and displayName as
"razaoSocial". The codigo field is a text field with letters and numbers.
The variable populates ok and, in my insert action of Contato controller,
everything is ok: the data is saved and the input field too.

But, in my update action, the $form->input, that renders in a form of
select, don't select the right value. =/

Ex.: I'm saved a client_id value "J51", and in my update view this not
select;
Ex.: I'm saved a client_id value "290-1", and in my update view this select
more than one single value;

Somebody helps me or this is a bug/limitation from Cake ?

Hug.

Leonardo C. Freire
Diretor Executivo
+55 27 97230015
leonardo.fre...@giran.com.br
http://www.leohackin.com.br

Giran Soluções e Ensino
http://www.giran.com.br

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginator sort field and direction indicator?

2009-10-14 Thread nMac
Guys,

below what I did. I think this is better than all the alternatives:




 'Date',
'Smr.status' => 'Status',
'Smr.title' => 'Title'
);

foreach($fields as $field => $title){
?>
sort($title, $field,
array('class' => ($field == $paginator->sortKey() ? $paginator->sortDir() :
'none')));?>



CSS:

table.listingTable th a.none{
background-image: url(/img/icons/arrow_collapse_light.png);
}

table.listingTable th a.asc{
background-image:url(/img/icons/arrow_expand_dark.png);
}

table.listingTable th a.desc{
background-image:url(/img/icons/arrow_collapse_dark.png);
}



Happy coding!





Nicolás Andrade
*n...@nicoandra.com.ar*
 Blog  | CV  |
Flickr  |
Del.icio.us|
LastFM 



On Sun, Jan 11, 2009 at 4:40 PM, DanielMedia wrote:

>
> Thanks for the help but that didn't seem to work. I ended up just
> hacking it by writing a custom function:
>
>  function check_sort($paginator, $sort_field){
>if($paginator->sortKey() == $sort_field){
>return ' class="' . $paginator->sortDir() . '"';
>}
> }
> ?>
>
> 
>> >sort('Time of Trade', 'Trade.time_of_trade'); ?>
>> $paginator->sort('Security Description',
> 'Trade.security_description'); ?>
>> >sort('Maturity Date', 'Trade.maturity_date'); ?>
>>sort
> ('Interest Rate', 'Trade.coupon'); ?>
>> $paginator->sort
> ('Price', 'Trade.dollar_price'); ?>
>>sort
> ('Yield', 'Trade.yield'); ?>
>>sort
> ('Trade Amount', 'Trade.par_traded'); ?>
> 
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Selecting empty rows?

2009-10-14 Thread BeroFX

How can I select records where a column doesn't contain any value,
like ''.

Doing it like this $this->Document->find('all', array
('conditions'=>array('Document.title'=>''))); produces a WHERE
`Document`.`title` = NULL query and that's not right.

What I need is a WHERE title='' query returned.

Help?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread Eber Freitas Dias
Hey!

First of all, you never route something to a Model...

Take a look at this portion of the CakePHP Book:
http://book.cakephp.org/view/13/Basic-Principles-of-CakePHP

In fact, you should read all the CakePHP Book in order to understand things
better. For instance, you should need to write any queries in order to get
the data you want. Try to read something related to MVC as well, and you
understand CakePHP better:
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

Hope it helps somehow!

On Wed, Oct 14, 2009 at 4:06 PM, gimperdan...@gmail.com <
gimperdan...@gmail.com> wrote:

>
> Ok... thanks for the tutorial. It helped some. This is my main problem
> right now... that in order to use model and controllers they need to
> be attached to a database table. And I don't always want to have a
> database table that corresponds to that model.
>
> For instance:
>
> I have 3 tables:
>
> artists
> albums
> tracks
>
> I my home page I want to pull...
>
> Latest artists added
> Latest albums added
> And just a featured artist
>
> My question is, where would I write the queries? On a element? on a
> helper? Because if I create a model (and route it to be the index)
> than that model would need a corresponding database table, which I
> wouldn't have. Can someone give me an example?
>
> Thanks!
>
> On Oct 14, 12:14 pm, red  wrote:
> > As I understand, you try to build some kind of dashboard. Check this
> > tutorial, maybe this works for you:
> http://teknoid.wordpress.com/2008/12/16/how-to-build-a-dashboard-for-...
> >
> > On Oct 14, 5:54 pm, "gimperdan...@gmail.com" 
> > wrote:
> >
> > > I kinda understand what you're saying, but I am rather lost with some
> > > concepts in Cake. I have to read more first... Thanks...
> >
> > > PS: legal seu site!
> >
> > > On Oct 14, 11:20 am, Eber Freitas Dias  wrote:
> >
> > > > Hi!
> >
> > > > The fact that "home.ctp" is the default home for your app it doesn't
> mean
> > > > you have to use it!
> >
> > > > You can just re declare a new home in your routes using the
> controller you
> > > > want. Something like:
> >
> > > > Router::connect('/', array('controller' => 'mycontroller', 'action'
> =>
> > > > 'index'));
> >
> > > > The second argument on the connect method works just like the url on
> your
> > > > link methods from the html helper.
> >
> > > > There is some basic understanding related to behaviours, components
> and
> > > > helpers... See:
> >
> > > > Helpers extends functionality to views.
> > > > Components extends functionality to controllers.
> > > > Behaviours extends functionality to models.
> >
> > > > If you need some custom data, instead of using requestAction, I would
> > > > consider creating a new function on your model and simply calling it
> > > > instead. You can create as many functions you like in your modesl,
> and once
> > > > you start doing that, you won't stop. It makes things really simpler!
> >
> > > > On Wed, Oct 14, 2009 at 11:57 AM, gimperdan...@gmail.com <
> >
> > > > gimperdan...@gmail.com> wrote:
> >
> > > > > Thanks. That helps a little. From what I've been reading it's
> better
> > > > > to use Elements for HTML chunks and Helpers for logic. But
> > > > > requestAction seems like a good option too.
> >
> > > > > On Oct 14, 10:54 am, Céryl  wrote:
> > > > > > I don't really know the answer, but just to add to that, the
> home.ctp
> > > > > > has a controller, it's the pages_controller.
> > > > > > And also, you can of course use actions from other controllers
> and
> > > > > > models in the pages-views by using Cake's requestAction. I use it
> > > > > > sometimes to get for instance  number of posts, users, pictures
> or
> > > > > > whatever on the sites main index page.
> >
> > > > > > On 14 okt, 16:38, "gimperdan...@gmail.com" <
> gimperdan...@gmail.com>
> > > > > > wrote:
> >
> > > > > > > On the index of my website I get content from several different
> tables
> > > > > > > in the database. Which is best to use? Elements? Behaviors? or
> > > > > > > Helpers? As far as I understand the index(home.ctp) page
> doesn't have
> > > > > > > a  model or controller.
> >
> > > > --
> > > > Éber Freitas Dias
> >
> > > >www.eberfdias.comwww.dejamps.net
> >
>


-- 
Éber Freitas Dias

www.eberfdias.com
www.dejamps.net

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread gimperdan...@gmail.com

Ok... thanks for the tutorial. It helped some. This is my main problem
right now... that in order to use model and controllers they need to
be attached to a database table. And I don't always want to have a
database table that corresponds to that model.

For instance:

I have 3 tables:

artists
albums
tracks

I my home page I want to pull...

Latest artists added
Latest albums added
And just a featured artist

My question is, where would I write the queries? On a element? on a
helper? Because if I create a model (and route it to be the index)
than that model would need a corresponding database table, which I
wouldn't have. Can someone give me an example?

Thanks!

On Oct 14, 12:14 pm, red  wrote:
> As I understand, you try to build some kind of dashboard. Check this
> tutorial, maybe this works for 
> you:http://teknoid.wordpress.com/2008/12/16/how-to-build-a-dashboard-for-...
>
> On Oct 14, 5:54 pm, "gimperdan...@gmail.com" 
> wrote:
>
> > I kinda understand what you're saying, but I am rather lost with some
> > concepts in Cake. I have to read more first... Thanks...
>
> > PS: legal seu site!
>
> > On Oct 14, 11:20 am, Eber Freitas Dias  wrote:
>
> > > Hi!
>
> > > The fact that "home.ctp" is the default home for your app it doesn't mean
> > > you have to use it!
>
> > > You can just re declare a new home in your routes using the controller you
> > > want. Something like:
>
> > > Router::connect('/', array('controller' => 'mycontroller', 'action' =>
> > > 'index'));
>
> > > The second argument on the connect method works just like the url on your
> > > link methods from the html helper.
>
> > > There is some basic understanding related to behaviours, components and
> > > helpers... See:
>
> > > Helpers extends functionality to views.
> > > Components extends functionality to controllers.
> > > Behaviours extends functionality to models.
>
> > > If you need some custom data, instead of using requestAction, I would
> > > consider creating a new function on your model and simply calling it
> > > instead. You can create as many functions you like in your modesl, and 
> > > once
> > > you start doing that, you won't stop. It makes things really simpler!
>
> > > On Wed, Oct 14, 2009 at 11:57 AM, gimperdan...@gmail.com <
>
> > > gimperdan...@gmail.com> wrote:
>
> > > > Thanks. That helps a little. From what I've been reading it's better
> > > > to use Elements for HTML chunks and Helpers for logic. But
> > > > requestAction seems like a good option too.
>
> > > > On Oct 14, 10:54 am, Céryl  wrote:
> > > > > I don't really know the answer, but just to add to that, the home.ctp
> > > > > has a controller, it's the pages_controller.
> > > > > And also, you can of course use actions from other controllers and
> > > > > models in the pages-views by using Cake's requestAction. I use it
> > > > > sometimes to get for instance  number of posts, users, pictures or
> > > > > whatever on the sites main index page.
>
> > > > > On 14 okt, 16:38, "gimperdan...@gmail.com" 
> > > > > wrote:
>
> > > > > > On the index of my website I get content from several different 
> > > > > > tables
> > > > > > in the database. Which is best to use? Elements? Behaviors? or
> > > > > > Helpers? As far as I understand the index(home.ctp) page doesn't 
> > > > > > have
> > > > > > a  model or controller.
>
> > > --
> > > Éber Freitas Dias
>
> > >www.eberfdias.comwww.dejamps.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to convert tinyint(1) back to boolean?

2009-10-14 Thread Xhaphir

Hi there,

sorry for the late response. I thought I will get a email if someone
responds.

Thanks for your help so far but that is not solving my problems...

What I would like to do is:

- read all fields from my database Table
- display all Integers as Integers and all booleans as booleans (yes/
no).

I know of course what field is a boolean and what field isn't but I
have a few hundred fields in my database and I would like to auto-
generate the Views. My idea is to implement the afterFind() method in
my models and convert all tinyint(1) into booleans. Is there a cake
way to determine the type of a database field?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Extending Cake Shell Classes

2009-10-14 Thread vb13

I have a number of shell scripts and they share common functions so I
though it would be smart to have a common base class MyShell that
extends Shell and have all my classes extend MyShell. Well, it turns
out if I do so, initialize() method of subclasses is not getting
called. See line 316 in the Shell Dispatched class ...  
if
(strtolower(get_parent_class($shell)) == 'shell') {
$shell-
>initialize();
$shell->loadTasks();...

Why is it so? Is it not a good idea to subclass cake Shells, Tasks
etc.?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Rob

as always helpfull ;) thanks guys.
i use full sentences, idd way easier.

shell script works like charm.
i guess it gets compressed/cached by cake anyway (on debug 0), right?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Toby Ashley
I am using this system mainly for translations, yes. The site runs in 12
languages, and currently contains over 250 ctp files.

However, an added benefit of the l18n system for me is that the
administrator can also make adjustments to the text on the English site, not
just the translated languages. It's far more convenient for me to create a
string with msgid registrationCompleteMessage and allow them to edit that
message themselves in *all* languages, not just the non-English languages.
As we all know, it's a pain when a client endlessly sends through text
amends, and this system allows them to have full control of the content of
their own site.

However, my question wasn't concerning the use of slugs vs full strings - I
can see the pros and cons for each method. My question was about a system
for enabling these translations to be managed through an administration area
of a site, and what methods people are using to do that? My admin users
can't be trusted to have direct access to the *.po files, so I created the
CSV export / import system to allow them to edit the translations safely,
giving me time to validate their translations without ever giving them
direct access to the locales directory. This all works great for my needs,
but I'm wondering if there are any other recommended approaches for this?

Cheers,
toby


On Wed, Oct 14, 2009 at 5:56 PM, Larry E. Masters aka PhpNut <
php...@gmail.com> wrote:

> Toby,
> It sounds like you are trying to use translations as a way to also change
> text.
>
> Examples (forgive me in advance if google did not translate these
> properly):
>
> "Welcome to the home page of CakePHP the best PHP framework for rapidly
> building applications."
>
> Translated to German this would be:
>
> "Willkommen auf der Homepage von CakePHP den besten Rahmen für PHP schnell
> die Erstellung von Anwendungen."
>
> Anything else would not be a translation:
>
> Example:
>
> "Herzlich Willkommen auf meiner Homepage der Anwendungen habe ich mit Hilfe
> meiner CakePHP Rahmen der Wahl."
>
> Which means:
>
> "Welcome to my home page of the applications I have built using CakePHP my
> framework of choice."
>
> This is not translating text, and it not what I18n is to be used for.
>
> --
> /**
> * @author Larry E. Masters
> * @var string $userName
> * @param string $realName
> * @returns string aka PhpNut
> * @access  public
> */
>
> On Wed, Oct 14, 2009 at 9:15 AM, Toby Ashley  wrote:
>
>> While this discussion is going on, I thought I'd raise / ask something...
>>
>> In a recent project, I needed to make it easy for administrators to be
>> able to edit the text used throughout the site. The site itself runs in 12
>> languages, and as a result I have 12 *.po files, one per territory. The
>> administrators for each language are fairly non-technical, and so the system
>> needed to be easy.
>>
>> I built a simple system which would do the following:
>>
>> -- Provide a 'download existing website text' button to the administrator
>> - the controller action would then read through the appropriate *.po file
>> and generate a CSV with two columns, the identifier (i'm also using
>> descriptive slugs, as mentioned by Miles) and the current string for that
>> identifier
>>
>> -- The administrator can then make the necessary amendments before
>> re-importing the CSV. When re-importing, the system backs up the existing
>> *.po file and creates a new one, manually writing the msgid and msgstr
>> values from the data in the CSV. Finally, when this is done, the system
>> removes any relevant cache files and  hey presto - the website text is
>> updated.
>>
>> -- There's also tools to revert to previous backup, in case they make an
>> almighty mess of everything.
>>
>> This system worked fine for the project, and the administrators of the
>> site are maintaining the different languages with success, but I'm wondering
>> if there's a better / simpler / more recommend way of achieving the same
>> functionality. I guess it's kind of like a friendly, web-based interface for
>> editing these *.po files
>>
>> Any suggestions?
>>
>> Cheers,
>> toby
>>
>>
>>
>>
>> On Wed, Oct 14, 2009 at 2:05 AM, Larry E. Masters aka PhpNut <
>> php...@gmail.com> wrote:
>>
>>> Cool, let me know if you have any questions.
>>> --
>>> /**
>>> * @author Larry E. Masters
>>> * @var string $userName
>>> * @param string $realName
>>> * @returns string aka PhpNut
>>> * @access  public
>>> */
>>>
>>> On Tue, Oct 13, 2009 at 7:46 PM, Miles J wrote:
>>>

 Well see now a lot of it makes sense. The guide is pretty vague on
 i18n/l10n and how it works / is used.

 Will give this a try.

 On Oct 13, 5:39 pm, "Larry E. Masters aka PhpNut" 
 wrote:
 > Incorrect, the file that is created using the i18n extract creates a
 .pot
 > file which is a template file and can be opened in any po editor or
 text
 > editor. The template is not language specific. There is no reason to
 create
 > these files by 

Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Pablo Viojo
We are using slugs for translations in our site, and our site is quite
big... :)


Pablo Viojo
pvi...@gmail.com

http://needish.com



On Wed, Oct 14, 2009 at 1:59 PM, Larry E. Masters aka PhpNut <
php...@gmail.com> wrote:

> Miles,
>
> It is not a suggestion it is the correct way the code should be used.
>
> As I stated in the previous email the pot file is reopened, using poedit
> for example, and you merge the changes from your code. Your .po and .mo
> files will have the correct msgid and your translators will be able to open
> the file and "know" that it has been altered because the fields are marked
> as fuzzy translation.
>
> When I originally wrote this code I used gettext, which is a commonly used
> implementation, as a model to build it for CakePHP.
>
> http://en.wikipedia.org/wiki/GNU_gettext
> http://www.gnu.org/software/gettext/
> http://gnuwin32.sourceforge.net/packages/gettext.htm
>
> There are many other examples you can find on the internet showing proper
> way to use gettext.
>
> Look at the site setup for translating GNU and other projects:
> http://translationproject.org/
>
> I doubt you will find a project out of the 160+ on that site using slugs
> like you suggest.
>
> You can use the code however you like though.
>
> --
> /**
> * @author Larry E. Masters
> * @var string $userName
> * @param string $realName
> * @returns string aka PhpNut
> * @access  public
> */
>
> On Wed, Oct 14, 2009 at 11:21 AM, Miles J  wrote:
>
>>
>> Additionally on the subject of PhpNut's suggestion. What if we change
>> the text string in the view (english one) and then the translated ones
>> wont match anymore because the msgid has changed. And if we generate
>> new po files then we would have to translate them all over again.
>> Thats primarily my reason for using slugs.
>>
>> On Oct 14, 7:15 am, Toby Ashley  wrote:
>> > While this discussion is going on, I thought I'd raise / ask
>> something...
>> >
>> > In a recent project, I needed to make it easy for administrators to be
>> able
>> > to edit the text used throughout the site. The site itself runs in 12
>> > languages, and as a result I have 12 *.po files, one per territory. The
>> > administrators for each language are fairly non-technical, and so the
>> system
>> > needed to be easy.
>> >
>> > I built a simple system which would do the following:
>> >
>> > -- Provide a 'download existing website text' button to the
>> administrator -
>> > the controller action would then read through the appropriate *.po file
>> and
>> > generate a CSV with two columns, the identifier (i'm also using
>> descriptive
>> > slugs, as mentioned by Miles) and the current string for that identifier
>> >
>> > -- The administrator can then make the necessary amendments before
>> > re-importing the CSV. When re-importing, the system backs up the
>> existing
>> > *.po file and creates a new one, manually writing the msgid and msgstr
>> > values from the data in the CSV. Finally, when this is done, the system
>> > removes any relevant cache files and  hey presto - the website text is
>> > updated.
>> >
>> > -- There's also tools to revert to previous backup, in case they make an
>> > almighty mess of everything.
>> >
>> > This system worked fine for the project, and the administrators of the
>> site
>> > are maintaining the different languages with success, but I'm wondering
>> if
>> > there's a better / simpler / more recommend way of achieving the same
>> > functionality. I guess it's kind of like a friendly, web-based interface
>> for
>> > editing these *.po files
>> >
>> > Any suggestions?
>> >
>> > Cheers,
>> > toby
>> >
>> > On Wed, Oct 14, 2009 at 2:05 AM, Larry E. Masters aka PhpNut <
>> >
>> > php...@gmail.com> wrote:
>> > > Cool, let me know if you have any questions.
>> > > --
>> > > /**
>> > > * @author Larry E. Masters
>> > > * @var string $userName
>> > > * @param string $realName
>> > > * @returns string aka PhpNut
>> > > * @access  public
>> > > */
>> >
>> > > On Tue, Oct 13, 2009 at 7:46 PM, Miles J 
>> wrote:
>> >
>> > >> Well see now a lot of it makes sense. The guide is pretty vague on
>> > >> i18n/l10n and how it works / is used.
>> >
>> > >> Will give this a try.
>> >
>> > >> On Oct 13, 5:39 pm, "Larry E. Masters aka PhpNut" 
>> > >> wrote:
>> > >> > Incorrect, the file that is created using the i18n extract creates
>> a
>> > >> .pot
>> > >> > file which is a template file and can be opened in any po editor or
>> text
>> > >> > editor. The template is not language specific. There is no reason
>> to
>> > >> create
>> > >> > these files by hand. Write your code and output using the sentences
>> you
>> > >> > would normally use just wrap the string in __() function. Run the
>> > >> extractor
>> > >> > and you are done.
>> > >> > Easiest tool to edit translations I have recently found is
>> > >> poedit.www.poedit.net
>> >
>> > >> > I uploaded current core extracted pot file.
>> >
>> > >> >http://cake-php.googlegroups.com/web/default.pot
>> >
>> > >> > Download i

Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Larry E. Masters aka PhpNut
Miles,

It is not a suggestion it is the correct way the code should be used.

As I stated in the previous email the pot file is reopened, using poedit for
example, and you merge the changes from your code. Your .po and .mo files
will have the correct msgid and your translators will be able to open the
file and "know" that it has been altered because the fields are marked as
fuzzy translation.

When I originally wrote this code I used gettext, which is a commonly used
implementation, as a model to build it for CakePHP.

http://en.wikipedia.org/wiki/GNU_gettext
http://www.gnu.org/software/gettext/
http://gnuwin32.sourceforge.net/packages/gettext.htm

There are many other examples you can find on the internet showing proper
way to use gettext.

Look at the site setup for translating GNU and other projects:
http://translationproject.org/

I doubt you will find a project out of the 160+ on that site using slugs
like you suggest.

You can use the code however you like though.

-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

On Wed, Oct 14, 2009 at 11:21 AM, Miles J  wrote:

>
> Additionally on the subject of PhpNut's suggestion. What if we change
> the text string in the view (english one) and then the translated ones
> wont match anymore because the msgid has changed. And if we generate
> new po files then we would have to translate them all over again.
> Thats primarily my reason for using slugs.
>
> On Oct 14, 7:15 am, Toby Ashley  wrote:
> > While this discussion is going on, I thought I'd raise / ask something...
> >
> > In a recent project, I needed to make it easy for administrators to be
> able
> > to edit the text used throughout the site. The site itself runs in 12
> > languages, and as a result I have 12 *.po files, one per territory. The
> > administrators for each language are fairly non-technical, and so the
> system
> > needed to be easy.
> >
> > I built a simple system which would do the following:
> >
> > -- Provide a 'download existing website text' button to the administrator
> -
> > the controller action would then read through the appropriate *.po file
> and
> > generate a CSV with two columns, the identifier (i'm also using
> descriptive
> > slugs, as mentioned by Miles) and the current string for that identifier
> >
> > -- The administrator can then make the necessary amendments before
> > re-importing the CSV. When re-importing, the system backs up the existing
> > *.po file and creates a new one, manually writing the msgid and msgstr
> > values from the data in the CSV. Finally, when this is done, the system
> > removes any relevant cache files and  hey presto - the website text is
> > updated.
> >
> > -- There's also tools to revert to previous backup, in case they make an
> > almighty mess of everything.
> >
> > This system worked fine for the project, and the administrators of the
> site
> > are maintaining the different languages with success, but I'm wondering
> if
> > there's a better / simpler / more recommend way of achieving the same
> > functionality. I guess it's kind of like a friendly, web-based interface
> for
> > editing these *.po files
> >
> > Any suggestions?
> >
> > Cheers,
> > toby
> >
> > On Wed, Oct 14, 2009 at 2:05 AM, Larry E. Masters aka PhpNut <
> >
> > php...@gmail.com> wrote:
> > > Cool, let me know if you have any questions.
> > > --
> > > /**
> > > * @author Larry E. Masters
> > > * @var string $userName
> > > * @param string $realName
> > > * @returns string aka PhpNut
> > > * @access  public
> > > */
> >
> > > On Tue, Oct 13, 2009 at 7:46 PM, Miles J 
> wrote:
> >
> > >> Well see now a lot of it makes sense. The guide is pretty vague on
> > >> i18n/l10n and how it works / is used.
> >
> > >> Will give this a try.
> >
> > >> On Oct 13, 5:39 pm, "Larry E. Masters aka PhpNut" 
> > >> wrote:
> > >> > Incorrect, the file that is created using the i18n extract creates a
> > >> .pot
> > >> > file which is a template file and can be opened in any po editor or
> text
> > >> > editor. The template is not language specific. There is no reason to
> > >> create
> > >> > these files by hand. Write your code and output using the sentences
> you
> > >> > would normally use just wrap the string in __() function. Run the
> > >> extractor
> > >> > and you are done.
> > >> > Easiest tool to edit translations I have recently found is
> > >> poedit.www.poedit.net
> >
> > >> > I uploaded current core extracted pot file.
> >
> > >> >http://cake-php.googlegroups.com/web/default.pot
> >
> > >> > Download it and open in poedit.
> >
> > >> > The nice thing about these pot file is you can create a new version
> with
> > >> > changes in your application, reopen the template in poedit, and it
> will
> > >> > merge changes highlighting the strings that have changed.
> >
> > >> > Not sure if you are aware how the other translation functions work
> in
> > >> the
> > >> > core, but when it comes to hand

Re: model relations: Problems to run local functions over Model relations

2009-10-14 Thread Obelix

It's a model in a plugin. The name from the plugin is CMS.  The class
is defined as follows

class CmsFolder extends CmsAppModel {



On 14 Okt., 18:30, brian  wrote:
> How does the model class look? It should be:
>
> class CmsFolder extends AppModel {
>
> Is that correct?
>
> On Wed, Oct 14, 2009 at 4:55 AM, Obelix  wrote:
>
> > Yes i have seen it. But i dont't know what is the Problem with the
> > name Standard.
>
> > I have generate the model and the Controller with 'Cake builder'. Cake
> > has recognized the table and also the models and controllers. At the
> > next Step i have test the naming Standard with
>
> > - debug(Inflector::classify('cms_folders'));
>
> > Cake tell me it's all correct (CmsFolder). How can i test the name
> > definition before i create model and controller.
>
> > On 14 Okt., 10:15, "Dr. Loboto"  wrote:
> >> "AppModel Object" - cake did not find your model file and created
> >> AppModel as Miles and Brian both already said.
>
> >> On Oct 14, 2:57 am, Obelix  wrote:
>
> >> > Hello,
> >> > i have test if Model available and it's look like good. The
> >> > Programcode
>
> >> > - debug($this->CmsFile->CmsFolder);
>
> >> > gives me Information about the Model 'CmsFolder'.
>
> >> > AppModel Object
> >> > (
> >> >     [useDbConfig] => default
> >> >     [useTable] => cms_folders
> >> >     [displayField] => id
> >> >     [id] =>
> >> >     [data] => Array
> >> >         (
> >> >         )
>
> >> >     [table] => cms_folders
> >> >     [primaryKey] => id
> >> >     [_schema] => Array
> >> >         (
> >> >       ..
>
> >> > What it could be even more ?
>
> >> > Regards Uwe
>
> >> > On 13 Okt., 18:56, brian  wrote:
>
> >> > > If Cake doesn't find the model, it uses AppModel. The latter does not
> >> > > have a method getLocalTest().
>
> >> > > On Tue, Oct 13, 2009 at 5:34 AM, Obelix  wrote:
>
> >> > > > Thanks for your Answer.
>
> >> > > > I will test it in the evening.
>
> >> > > > So that does not happen i generate the plugin(cms), model and
> >> > > > controller with 'Cake Code Generation'.
>
> >> > > > I am also surprised that the following code works
>
> >> > > >  - $cmsFolders = $this->CmsFile->CmsFolder->find('list');
>
> >> > > > and the other code dont works.
>
> >> > > > - debug($this->CmsFile->CmsFolder->getLocalTest());
>
> >> > > > In both lines, we referenced the Model (CmsFolder)
>
> >> > > > Regards Uwe
>
> >> > > > On 13 Okt., 01:34, Miles J  wrote:
> >> > > >> That means that your model is not getting loaded, hence the custom
> >> > > >> method does not exist.
>
> >> > > >> Try printing out the parent object to see if the association is
> >> > > >> loaded, if it is not your naming conventions are wrong.
>
> >> > > >> On Oct 12, 3:47 pm, Obelix  wrote:
>
> >> > > >> > Hi,
> >> > > >> > if i run a local function in a other model, cake display a Error
> >> > > >> > Message:
>
> >> > > >> > Warning (512): SQL Error: 1064: You have an error in your SQL 
> >> > > >> > syntax;
> >> > > >> > check the manual that corresponds to your MySQL server version 
> >> > > >> > for the
> >> > > >> > right syntax to use near 'getLocalTest' at line 1 [CORE/cake/libs/
> >> > > >> > model/datasources/dbo_source.php, line 525]
>
> >> > > >> > The environment looks like this:
>
> >> > > >> > Definition Table:
> >> > > >> >   - cms_folders
> >> > > >> >   - cms_files
>
> >> > > >> > Definition Model:
> >> > > >> >  - CmsFolder      -> hasMany   (CmsFile)        the Filename is
> >> > > >> > 'cms_folder.php'
> >> > > >> >  - CmsFile           -> belongsTo (CmsFolder)   the Filename is
> >> > > >> > 'cms_file.php'
>
> >> > > >> > Definition Controller:
> >> > > >> >  - CmsFolders                                                 the
> >> > > >> > Filename is 'cms_folders_controller.php'
> >> > > >> >  - CmsFiles                                                      
> >> > > >> > the
> >> > > >> > Filename is 'cms_files_controller.php'
>
> >> > > >> > In the Model 'CmsFolder' i define a dummy function:
>
> >> > > >> >   function getLocalTest() {
> >> > > >> >     return 'www';
> >> > > >> >   }
>
> >> > > >> > I want run the function 'getLocalTest()' in the action 'add' in 
> >> > > >> > the
> >> > > >> > controller 'CmsFilesController'. The Code looks like this.
>
> >> > > >> > - debug($this->CmsFile->CmsFolder->getLocalTest());
>
> >> > > >> > If this line is running, the error message is displayed. But when 
> >> > > >> > i
> >> > > >> > run the following function, its all ok.
>
> >> > > >> > - $cmsFolders = $this->CmsFile->CmsFolder->find('list');
>
> >> > > >> > I do not know what the problem is and hope for their help.
>
> >> > > >> > Regards Uwe
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://grou

Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Larry E. Masters aka PhpNut
Toby,
It sounds like you are trying to use translations as a way to also change
text.

Examples (forgive me in advance if google did not translate these properly):

"Welcome to the home page of CakePHP the best PHP framework for rapidly
building applications."

Translated to German this would be:

"Willkommen auf der Homepage von CakePHP den besten Rahmen für PHP schnell
die Erstellung von Anwendungen."

Anything else would not be a translation:

Example:

"Herzlich Willkommen auf meiner Homepage der Anwendungen habe ich mit Hilfe
meiner CakePHP Rahmen der Wahl."

Which means:

"Welcome to my home page of the applications I have built using CakePHP my
framework of choice."

This is not translating text, and it not what I18n is to be used for.

-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

On Wed, Oct 14, 2009 at 9:15 AM, Toby Ashley  wrote:

> While this discussion is going on, I thought I'd raise / ask something...
>
> In a recent project, I needed to make it easy for administrators to be able
> to edit the text used throughout the site. The site itself runs in 12
> languages, and as a result I have 12 *.po files, one per territory. The
> administrators for each language are fairly non-technical, and so the system
> needed to be easy.
>
> I built a simple system which would do the following:
>
> -- Provide a 'download existing website text' button to the administrator -
> the controller action would then read through the appropriate *.po file and
> generate a CSV with two columns, the identifier (i'm also using descriptive
> slugs, as mentioned by Miles) and the current string for that identifier
>
> -- The administrator can then make the necessary amendments before
> re-importing the CSV. When re-importing, the system backs up the existing
> *.po file and creates a new one, manually writing the msgid and msgstr
> values from the data in the CSV. Finally, when this is done, the system
> removes any relevant cache files and  hey presto - the website text is
> updated.
>
> -- There's also tools to revert to previous backup, in case they make an
> almighty mess of everything.
>
> This system worked fine for the project, and the administrators of the site
> are maintaining the different languages with success, but I'm wondering if
> there's a better / simpler / more recommend way of achieving the same
> functionality. I guess it's kind of like a friendly, web-based interface for
> editing these *.po files
>
> Any suggestions?
>
> Cheers,
> toby
>
>
>
>
> On Wed, Oct 14, 2009 at 2:05 AM, Larry E. Masters aka PhpNut <
> php...@gmail.com> wrote:
>
>> Cool, let me know if you have any questions.
>> --
>> /**
>> * @author Larry E. Masters
>> * @var string $userName
>> * @param string $realName
>> * @returns string aka PhpNut
>> * @access  public
>> */
>>
>> On Tue, Oct 13, 2009 at 7:46 PM, Miles J  wrote:
>>
>>>
>>> Well see now a lot of it makes sense. The guide is pretty vague on
>>> i18n/l10n and how it works / is used.
>>>
>>> Will give this a try.
>>>
>>> On Oct 13, 5:39 pm, "Larry E. Masters aka PhpNut" 
>>> wrote:
>>> > Incorrect, the file that is created using the i18n extract creates a
>>> .pot
>>> > file which is a template file and can be opened in any po editor or
>>> text
>>> > editor. The template is not language specific. There is no reason to
>>> create
>>> > these files by hand. Write your code and output using the sentences you
>>> > would normally use just wrap the string in __() function. Run the
>>> extractor
>>> > and you are done.
>>> > Easiest tool to edit translations I have recently found is
>>> poedit.www.poedit.net
>>> >
>>> > I uploaded current core extracted pot file.
>>> >
>>> > http://cake-php.googlegroups.com/web/default.pot
>>> >
>>> > Download it and open in poedit.
>>> >
>>> > The nice thing about these pot file is you can create a new version
>>> with
>>> > changes in your application, reopen the template in poedit, and it will
>>> > merge changes highlighting the strings that have changed.
>>> >
>>> > Not sure if you are aware how the other translation functions work in
>>> the
>>> > core, but when it comes to handling plurals in a sentence, your slugs
>>> will
>>> > become more confusing.
>>> >
>>> > for($number = 0; $i < 100; $number++) {
>>> > sprintf(__n('There is %d apple in the fruit bowl', 'There are %d apples
>>> in
>>> > the fruit bowl', $number), $number);
>>> >
>>> > }
>>> >
>>> > msgid "There is %d apple in the fruit bowl"
>>> > msgid_plural "There are %d apples in the fruit bowl"
>>> > msgstr[0] ""
>>> > msgstr[1] ""
>>> > msgstr[2] ""
>>> > msgstr[3] ""
>>> > msgstr[4] ""
>>> > msgstr[5] ""
>>> > msgstr[6] ""
>>> >
>>> > There are 16 plural rules that range from 1 form of plural to 6 forms
>>> of
>>> > plural depending on the value of $number. It all depends and the
>>> language
>>> > the content is being translated to. The above example be based on the
>>> header
>>> > in t

Re: Debug Error?

2009-10-14 Thread Miles J

Well if you remove the view and it works, then its obviously something
wrong in the view.

Your best bet is to remove sections of the view 1 by 1 to see what
errors.

On Oct 14, 9:45 am, "Dave Maharaj :: WidePixels.com"
 wrote:
> Nothing out of the ordinary.
>
> No there was none (Debugger::log(), Debugger::dump() anything like that
> added anywhere)
> Just the data sent back from the controller.
> Just weird how nothing was reported when debug was set to 1 or 2 but at 0 it
> just died.
>
> I just cleared the entire view and rebuilding it. And checking line by line
> to see where / if it break again.
>
> Thanks,
>
> Dave
>
> -Original Message-
> From: brian [mailto:bally.z...@gmail.com]
> Sent: October-14-09 1:54 PM
> To: cake-php@googlegroups.com
> Subject: Re: Debug Error?
>
> On Tue, Oct 13, 2009 at 4:16 PM, Dave Maharaj :: WidePixels.com
>  wrote:
>
> > I ran a find and replace for all debug();
>
> > Still same thing.
>
> I meant the Debugger class, not debug(). Like Debugger::log(),
> Debugger::dump(), etc. If Configure's debug setting is 0 you'll get a fatal
> error if you have any code like that.
>
> > So I stripped out the view file and it works now so Yeah looks like
> > something in the actual view file was killing it.
>
> You didn't see anything suspicious in the view?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to switch between databases dynamically by session value

2009-10-14 Thread brian

Are you certain that the settings for 'testcases' are correct? Did you
by any chance name the database 'testcases' instead of 'db_testcases'?

On Wed, Oct 14, 2009 at 6:24 AM, Christian  wrote:
>
> Hello,
>
> I read several threads about this but not found a final "cake-like"
> solution. A lot of posts are about switching based on URLs, but I need
> to switch to another "testcases" database connection based on a
> session value I set in an action. This "testcases" connection should
> be used until end of the session/logout.
>
> I read about modifying database.php adding function __construct() and
> switching the default connection there, but how can I access the cake
> session there - I assume the cake core isn't fully initialized at that
> construct point and I cannot use the session component there.
>
>
> My setup:
> - In database.php I created two items: $default and $testcases (only
> difference: database name and content of course)
> - In a controller action I am saving a session value which database
> connection to use
>
>
> Try 1) I tried to set in app_controller.php/beforeFilter() the model
> var useDbConfig to switch the database. But after the normal action
> and find('all) I get a SQL error (no database selected) whereas my
> debug calls tell me that the model has switched to the "testcases"
> database config correctly (or not?).
>
>   function beforeFilter() {
>      if ($this->Session->read('tmp.dbconfig') && is_object($this->
> {$this->modelClass})) {
>         /* debugging */ $db = $this->{$this->modelClass}-
>>getDataSource(); debug($db->config);
>         $this->{$this->modelClass}->useDbConfig = 'testcases';
>         /* debugging */ $db = $this->{$this->modelClass}-
>>getDataSource(); debug($db->config);
>      }
>   ...
>   }
> Warning (512): SQL Error: 1046: No database selected [CORE\cake\libs
> \model\datasources\dbo_source.php, line 525]
>
>
> Try 2) I tried to use the ConnectionManager method in the
> app_controller.php/beforeFilter(), but had no real success ... I do
> not really know what to do! From another thread I tried the following
> but same error
>
>   function beforeFilter() {
>      if ($this->Session->read('tmp.dbconfig') && is_object($this->
> {$this->modelClass})) {
>         /* debugging */ $_db = $this->{$this->modelClass}-
>>getDataSource(); debug($_db->config);
>         $db =& ConnectionManager::getDataSource('default');
>         $db->disconnect();
>         $db->config['database'] = 'db_testcases';
>         $db->connect();
>         /* debugging */ $_db = $this->{$this->modelClass}-
>>getDataSource(); debug($_db->config);
>      }
>   ...
>   }
> Warning (512): SQL Error: 1046: No database selected [CORE\cake\libs
> \model\datasources\dbo_source.php, line 525]
>
>
>
> So, what is the best practice to switch database connections
> dynamically by session content?
> In controller, model, or???
>
>
> I am very thankful for any positive answer!
>
> Christian
>
> ps. talking about cake 1.2.5
> my references: searched for "usedbconfig session"
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Debug Error?

2009-10-14 Thread Dave Maharaj :: WidePixels.com

Nothing out of the ordinary. 

No there was none (Debugger::log(), Debugger::dump() anything like that
added anywhere)
Just the data sent back from the controller. 
Just weird how nothing was reported when debug was set to 1 or 2 but at 0 it
just died.

I just cleared the entire view and rebuilding it. And checking line by line
to see where / if it break again.

Thanks,

Dave

-Original Message-
From: brian [mailto:bally.z...@gmail.com] 
Sent: October-14-09 1:54 PM
To: cake-php@googlegroups.com
Subject: Re: Debug Error?


On Tue, Oct 13, 2009 at 4:16 PM, Dave Maharaj :: WidePixels.com
 wrote:
>
> I ran a find and replace for all debug();
>
> Still same thing.

I meant the Debugger class, not debug(). Like Debugger::log(),
Debugger::dump(), etc. If Configure's debug setting is 0 you'll get a fatal
error if you have any code like that.

> So I stripped out the view file and it works now so Yeah looks like 
> something in the actual view file was killing it.

You didn't see anything suspicious in the view?




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: pageTitle and title_for_layout in CakePHP 1.3 views

2009-10-14 Thread mark_story

You are not limited to title_for_layout either.  You can set any view
variable and use that.

-Mark

On Oct 11, 1:30 pm, mmalca  wrote:
> There was an elegant way to set page title anywhere in view using
> CakePHP 1.2 - with $this->pageTitle = 'new title';  This has been
> removed in cakephp 1.3 in favor of $this->set('title_for_layout',
> 'page title');
>
> Is there no simple way left to set page title elsewhere in view? Can
> it be changed/set only in controller?
>
> Here's an example. I want to change page title in my theme (in a view
> without overriding default layout). This was possible by setting $this-
>
>
>
> >pageTitle. So: how can a custom view theme change page title?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Deployment issue - must be simple but I am missing it

2009-10-14 Thread FrederickD

Thanks for the reply. The debug value has always been '2' so that I
see the poopy pants on deployment.

I actually have made no other changes than the .htaccess files until I
was approaching vague awareness from the group. So far I'm still in
the dark.

I can start over easily enough. I still am wondering if my directory
structure is compatible with my deployment. It is quite conceivable to
have more than one Cake application for this client. It would seem
logical to put Cake at the root level of the shared hosting for the
start. Am I understanding that correctly?

If I do that would I then follow the instructions from
http://groups.google.com/group/cake-php/browse_thread/thread/1d2abbf25e150420?hl=en?

Thank you!

On Oct 14, 11:38 am, me me me  wrote:
> On Oct 12, 2:47 pm, FrederickD  wrote:
>
>
>
> > My site is herehttp://bgnation.ca/reporting/. The initial page
> > renders fine (I haven't replaced the lorem ipsum yet... mea culpa...).
> > However, when I try to log in on the side bar I receive a 404 error
> > forhttp://bgnation.ca/users/login. Using a URL to access any other
> > controller action yields the same result. The 'Home' button on the
> > navigation bar works however.
>
> Is debug set to 0? When it is, Cake emits a 404 whenever there's a
> nasty error. This is to keep regular users from seeing your dirty
> laundry.Set it to 2 and try again.
>
> Of course, now that you've been fiddling around you may have created
> more problems. :-(
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Deployment issue - must be simple but I am missing it

2009-10-14 Thread me me me

On Oct 12, 2:47 pm, FrederickD  wrote:
>
> My site is herehttp://bgnation.ca/reporting/. The initial page
> renders fine (I haven't replaced the lorem ipsum yet... mea culpa...).
> However, when I try to log in on the side bar I receive a 404 error
> forhttp://bgnation.ca/users/login. Using a URL to access any other
> controller action yields the same result. The 'Home' button on the
> navigation bar works however.

Is debug set to 0? When it is, Cake emits a 404 whenever there's a
nasty error. This is to keep regular users from seeing your dirty
laundry.Set it to 2 and try again.

Of course, now that you've been fiddling around you may have created
more problems. :-(
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: model relations: Problems to run local functions over Model relations

2009-10-14 Thread brian

How does the model class look? It should be:

class CmsFolder extends AppModel {

Is that correct?

On Wed, Oct 14, 2009 at 4:55 AM, Obelix  wrote:
>
> Yes i have seen it. But i dont't know what is the Problem with the
> name Standard.
>
> I have generate the model and the Controller with 'Cake builder'. Cake
> has recognized the table and also the models and controllers. At the
> next Step i have test the naming Standard with
>
> - debug(Inflector::classify('cms_folders'));
>
> Cake tell me it's all correct (CmsFolder). How can i test the name
> definition before i create model and controller.
>
>
> On 14 Okt., 10:15, "Dr. Loboto"  wrote:
>> "AppModel Object" - cake did not find your model file and created
>> AppModel as Miles and Brian both already said.
>>
>> On Oct 14, 2:57 am, Obelix  wrote:
>>
>> > Hello,
>> > i have test if Model available and it's look like good. The
>> > Programcode
>>
>> > - debug($this->CmsFile->CmsFolder);
>>
>> > gives me Information about the Model 'CmsFolder'.
>>
>> > AppModel Object
>> > (
>> >     [useDbConfig] => default
>> >     [useTable] => cms_folders
>> >     [displayField] => id
>> >     [id] =>
>> >     [data] => Array
>> >         (
>> >         )
>>
>> >     [table] => cms_folders
>> >     [primaryKey] => id
>> >     [_schema] => Array
>> >         (
>> >       ..
>>
>> > What it could be even more ?
>>
>> > Regards Uwe
>>
>> > On 13 Okt., 18:56, brian  wrote:
>>
>> > > If Cake doesn't find the model, it uses AppModel. The latter does not
>> > > have a method getLocalTest().
>>
>> > > On Tue, Oct 13, 2009 at 5:34 AM, Obelix  wrote:
>>
>> > > > Thanks for your Answer.
>>
>> > > > I will test it in the evening.
>>
>> > > > So that does not happen i generate the plugin(cms), model and
>> > > > controller with 'Cake Code Generation'.
>>
>> > > > I am also surprised that the following code works
>>
>> > > >  - $cmsFolders = $this->CmsFile->CmsFolder->find('list');
>>
>> > > > and the other code dont works.
>>
>> > > > - debug($this->CmsFile->CmsFolder->getLocalTest());
>>
>> > > > In both lines, we referenced the Model (CmsFolder)
>>
>> > > > Regards Uwe
>>
>> > > > On 13 Okt., 01:34, Miles J  wrote:
>> > > >> That means that your model is not getting loaded, hence the custom
>> > > >> method does not exist.
>>
>> > > >> Try printing out the parent object to see if the association is
>> > > >> loaded, if it is not your naming conventions are wrong.
>>
>> > > >> On Oct 12, 3:47 pm, Obelix  wrote:
>>
>> > > >> > Hi,
>> > > >> > if i run a local function in a other model, cake display a Error
>> > > >> > Message:
>>
>> > > >> > Warning (512): SQL Error: 1064: You have an error in your SQL 
>> > > >> > syntax;
>> > > >> > check the manual that corresponds to your MySQL server version for 
>> > > >> > the
>> > > >> > right syntax to use near 'getLocalTest' at line 1 [CORE/cake/libs/
>> > > >> > model/datasources/dbo_source.php, line 525]
>>
>> > > >> > The environment looks like this:
>>
>> > > >> > Definition Table:
>> > > >> >   - cms_folders
>> > > >> >   - cms_files
>>
>> > > >> > Definition Model:
>> > > >> >  - CmsFolder      -> hasMany   (CmsFile)        the Filename is
>> > > >> > 'cms_folder.php'
>> > > >> >  - CmsFile           -> belongsTo (CmsFolder)   the Filename is
>> > > >> > 'cms_file.php'
>>
>> > > >> > Definition Controller:
>> > > >> >  - CmsFolders                                                 the
>> > > >> > Filename is 'cms_folders_controller.php'
>> > > >> >  - CmsFiles                                                      the
>> > > >> > Filename is 'cms_files_controller.php'
>>
>> > > >> > In the Model 'CmsFolder' i define a dummy function:
>>
>> > > >> >   function getLocalTest() {
>> > > >> >     return 'www';
>> > > >> >   }
>>
>> > > >> > I want run the function 'getLocalTest()' in the action 'add' in the
>> > > >> > controller 'CmsFilesController'. The Code looks like this.
>>
>> > > >> > - debug($this->CmsFile->CmsFolder->getLocalTest());
>>
>> > > >> > If this line is running, the error message is displayed. But when i
>> > > >> > run the following function, its all ok.
>>
>> > > >> > - $cmsFolders = $this->CmsFile->CmsFolder->find('list');
>>
>> > > >> > I do not know what the problem is and hope for their help.
>>
>> > > >> > Regards Uwe
>>
>>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Fatal error: BehaviorCollection::trigger()

2009-10-14 Thread Dave Maharaj :: WidePixels.com

Anyone seen this?
 
The script tried to execute a method or access a property of an incomplete
object. Please ensure that the class definition 'ValidationBehavior' of the
object you are trying to operate on was loaded _before_ unserialize() gets
called or provide a __autoload() function to load the class definition
 
It suddenly appears and not sure whats causing it?
Controller? Model? Javascript?
 
Any ideas where to start looking
 
Dave


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Debug Error?

2009-10-14 Thread brian

On Tue, Oct 13, 2009 at 4:16 PM, Dave Maharaj :: WidePixels.com
 wrote:
>
> I ran a find and replace for all debug();
>
> Still same thing.

I meant the Debugger class, not debug(). Like Debugger::log(),
Debugger::dump(), etc. If Configure's debug setting is 0 you'll get a
fatal error if you have any code like that.

> So I stripped out the view file and it works now so Yeah looks like
> something in the actual view file was killing it.

You didn't see anything suspicious in the view?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Miles J

Additionally on the subject of PhpNut's suggestion. What if we change
the text string in the view (english one) and then the translated ones
wont match anymore because the msgid has changed. And if we generate
new po files then we would have to translate them all over again.
Thats primarily my reason for using slugs.

On Oct 14, 7:15 am, Toby Ashley  wrote:
> While this discussion is going on, I thought I'd raise / ask something...
>
> In a recent project, I needed to make it easy for administrators to be able
> to edit the text used throughout the site. The site itself runs in 12
> languages, and as a result I have 12 *.po files, one per territory. The
> administrators for each language are fairly non-technical, and so the system
> needed to be easy.
>
> I built a simple system which would do the following:
>
> -- Provide a 'download existing website text' button to the administrator -
> the controller action would then read through the appropriate *.po file and
> generate a CSV with two columns, the identifier (i'm also using descriptive
> slugs, as mentioned by Miles) and the current string for that identifier
>
> -- The administrator can then make the necessary amendments before
> re-importing the CSV. When re-importing, the system backs up the existing
> *.po file and creates a new one, manually writing the msgid and msgstr
> values from the data in the CSV. Finally, when this is done, the system
> removes any relevant cache files and  hey presto - the website text is
> updated.
>
> -- There's also tools to revert to previous backup, in case they make an
> almighty mess of everything.
>
> This system worked fine for the project, and the administrators of the site
> are maintaining the different languages with success, but I'm wondering if
> there's a better / simpler / more recommend way of achieving the same
> functionality. I guess it's kind of like a friendly, web-based interface for
> editing these *.po files
>
> Any suggestions?
>
> Cheers,
> toby
>
> On Wed, Oct 14, 2009 at 2:05 AM, Larry E. Masters aka PhpNut <
>
> php...@gmail.com> wrote:
> > Cool, let me know if you have any questions.
> > --
> > /**
> > * @author Larry E. Masters
> > * @var string $userName
> > * @param string $realName
> > * @returns string aka PhpNut
> > * @access  public
> > */
>
> > On Tue, Oct 13, 2009 at 7:46 PM, Miles J  wrote:
>
> >> Well see now a lot of it makes sense. The guide is pretty vague on
> >> i18n/l10n and how it works / is used.
>
> >> Will give this a try.
>
> >> On Oct 13, 5:39 pm, "Larry E. Masters aka PhpNut" 
> >> wrote:
> >> > Incorrect, the file that is created using the i18n extract creates a
> >> .pot
> >> > file which is a template file and can be opened in any po editor or text
> >> > editor. The template is not language specific. There is no reason to
> >> create
> >> > these files by hand. Write your code and output using the sentences you
> >> > would normally use just wrap the string in __() function. Run the
> >> extractor
> >> > and you are done.
> >> > Easiest tool to edit translations I have recently found is
> >> poedit.www.poedit.net
>
> >> > I uploaded current core extracted pot file.
>
> >> >http://cake-php.googlegroups.com/web/default.pot
>
> >> > Download it and open in poedit.
>
> >> > The nice thing about these pot file is you can create a new version with
> >> > changes in your application, reopen the template in poedit, and it will
> >> > merge changes highlighting the strings that have changed.
>
> >> > Not sure if you are aware how the other translation functions work in
> >> the
> >> > core, but when it comes to handling plurals in a sentence, your slugs
> >> will
> >> > become more confusing.
>
> >> > for($number = 0; $i < 100; $number++) {
> >> > sprintf(__n('There is %d apple in the fruit bowl', 'There are %d apples
> >> in
> >> > the fruit bowl', $number), $number);
>
> >> > }
>
> >> > msgid "There is %d apple in the fruit bowl"
> >> > msgid_plural "There are %d apples in the fruit bowl"
> >> > msgstr[0] ""
> >> > msgstr[1] ""
> >> > msgstr[2] ""
> >> > msgstr[3] ""
> >> > msgstr[4] ""
> >> > msgstr[5] ""
> >> > msgstr[6] ""
>
> >> > There are 16 plural rules that range from 1 form of plural to 6 forms of
> >> > plural depending on the value of $number. It all depends and the
> >> language
> >> > the content is being translated to. The above example be based on the
> >> header
> >> > in the po file, which poedit allows you to set based on the language you
> >> are
> >> > using.
>
> >> > Only 1 form of plural.
> >> > "Plural-Forms: nplurals=1; plural=0;\n"
>
> >> > 6 forms of plural.
> >> > "Plural-Forms: nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n==0 || (n>=3 &&
> >> > n<=10) ? 2 : 3;\n"
>
> >> > 14 other forms or plural are available. These will be added to the
> >> > translation site I had online for the project before. This will be
> >> coming
> >> > back online in the next few weeks. They will also be added to the book,
> >> with
> >> > corrections on the proper us

Re: Controller and Session in View

2009-10-14 Thread brian

On Wed, Oct 14, 2009 at 4:00 AM, Prof. No Time
 wrote:
>
> Thanks Brian,
>
> I am using the AUTH component. I want to access Auth.user() in the
> view and I think the only way I can do that is if I can get the
> controller in the view so I can say this->controller->Auth->user(). I
> guess this is the wrongest way to go right? But I am new and just
> floating around trying to find my feet. Please don't be irritated with
> my blunders, help me.

In a view, use $session->read('Auth.User.some_field'), eg.
$session->read('Auth.User.last_name'). Put this in one of your views:

debug($session->read('Auth.User'))

If Auth's $userModel is something other than 'User' replace with that
model name instead.

> Also, when I use the auth component, I'd like to know the following:
> 1. How and When do I know that the Auth component has successfully (or
> otherwise) authenticated the user? Is there something like if ($this-
>>Auth->authSuccess){}?

If you are not redirected properly and you see an error msg then login
was unsuccessful.

> 2. How can I perform further actions after a successful auth like,
> save the login time, check for file permissions and load them, notify
> other people that someone just logged in?

In AppController::beforeFilter()

$this->Auth->loginRedirect = array(
'controller' => 'public_static',
'action' => 'display',
'home'
);
$this->Auth->autoRedirect = false;

The last line tells Auth not to redirect the user immediately. Add a
login() method to UsersController:

public function login()
{
if (!empty($this->data) && $user = $this->Auth->user())
{
$last_login = date('Y-m-d H:i:s');
$this->User->id = $user['User']['id'];
$this->User->saveField('last_login', $last_login);
$this->Session->write('Auth.User.last_login', $last_login);
$this->redirect($this->Auth->loginRedirect);
}
}

> I'm grateful for your help. God bless you!
>
> On Oct 13, 6:11 pm, brian  wrote:
>> On Tue, Oct 13, 2009 at 12:37 PM, Prof. No Time
>>
>>  wrote:
>>
>> > Hello People, thanks so much for your attempts at my bake problem.
>> > Obviously no one was close at all to the answer but I figured out
>> > myself how to bake and I have baked successfully quite a number of
>> > times now. I am new to this cake thing and I hope you guys can help me
>> > sail through. I love Qcubed because they always answer when I cry, I
>> > hope cake won't be any different.
>>
>> > Now to my Question, please, how do I access the CONTROLLER and SESSION
>> > in a VIEW? Is it possible? If yes HOW, if no ALTERNATIVE.
>>
>> In the view, use $session['whatever']. Add debug($session) to see what
>> it looks like.
>>
>> As for accessing the controller, it's not really set up for that and
>> you probably don't need to. What are you trying to do?
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread red

As I understand, you try to build some kind of dashboard. Check this
tutorial, maybe this works for you:
http://teknoid.wordpress.com/2008/12/16/how-to-build-a-dashboard-for-your-application-in-cakephp/


On Oct 14, 5:54 pm, "gimperdan...@gmail.com" 
wrote:
> I kinda understand what you're saying, but I am rather lost with some
> concepts in Cake. I have to read more first... Thanks...
>
> PS: legal seu site!
>
> On Oct 14, 11:20 am, Eber Freitas Dias  wrote:
>
>
>
> > Hi!
>
> > The fact that "home.ctp" is the default home for your app it doesn't mean
> > you have to use it!
>
> > You can just re declare a new home in your routes using the controller you
> > want. Something like:
>
> > Router::connect('/', array('controller' => 'mycontroller', 'action' =>
> > 'index'));
>
> > The second argument on the connect method works just like the url on your
> > link methods from the html helper.
>
> > There is some basic understanding related to behaviours, components and
> > helpers... See:
>
> > Helpers extends functionality to views.
> > Components extends functionality to controllers.
> > Behaviours extends functionality to models.
>
> > If you need some custom data, instead of using requestAction, I would
> > consider creating a new function on your model and simply calling it
> > instead. You can create as many functions you like in your modesl, and once
> > you start doing that, you won't stop. It makes things really simpler!
>
> > On Wed, Oct 14, 2009 at 11:57 AM, gimperdan...@gmail.com <
>
> > gimperdan...@gmail.com> wrote:
>
> > > Thanks. That helps a little. From what I've been reading it's better
> > > to use Elements for HTML chunks and Helpers for logic. But
> > > requestAction seems like a good option too.
>
> > > On Oct 14, 10:54 am, Céryl  wrote:
> > > > I don't really know the answer, but just to add to that, the home.ctp
> > > > has a controller, it's the pages_controller.
> > > > And also, you can of course use actions from other controllers and
> > > > models in the pages-views by using Cake's requestAction. I use it
> > > > sometimes to get for instance  number of posts, users, pictures or
> > > > whatever on the sites main index page.
>
> > > > On 14 okt, 16:38, "gimperdan...@gmail.com" 
> > > > wrote:
>
> > > > > On the index of my website I get content from several different tables
> > > > > in the database. Which is best to use? Elements? Behaviors? or
> > > > > Helpers? As far as I understand the index(home.ctp) page doesn't have
> > > > > a  model or controller.
>
> > --
> > Éber Freitas Dias
>
> >www.eberfdias.comwww.dejamps.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Ajax call with external redirect doesn't work

2009-10-14 Thread marco.rizze...@gmail.com

Hi
I must do a ajax call to an external site.
I use a proxy to circumvent the Same Origin Policy.
My action-controller proxy is:

function  proxy($url) {
$this->redirect($url,301,true);
}

In my view when I do the ajax call I get the error :

Error:  Http:Controller could not be found.

If I call directly the action "proxy" it works correctly.
It seems that CakePHP can't do  ajax call external.
Is it correct or I do some mistake?
Many Thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread gimperdan...@gmail.com

I kinda understand what you're saying, but I am rather lost with some
concepts in Cake. I have to read more first... Thanks...

PS: legal seu site!

On Oct 14, 11:20 am, Eber Freitas Dias  wrote:
> Hi!
>
> The fact that "home.ctp" is the default home for your app it doesn't mean
> you have to use it!
>
> You can just re declare a new home in your routes using the controller you
> want. Something like:
>
> Router::connect('/', array('controller' => 'mycontroller', 'action' =>
> 'index'));
>
> The second argument on the connect method works just like the url on your
> link methods from the html helper.
>
> There is some basic understanding related to behaviours, components and
> helpers... See:
>
> Helpers extends functionality to views.
> Components extends functionality to controllers.
> Behaviours extends functionality to models.
>
> If you need some custom data, instead of using requestAction, I would
> consider creating a new function on your model and simply calling it
> instead. You can create as many functions you like in your modesl, and once
> you start doing that, you won't stop. It makes things really simpler!
>
> On Wed, Oct 14, 2009 at 11:57 AM, gimperdan...@gmail.com <
>
>
>
> gimperdan...@gmail.com> wrote:
>
> > Thanks. That helps a little. From what I've been reading it's better
> > to use Elements for HTML chunks and Helpers for logic. But
> > requestAction seems like a good option too.
>
> > On Oct 14, 10:54 am, Céryl  wrote:
> > > I don't really know the answer, but just to add to that, the home.ctp
> > > has a controller, it's the pages_controller.
> > > And also, you can of course use actions from other controllers and
> > > models in the pages-views by using Cake's requestAction. I use it
> > > sometimes to get for instance  number of posts, users, pictures or
> > > whatever on the sites main index page.
>
> > > On 14 okt, 16:38, "gimperdan...@gmail.com" 
> > > wrote:
>
> > > > On the index of my website I get content from several different tables
> > > > in the database. Which is best to use? Elements? Behaviors? or
> > > > Helpers? As far as I understand the index(home.ctp) page doesn't have
> > > > a  model or controller.
>
> --
> Éber Freitas Dias
>
> www.eberfdias.comwww.dejamps.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Obama: Afghanistan decision in 'coming weeks'

2009-10-14 Thread brian

On Tue, Oct 13, 2009 at 8:46 PM, Larry E. Masters aka PhpNut
 wrote:
> Do not send spam like this to the CakePHP google group, I will block your
> account if it happens again.
> --
> /**
> * @author Larry E. Masters
> * @var string $userName
> * @param string $realName
> * @returns string aka PhpNut
> * @access  public
> */
> On Tue, Oct 13, 2009 at 5:18 PM, News  wrote:
>>
>> Obama: Afghanistan decision in 'coming weeks'
>>
>> http://bit.ly/2dWFN5
>>
>> http://bit.ly/2dWFN5
>>
>> http://bit.ly/2dWFN5
>>
>> Obama: Afghanistan decision in 'coming weeks'
>>
>> >>
>
>

I didn't send that. It appears that my acct. has been spoofed.

http://mail.google.com/support/bin/answer.py?hl=en&answer=50200

If necessary, I'll kill this acct..

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread Eber Freitas Dias
Hi!

The fact that "home.ctp" is the default home for your app it doesn't mean
you have to use it!

You can just re declare a new home in your routes using the controller you
want. Something like:

Router::connect('/', array('controller' => 'mycontroller', 'action' =>
'index'));

The second argument on the connect method works just like the url on your
link methods from the html helper.

There is some basic understanding related to behaviours, components and
helpers... See:

Helpers extends functionality to views.
Components extends functionality to controllers.
Behaviours extends functionality to models.

If you need some custom data, instead of using requestAction, I would
consider creating a new function on your model and simply calling it
instead. You can create as many functions you like in your modesl, and once
you start doing that, you won't stop. It makes things really simpler!

On Wed, Oct 14, 2009 at 11:57 AM, gimperdan...@gmail.com <
gimperdan...@gmail.com> wrote:

>
> Thanks. That helps a little. From what I've been reading it's better
> to use Elements for HTML chunks and Helpers for logic. But
> requestAction seems like a good option too.
>
> On Oct 14, 10:54 am, Céryl  wrote:
> > I don't really know the answer, but just to add to that, the home.ctp
> > has a controller, it's the pages_controller.
> > And also, you can of course use actions from other controllers and
> > models in the pages-views by using Cake's requestAction. I use it
> > sometimes to get for instance  number of posts, users, pictures or
> > whatever on the sites main index page.
> >
> > On 14 okt, 16:38, "gimperdan...@gmail.com" 
> > wrote:
> >
> > > On the index of my website I get content from several different tables
> > > in the database. Which is best to use? Elements? Behaviors? or
> > > Helpers? As far as I understand the index(home.ctp) page doesn't have
> > > a  model or controller.
> >
>


-- 
Éber Freitas Dias

www.eberfdias.com
www.dejamps.net

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: executing queries from a .sql file in the console

2009-10-14 Thread Yuncong Zhang
Yeah, I use it inside a Shell inheritance.

uses('model'.DS.'connection_manager');
$db = ConnectionManager::getInstance();
$dataSource = $db->getDataSource('default');
$sql = '*blahblah*';
$resultSrc = $dataSource->_execute($sql);
$results=array();
while($data=$dataSource->fetchResult())
{
$results[]=$data;
}

The $results will be an array. The only problem is the $results only has the
column name.

For example: I have 2 tables. table 1 has 2 columns: id, value1; table 2 has
another 2 columns: id, value. Both have id column, if I join the two, and
select both, only ONE id shows in the result Maybe I will use alias to
solve this problem...

2009/10/14 Jorge Horacio Cué Cantú 

> Other difference,
>
> I am using the $dataSource->_execute() inside a Controller, I untherstand
> You want to use it inside a Shell.
>
> Is this correct?, Is there a difference in environment?
>
> Regards.
>
>
> El 14 de octubre de 2009 09:27, Yuncong Zhang escribió:
>
> Thank you Jorge,
>>
>> The syntax is correct. Maybe there are no public properties in that class.
>>
>>
>> I worked it out, using cakephp fetchResult() function.
>>
>> Yuncong
>>
>> 2009/10/14 Jorge Horacio Cué Cantú 
>>
>> Hello $dataSource->_execute($sql) calls the untherlying database driver.
>>> for example for mysqli it calls mysqli_query().
>>>
>>> IMHO should check the mysqli documentation to check the return value.
>>>
>>> BTW, if there is any sintax error in the SQL statement, then the function
>>> normally returns false, are You shure the SQL statement is complete when
>>> sent to _execute method?.
>>>
>>> Regards.
>>>
>>> El 13 de octubre de 2009 14:02, blah  escribió:
>>>
 Hello Jorge,

 I meet similar problem. When I try your method, the console shows
 empty mysqli_result Object for any results no matter what SQL I put in
 $sql_statement. Do you know why?

 mysqli_result Object
 (
 )

 Thank you in advance.

 Yc Zhang

 On Sep 24, 5:43 pm, Jorge Horacio Cué Cantú 
 wrote:
 > Hello,
 >
 > I had a similar problem. I have an Install controller that executes a
 SQL
 > script in ordert to create the database.
 > What I have done is somethjing similar to:
 >
 > uses('model'.DS.'connection_manager');
 > $db = ConnectionManager::getInstance();
 > $dataSource = $db->getDataSource('default');
 >
 > // The to execute each SQL statement do:
 >
 > $result = $dataSource->_execute($sql_statement');
 > if ($result) {
 > // success
 >
 > } else {
 > // failure
 > }
 >
 > I hope this helps you. Regards
 >
 > 2009/9/24 Stinkbug 
 >
 >
 >
 > > I'm somewhat familiar with the schema stuff.  However, the .sql file
 > > is a file that's going to be provided to us and not a file that will
 > > be generated by cake.  Our .sql file isn't just about the schema, it
 > > could be large amounts of data manipulation using sql.  So unless
 the
 > > schema stuff will execute a .sql file (rather than just generate
 it).
 > > I don't think it will work for us.  That's why I was trying to get
 the
 > > code above to work.
 >
 > > Any other thoughts?
 >
 > > On Sep 23, 4:39 pm, Sam Sherlock  wrote:
 > > > I think you want to create a schemahttp://
 > > book.cakephp.org/view/735/Generating-and-using-Schema-files
 > > > - S
 >
 > > > 2009/9/23 Stinkbug 
 >
 > > > > I'm trying to execute a bunch of sql from a .sql file from the
 > > > > console.  I was trying to use the query method inside the Model
 class,
 > > > > but I keep getting the following error.
 >
 > > > > Error: Missing database table 'models' for model 'Model'
 >
 > > > > Below is my code:
 >
 > > > > >>> > > > > App::import('Core', array('Model'));
 > > > > class UpgradeShell extends Shell {
 > > > >var $uses = array();
 >
 > > > >function main() {
 > > > >$filename = APP . 'config/sql/upgrade.sql';
 > > > >if (file_exists($filename)) {
 > > > >$handle = fopen($filename, "r");
 > > > >$sql = fread($handle,
 filesize($filename));
 > > > >fclose($handle);
 > > > >echo $sql;
 > > > >if ($sql) {
 > > > >//Model::query($sql);
 > > > >$model = new Model();
 > > > >//$model->query($sql);
 > > > >}
 > > > >}
 > > > >}
 >
 > > > > }
 > > > > ?>
 >
 > > > > When I try Model::query($sql);
 >
 > > > > I get the following error:
 > > > > Notice: Undefined property: UpgradeShell::$Model in C:\wamp\www\
 rx.com
 > > > > \app\vendors\s

HABTM relation

2009-10-14 Thread Benedikt R.

Hi!

If i want to add a record to TABLE A, is there an efficient way to add
a record in the JOIN TABLE for many (or all) records in TABLE B?

I try to build a simple task management. An user adds a task and there
will be added a connection to each other user in the same group as the
current user.

At the moment, I use the find('list')-method to retrieve the IDs and
store them in a variable. But I think if the groups grow, the PHP
cache won't handle this amount of data in a single variable.

Any suggestions?


Thank you!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: executing queries from a .sql file in the console

2009-10-14 Thread Jorge Horacio Cué Cantú
Other difference,

I am using the $dataSource->_execute() inside a Controller, I untherstand
You want to use it inside a Shell.

Is this correct?, Is there a difference in environment?

Regards.


El 14 de octubre de 2009 09:27, Yuncong Zhang  escribió:

> Thank you Jorge,
>
> The syntax is correct. Maybe there are no public properties in that class.
>
> I worked it out, using cakephp fetchResult() function.
>
> Yuncong
>
> 2009/10/14 Jorge Horacio Cué Cantú 
>
> Hello $dataSource->_execute($sql) calls the untherlying database driver.
>> for example for mysqli it calls mysqli_query().
>>
>> IMHO should check the mysqli documentation to check the return value.
>>
>> BTW, if there is any sintax error in the SQL statement, then the function
>> normally returns false, are You shure the SQL statement is complete when
>> sent to _execute method?.
>>
>> Regards.
>>
>> El 13 de octubre de 2009 14:02, blah  escribió:
>>
>>> Hello Jorge,
>>>
>>> I meet similar problem. When I try your method, the console shows
>>> empty mysqli_result Object for any results no matter what SQL I put in
>>> $sql_statement. Do you know why?
>>>
>>> mysqli_result Object
>>> (
>>> )
>>>
>>> Thank you in advance.
>>>
>>> Yc Zhang
>>>
>>> On Sep 24, 5:43 pm, Jorge Horacio Cué Cantú 
>>> wrote:
>>> > Hello,
>>> >
>>> > I had a similar problem. I have an Install controller that executes a
>>> SQL
>>> > script in ordert to create the database.
>>> > What I have done is somethjing similar to:
>>> >
>>> > uses('model'.DS.'connection_manager');
>>> > $db = ConnectionManager::getInstance();
>>> > $dataSource = $db->getDataSource('default');
>>> >
>>> > // The to execute each SQL statement do:
>>> >
>>> > $result = $dataSource->_execute($sql_statement');
>>> > if ($result) {
>>> > // success
>>> >
>>> > } else {
>>> > // failure
>>> > }
>>> >
>>> > I hope this helps you. Regards
>>> >
>>> > 2009/9/24 Stinkbug 
>>> >
>>> >
>>> >
>>> > > I'm somewhat familiar with the schema stuff.  However, the .sql file
>>> > > is a file that's going to be provided to us and not a file that will
>>> > > be generated by cake.  Our .sql file isn't just about the schema, it
>>> > > could be large amounts of data manipulation using sql.  So unless the
>>> > > schema stuff will execute a .sql file (rather than just generate it).
>>> > > I don't think it will work for us.  That's why I was trying to get
>>> the
>>> > > code above to work.
>>> >
>>> > > Any other thoughts?
>>> >
>>> > > On Sep 23, 4:39 pm, Sam Sherlock  wrote:
>>> > > > I think you want to create a schemahttp://
>>> > > book.cakephp.org/view/735/Generating-and-using-Schema-files
>>> > > > - S
>>> >
>>> > > > 2009/9/23 Stinkbug 
>>> >
>>> > > > > I'm trying to execute a bunch of sql from a .sql file from the
>>> > > > > console.  I was trying to use the query method inside the Model
>>> class,
>>> > > > > but I keep getting the following error.
>>> >
>>> > > > > Error: Missing database table 'models' for model 'Model'
>>> >
>>> > > > > Below is my code:
>>> >
>>> > > > > >> > > > > App::import('Core', array('Model'));
>>> > > > > class UpgradeShell extends Shell {
>>> > > > >var $uses = array();
>>> >
>>> > > > >function main() {
>>> > > > >$filename = APP . 'config/sql/upgrade.sql';
>>> > > > >if (file_exists($filename)) {
>>> > > > >$handle = fopen($filename, "r");
>>> > > > >$sql = fread($handle,
>>> filesize($filename));
>>> > > > >fclose($handle);
>>> > > > >echo $sql;
>>> > > > >if ($sql) {
>>> > > > >//Model::query($sql);
>>> > > > >$model = new Model();
>>> > > > >//$model->query($sql);
>>> > > > >}
>>> > > > >}
>>> > > > >}
>>> >
>>> > > > > }
>>> > > > > ?>
>>> >
>>> > > > > When I try Model::query($sql);
>>> >
>>> > > > > I get the following error:
>>> > > > > Notice: Undefined property: UpgradeShell::$Model in C:\wamp\www\
>>> rx.com
>>> > > > > \app\vendors\shells\upgrade.php on line 13
>>> >
>>> > > > > Fatal error: Call to a member function query() on a non-object in
>>> C:
>>> > > > > \wamp\www\rx.com\app\vendors\shells\upgrade.php on line 13
>>> >
>>> > > > > I don't really need to specify models, I just want to execute the
>>> > > > > queries inside the .sql file.
>>>
>>
>>
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread gimperdan...@gmail.com

Thanks. That helps a little. From what I've been reading it's better
to use Elements for HTML chunks and Helpers for logic. But
requestAction seems like a good option too.

On Oct 14, 10:54 am, Céryl  wrote:
> I don't really know the answer, but just to add to that, the home.ctp
> has a controller, it's the pages_controller.
> And also, you can of course use actions from other controllers and
> models in the pages-views by using Cake's requestAction. I use it
> sometimes to get for instance  number of posts, users, pictures or
> whatever on the sites main index page.
>
> On 14 okt, 16:38, "gimperdan...@gmail.com" 
> wrote:
>
> > On the index of my website I get content from several different tables
> > in the database. Which is best to use? Elements? Behaviors? or
> > Helpers? As far as I understand the index(home.ctp) page doesn't have
> > a  model or controller.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread Céryl

I don't really know the answer, but just to add to that, the home.ctp
has a controller, it's the pages_controller.
And also, you can of course use actions from other controllers and
models in the pages-views by using Cake's requestAction. I use it
sometimes to get for instance  number of posts, users, pictures or
whatever on the sites main index page.

On 14 okt, 16:38, "gimperdan...@gmail.com" 
wrote:
> On the index of my website I get content from several different tables
> in the database. Which is best to use? Elements? Behaviors? or
> Helpers? As far as I understand the index(home.ctp) page doesn't have
> a  model or controller.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread gimperdan...@gmail.com

On the index of my website I get content from several different tables
in the database. Which is best to use? Elements? Behaviors? or
Helpers? As far as I understand the index(home.ctp) page doesn't have
a  model or controller.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How i change default "_" in controllers default name?

2009-10-14 Thread thodoris

AMF. Actually FB4beta2 installs default the ZEND amf in the webroot.

I am trying to make a new data service but when i locate the
rooms_controler.php of cakephp
it give me an error that don't support filename with "_".

It's my second day in cakephp world and will be very glad if someone
can give me directions the way i use the cakephp power but with FLASH
view. NOT html-javascript.

thanks again.


On Oct 14, 12:09 pm, Mateusz Kaczanowski  wrote:
> If you want to connect you are using url request or AMF protocol?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: find __() function parameters in /app and update *.po - automated

2009-10-14 Thread Toby Ashley
While this discussion is going on, I thought I'd raise / ask something...

In a recent project, I needed to make it easy for administrators to be able
to edit the text used throughout the site. The site itself runs in 12
languages, and as a result I have 12 *.po files, one per territory. The
administrators for each language are fairly non-technical, and so the system
needed to be easy.

I built a simple system which would do the following:

-- Provide a 'download existing website text' button to the administrator -
the controller action would then read through the appropriate *.po file and
generate a CSV with two columns, the identifier (i'm also using descriptive
slugs, as mentioned by Miles) and the current string for that identifier

-- The administrator can then make the necessary amendments before
re-importing the CSV. When re-importing, the system backs up the existing
*.po file and creates a new one, manually writing the msgid and msgstr
values from the data in the CSV. Finally, when this is done, the system
removes any relevant cache files and  hey presto - the website text is
updated.

-- There's also tools to revert to previous backup, in case they make an
almighty mess of everything.

This system worked fine for the project, and the administrators of the site
are maintaining the different languages with success, but I'm wondering if
there's a better / simpler / more recommend way of achieving the same
functionality. I guess it's kind of like a friendly, web-based interface for
editing these *.po files

Any suggestions?

Cheers,
toby



On Wed, Oct 14, 2009 at 2:05 AM, Larry E. Masters aka PhpNut <
php...@gmail.com> wrote:

> Cool, let me know if you have any questions.
> --
> /**
> * @author Larry E. Masters
> * @var string $userName
> * @param string $realName
> * @returns string aka PhpNut
> * @access  public
> */
>
> On Tue, Oct 13, 2009 at 7:46 PM, Miles J  wrote:
>
>>
>> Well see now a lot of it makes sense. The guide is pretty vague on
>> i18n/l10n and how it works / is used.
>>
>> Will give this a try.
>>
>> On Oct 13, 5:39 pm, "Larry E. Masters aka PhpNut" 
>> wrote:
>> > Incorrect, the file that is created using the i18n extract creates a
>> .pot
>> > file which is a template file and can be opened in any po editor or text
>> > editor. The template is not language specific. There is no reason to
>> create
>> > these files by hand. Write your code and output using the sentences you
>> > would normally use just wrap the string in __() function. Run the
>> extractor
>> > and you are done.
>> > Easiest tool to edit translations I have recently found is
>> poedit.www.poedit.net
>> >
>> > I uploaded current core extracted pot file.
>> >
>> > http://cake-php.googlegroups.com/web/default.pot
>> >
>> > Download it and open in poedit.
>> >
>> > The nice thing about these pot file is you can create a new version with
>> > changes in your application, reopen the template in poedit, and it will
>> > merge changes highlighting the strings that have changed.
>> >
>> > Not sure if you are aware how the other translation functions work in
>> the
>> > core, but when it comes to handling plurals in a sentence, your slugs
>> will
>> > become more confusing.
>> >
>> > for($number = 0; $i < 100; $number++) {
>> > sprintf(__n('There is %d apple in the fruit bowl', 'There are %d apples
>> in
>> > the fruit bowl', $number), $number);
>> >
>> > }
>> >
>> > msgid "There is %d apple in the fruit bowl"
>> > msgid_plural "There are %d apples in the fruit bowl"
>> > msgstr[0] ""
>> > msgstr[1] ""
>> > msgstr[2] ""
>> > msgstr[3] ""
>> > msgstr[4] ""
>> > msgstr[5] ""
>> > msgstr[6] ""
>> >
>> > There are 16 plural rules that range from 1 form of plural to 6 forms of
>> > plural depending on the value of $number. It all depends and the
>> language
>> > the content is being translated to. The above example be based on the
>> header
>> > in the po file, which poedit allows you to set based on the language you
>> are
>> > using.
>> >
>> > Only 1 form of plural.
>> > "Plural-Forms: nplurals=1; plural=0;\n"
>> >
>> > 6 forms of plural.
>> > "Plural-Forms: nplurals=4; plural=n==1 ? 0 : n==2 ? 1 : n==0 || (n>=3 &&
>> > n<=10) ? 2 : 3;\n"
>> >
>> > 14 other forms or plural are available. These will be added to the
>> > translation site I had online for the project before. This will be
>> coming
>> > back online in the next few weeks. They will also be added to the book,
>> with
>> > corrections on the proper use of these functions soon. If you need the
>> > correct plural form before then, let me know and I can reply with it.
>> >
>> > --
>> > /**
>> > * @author Larry E. Masters
>> > * @var string $userName
>> > * @param string $realName
>> > * @returns string aka PhpNut
>> > * @access  public
>> > */
>> >
>> > On Tue, Oct 13, 2009 at 6:50 PM, Miles J 
>> wrote:
>> >
>> > > But you would need to make the english po file anyways if you are
>> > > going to distribute it and have it translated.
>> >
>> > > On Oct 13, 12:58 pm, "

Re: Submitting form data to a preview page before adding to database

2009-10-14 Thread Marcelo Andrade

On Wed, Oct 14, 2009 at 4:36 AM, aylaujp  wrote:
>
> I have this registration form (user/add/) that allow users to add
> username, contact info and info about themselves. It works well and
> all when I want to submit it directly to the database, but now I want
> to add another step in there, a Preview.  So it would be Form >
> Preview/Edit > Publish.
>
> Here's the flow:
> 1. User is presented with a form (say user/add/) to add name, contact
> info, description about themselves, etc.
> 2. When they are done filling in the info, they click a Preview
> button
> 3. It bring them to a Preview page where they can see what they added
> and then they can choose to click the Edit or Publish button
> 4. Pressing Edit would return to the form for changes and pressing
> Publish will then submit to the database
>
> What's an approach for this? (..)

Another way to do this could be, in your action, just save the
form values (in a session), redirect to the view page that have
the same fields as hidden values.  So the submit/confirm
action saves the data and a cancel/edit get back to the first
action.

Best regards.

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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Server has broken links

2009-10-14 Thread Michael Gaiser
Nope. Already went though that page and everything was set right.

On Tue, Oct 13, 2009 at 11:30 PM, AD7six  wrote:

>
>
>
> On 14 oct, 08:09, Michael Gaiser  wrote:
> > When I uncomment "Configure::write('App.baseUrl', env('SCRIPT_NAME'));"
> in
> > my core.php it seems to work but feels like a cheat. Any reason
> mod_rewrite
> > isnt working with the default setup? when I did a php info, it shows
> > rewrite_mod loaded.
>
> Probably reason 1
> http://book.cakephp.org/view/37/Apache-and-mod_rewrite-and-htaccess
>
> hth,
>
> AD
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: jquery substitute for ajax->observeField

2009-10-14 Thread Marcelo Andrade

On Tue, Oct 13, 2009 at 4:28 PM, hahmadi82  wrote:
>
> If anyone could help with this it would be much appreciated.

I'm not a jQuery expert, but it's not so hard do accompplish that.
I guess making the appropriate ajax call from a .onchange() event
should do the trick.

If I'm not wrong, there's some user-made versions of ajax-helper
to Cake1.2 that resembles the prototype to jquery.

Best regards.

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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to implement multiple pagination with SAME model on a single view?

2009-10-14 Thread Martin Westin

The support for multiple pagination on the same page is not complete.
The source and API reveals that work did start on this feature but it
was not finished for 1.2. I am not sure if it is suppsed to be in 1.3
or if you have to wait for 2.0.






On Oct 14, 1:30 pm, doze  wrote:
> Hello,
>
> Is there a way to do multiple pagination with same model on a single
> view?
>
> I know about the $options['model'] in pagination to do multiple
> paginations in single view with different models, but what about
> multiple paginations with same model.
>
> The model contains a datetime column and I'm trying to do two
> different paginated lists in the view, past events and future events.
> I cannot find a way to tell the paginator how to separate the two
> different lists.
>
> Please help!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to search from table

2009-10-14 Thread Céryl

This just sound like the regular Cake find-action

In the action for your view, just use

$this->set($data, $this->yourModel->find('all', array('conditions' =>
array('yourModel.city' => $varCity, 'YourModel.name' = > $varName)));

And the you can acces the data from your table in the view you want by
accessing the $data variable.



On 14 okt, 13:37, lokesh sharma  wrote:
> Hi, In my cakephp web application I have to search data from single
> table on the basis of city and name and display result in another
> page.ctp. Please tell me about any search plugin or find condition or
> the way to pass query to search data from my table.
> I've already tried some tutorial but there is no result.Please help me
> out.
>
> Thanks in advance.
> Regards,
> Lokesh
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form helper and error messages

2009-10-14 Thread Rick

Here is a little help:

http://book.cakephp.org/view/198/options-error

Also there are 'isFieldError' and 'error' methods available also.

Rick



On Oct 14, 8:28 am, jburns  wrote:
> I have created a number of add/edit view using the form helper. Here
> is a really simplified example:
>
>          echo $form->create('User');
>                 echo $form->input('first_name');
>                 echo $form->input('last_name');
>         echo $form->end('Save');
> ?>
>
> I am not calling $form->error in the views at all, yet the error
> messages still appear if validation fails on save. How can I control
> the placement of the error messages? If the automatic display of an
> error part and parcel of form->input?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Form helper and error messages

2009-10-14 Thread jburns

I have created a number of add/edit view using the form helper. Here
is a really simplified example:

create('User');
echo $form->input('first_name');
echo $form->input('last_name');
echo $form->end('Save');
?>

I am not calling $form->error in the views at all, yet the error
messages still appear if validation fails on save. How can I control
the placement of the error messages? If the automatic display of an
error part and parcel of form->input?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help with advanced setup

2009-10-14 Thread Alexandru Ciobanu

On 10/14/2009 8:37 AM, Dave Maharaj :: WidePixels.com wrote:
> I am trying to re-arrange the folders on the server
>
> I would like to place cake folder outside www directory
>
Here's my setup:

I've placed the 'cake' folder in /usr/share/cakephp-1.2.5/

And edited app/webroot/index.php:

if (!defined('CAKE_CORE_INCLUDE_PATH')) {
 define ('CAKE_CORE_INCLUDE_PATH', 
DS.'usr'.DS.'share'.DS.'cakephp-1.2.5');
}

This way I can use same CakePHP for multiple application, over multiple 
accounts;

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: I have problem in search.

2009-10-14 Thread Alexandru Ciobanu


> Hi,I have problem in search.
> // in the model
> function doSomething() {
> $this->query('select * from basicdetail');
> }
>
> // in the controller
> function searchtry(){
> return $this->MyModel->doSomething();
> }
> but in searchtry.ctp I can't get my data, I've checked through
> logerror and I got that my for loop is running under .ctp but I'm not
> getting data
>
>

You have to set your data for your view.

This would make more sense in CakePHP:

Model:

function search(){
 $results = $this->find('all', array(...));
 return $results;
}

Controller:

function searchtry(){
 $this->set('results', $this->Model->search());
}

View:

foreach($results as $result){
 echo $result['Model']['field0'];
 ...
}

See:
http://book.cakephp.org/view/10/Understanding-Model-View-Controller
http://book.cakephp.org/view/73/Retrieving-Your-Data
http://c7y.phparch.com/c/entry/1/art,mvc_and_cake


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



I have problem in search.

2009-10-14 Thread lokesh sharma

Hi,I have problem in search.
// in the model
function doSomething() {
$this->query('select * from basicdetail');
}

// in the controller
function searchtry(){
return $this->MyModel->doSomething();
}
but in searchtry.ctp I can't get my data, I've checked through
logerror and I got that my for loop is running under .ctp but I'm not
getting data
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to search from table

2009-10-14 Thread lokesh sharma

Hi, In my cakephp web application I have to search data from single
table on the basis of city and name and display result in another
page.ctp. Please tell me about any search plugin or find condition or
the way to pass query to search data from my table.
I've already tried some tutorial but there is no result.Please help me
out.

Thanks in advance.
Regards,
Lokesh
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to implement multiple pagination with SAME model on a single view?

2009-10-14 Thread doze

Hello,

Is there a way to do multiple pagination with same model on a single
view?

I know about the $options['model'] in pagination to do multiple
paginations in single view with different models, but what about
multiple paginations with same model.

The model contains a datetime column and I'm trying to do two
different paginated lists in the view, past events and future events.
I cannot find a way to tell the paginator how to separate the two
different lists.

Please help!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Debug Error! Makes no sense!

2009-10-14 Thread majna

By posting error messages in debug mode?
[Configure::write('debug', 1);]

On Oct 13, 8:46 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> I stripped out the controller function leaving it like this
>
> function view($id) {
>    $this->layout = 'default_right';
>    $this->set('reports', $this->Report->read(null, $id));
>  }
>
> And it still will not work. So comment out //$this->layout =
> 'default_right';
> and it works.
> Makes no sense , the $this->layout = 'default_right'; is simple HTML and
> works on every other page on the site
>
> If i completely remove $this->layout the page loads using the default
> layout. Which is no good to me in this case. Even if I enter $this->layout =
> 'default'; it breaks once again
>
> default_right.ctp (just  to ..rest is regular baked template)
>
> 
> 
>    element('top_nav'); ?> 
>   
>      getSidebar(); ?>
>     
>     
>   
> 
> 
> 
> 
> 
>
> Anyone have any idea where to start on this one?
>
> Thanks
>
> Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help with advanced setup

2009-10-14 Thread Sam Sherlock
I often have something like (see edit of you previous message): (but I have
bake set up and that is worth doing IMHO quite pain free too)  -- cake is on
the path

so
cd ~/www
cake bake mysite
...

bake one


> /cake
> /public_html
> /www
>/mysite
>
  /models

  

   /views
>/controllers
>/webroot (all public viewable files)

 index.php:

>
> Can someone point out what the corect structure would be?
>
>
> if (!defined('ROOT')) {
>define('ROOT', DS.'www');
>}
> /**
>  * The actual directory name for the "app".
>  *
>  */
>if (!defined('APP_DIR')) {
>define('APP_DIR', 'mysite');
>}
> /**
>  * The absolute path to the "cake" directory, WITHOUT a trailing DS.
>  *
>  */
>if (!defined('CAKE_CORE_INCLUDE_PATH')) {
>define('CAKE_CORE_INCLUDE_PATH', ROOT);
>}
> Thanks
>
> Dave
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to switch between databases dynamically by session value

2009-10-14 Thread Christian

Hello,

I read several threads about this but not found a final "cake-like"
solution. A lot of posts are about switching based on URLs, but I need
to switch to another "testcases" database connection based on a
session value I set in an action. This "testcases" connection should
be used until end of the session/logout.

I read about modifying database.php adding function __construct() and
switching the default connection there, but how can I access the cake
session there - I assume the cake core isn't fully initialized at that
construct point and I cannot use the session component there.


My setup:
- In database.php I created two items: $default and $testcases (only
difference: database name and content of course)
- In a controller action I am saving a session value which database
connection to use


Try 1) I tried to set in app_controller.php/beforeFilter() the model
var useDbConfig to switch the database. But after the normal action
and find('all) I get a SQL error (no database selected) whereas my
debug calls tell me that the model has switched to the "testcases"
database config correctly (or not?).

   function beforeFilter() {
  if ($this->Session->read('tmp.dbconfig') && is_object($this->
{$this->modelClass})) {
 /* debugging */ $db = $this->{$this->modelClass}-
>getDataSource(); debug($db->config);
 $this->{$this->modelClass}->useDbConfig = 'testcases';
 /* debugging */ $db = $this->{$this->modelClass}-
>getDataSource(); debug($db->config);
  }
   ...
   }
Warning (512): SQL Error: 1046: No database selected [CORE\cake\libs
\model\datasources\dbo_source.php, line 525]


Try 2) I tried to use the ConnectionManager method in the
app_controller.php/beforeFilter(), but had no real success ... I do
not really know what to do! From another thread I tried the following
but same error

   function beforeFilter() {
  if ($this->Session->read('tmp.dbconfig') && is_object($this->
{$this->modelClass})) {
 /* debugging */ $_db = $this->{$this->modelClass}-
>getDataSource(); debug($_db->config);
 $db =& ConnectionManager::getDataSource('default');
 $db->disconnect();
 $db->config['database'] = 'db_testcases';
 $db->connect();
 /* debugging */ $_db = $this->{$this->modelClass}-
>getDataSource(); debug($_db->config);
  }
   ...
   }
Warning (512): SQL Error: 1046: No database selected [CORE\cake\libs
\model\datasources\dbo_source.php, line 525]



So, what is the best practice to switch database connections
dynamically by session content?
In controller, model, or???


I am very thankful for any positive answer!

Christian

ps. talking about cake 1.2.5
my references: searched for "usedbconfig session"
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Submitting form data to a preview page before adding to database

2009-10-14 Thread Mateusz Kaczanowski
Hey. you can do this by adding ajax script. For example if someone will
press preview button ajax script will send a form to view and return with
html.

2009/10/14 aylaujp 

>
> I have this registration form (user/add/) that allow users to add
> username, contact info and info about themselves. It works well and
> all when I want to submit it directly to the database, but now I want
> to add another step in there, a Preview.  So it would be Form >
> Preview/Edit > Publish.
>
> Here's the flow:
> 1. User is presented with a form (say user/add/) to add name, contact
> info, description about themselves, etc.
> 2. When they are done filling in the info, they click a Preview
> button
> 3. It bring them to a Preview page where they can see what they added
> and then they can choose to click the Edit or Publish button
> 4. Pressing Edit would return to the form for changes and pressing
> Publish will then submit to the database
>
> What's an approach for this? I am thinking of creating a Preview
> function in the controller which the form action points to but now am
> stuck as to how to grab the form data and display them.
>
> Any help will be helpful. Thanks!
>
> >
>


-- 
Pozdrawiam, Mateusz Kaczanowski

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: new to cake-php

2009-10-14 Thread Mateusz Kaczanowski
all you need is on book.cakephp.org //Manual. Some very simple apllications.


2009/10/14 aravind raj 

> i am new to cake-php
> ..
> can get some free simple cakephp applications ...
>
>
> --
> Aravind "Think Global Act Local"
>
> >
>


-- 
Pozdrawiam, Mateusz Kaczanowski

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: need text box for ajax input and output.

2009-10-14 Thread Mateusz Kaczanowski
In ajax script you can deine "field" and "value". For example "field" will
be id of textarea and "value" will be a value. Then you can post this data
to your controller. $this->params this function you can recive data.

2009/10/14 Jiru 

>
> //select.ctp
>
>  if (!empty($options)) {
>  foreach ($options as $k => $v) {
>echo "$v";
>  }
> }
> ?>
>
> here it shows the values in dropdown list when i used to select it
> using Ajax. But for the same process i need it in text boxes, both the
> input and output.  How i can do it ?
>
> regards, jiru
> >
>


-- 
Pozdrawiam, Mateusz Kaczanowski

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How i change default "_" in controllers default name?

2009-10-14 Thread Mateusz Kaczanowski
If you want to connect you are using url request or AMF protocol?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: pageTitle and title_for_layout in CakePHP 1.3 views

2009-10-14 Thread malamalca

Ceryl, your're absolutely right. Didn't occur to me that i can use
$this->set('title_for_layout',...); in view.

Tnx.

On 11 okt., 21:09, Céryl  wrote:
> The "echo Title_for_layout" can be in the  section of your
> layout.
>
> You can then place:
> set('title', 'YourTitle'); ?>
> anywhere in the view to have the title changed per view. Personally, I
> always add an "echo 'MySite | '" just before the title_for_layout so
> that each view will have a title resembling "MySite | Products" or
> something...
>
> On 11 okt, 19:30,mmalca wrote:
>
> > There was an elegant way to set page title anywhere in view using
> > CakePHP 1.2 - with $this->pageTitle = 'new title';  This has been
> > removed in cakephp 1.3 in favor of $this->set('title_for_layout',
> > 'page title');
>
> > Is there no simple way left to set page title elsewhere in view? Can
> > it be changed/set only in controller?
>
> > Here's an example. I want to change page title in my theme (in a view
> > without overriding default layout). This was possible by setting $this-
>
> > >pageTitle. So: how can a custom view theme change page title?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



autosuggest and auto-completion in text boxes

2009-10-14 Thread luke

Hii, developers, in my ajax auto complete program ,

// add.ctp



create('User');?>


select('country_id',array($countries),null,array
('id'=>'countries'),false);
?>select('region_id',array(),null,array
('id'=>'regions'),false);

?>

observeField('countries',array
('url'=>'update_region_select','update'=>'regions'));?>

end('Submit');?>





and
//select.ctp

 $v) {
   // echo "$v";
  }
}
?>

I want both values in text boxes. The input box should need textbox
with autosuggest from databsse and output should autocomplete
textbox . Please help me.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: model relations: Problems to run local functions over Model relations

2009-10-14 Thread Obelix

Yes i have seen it. But i dont't know what is the Problem with the
name Standard.

I have generate the model and the Controller with 'Cake builder'. Cake
has recognized the table and also the models and controllers. At the
next Step i have test the naming Standard with

- debug(Inflector::classify('cms_folders'));

Cake tell me it's all correct (CmsFolder). How can i test the name
definition before i create model and controller.


On 14 Okt., 10:15, "Dr. Loboto"  wrote:
> "AppModel Object" - cake did not find your model file and created
> AppModel as Miles and Brian both already said.
>
> On Oct 14, 2:57 am, Obelix  wrote:
>
> > Hello,
> > i have test if Model available and it's look like good. The
> > Programcode
>
> > - debug($this->CmsFile->CmsFolder);
>
> > gives me Information about the Model 'CmsFolder'.
>
> > AppModel Object
> > (
> >     [useDbConfig] => default
> >     [useTable] => cms_folders
> >     [displayField] => id
> >     [id] =>
> >     [data] => Array
> >         (
> >         )
>
> >     [table] => cms_folders
> >     [primaryKey] => id
> >     [_schema] => Array
> >         (
> >       ..
>
> > What it could be even more ?
>
> > Regards Uwe
>
> > On 13 Okt., 18:56, brian  wrote:
>
> > > If Cake doesn't find the model, it uses AppModel. The latter does not
> > > have a method getLocalTest().
>
> > > On Tue, Oct 13, 2009 at 5:34 AM, Obelix  wrote:
>
> > > > Thanks for your Answer.
>
> > > > I will test it in the evening.
>
> > > > So that does not happen i generate the plugin(cms), model and
> > > > controller with 'Cake Code Generation'.
>
> > > > I am also surprised that the following code works
>
> > > >  - $cmsFolders = $this->CmsFile->CmsFolder->find('list');
>
> > > > and the other code dont works.
>
> > > > - debug($this->CmsFile->CmsFolder->getLocalTest());
>
> > > > In both lines, we referenced the Model (CmsFolder)
>
> > > > Regards Uwe
>
> > > > On 13 Okt., 01:34, Miles J  wrote:
> > > >> That means that your model is not getting loaded, hence the custom
> > > >> method does not exist.
>
> > > >> Try printing out the parent object to see if the association is
> > > >> loaded, if it is not your naming conventions are wrong.
>
> > > >> On Oct 12, 3:47 pm, Obelix  wrote:
>
> > > >> > Hi,
> > > >> > if i run a local function in a other model, cake display a Error
> > > >> > Message:
>
> > > >> > Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
> > > >> > check the manual that corresponds to your MySQL server version for 
> > > >> > the
> > > >> > right syntax to use near 'getLocalTest' at line 1 [CORE/cake/libs/
> > > >> > model/datasources/dbo_source.php, line 525]
>
> > > >> > The environment looks like this:
>
> > > >> > Definition Table:
> > > >> >   - cms_folders
> > > >> >   - cms_files
>
> > > >> > Definition Model:
> > > >> >  - CmsFolder      -> hasMany   (CmsFile)        the Filename is
> > > >> > 'cms_folder.php'
> > > >> >  - CmsFile           -> belongsTo (CmsFolder)   the Filename is
> > > >> > 'cms_file.php'
>
> > > >> > Definition Controller:
> > > >> >  - CmsFolders                                                 the
> > > >> > Filename is 'cms_folders_controller.php'
> > > >> >  - CmsFiles                                                      the
> > > >> > Filename is 'cms_files_controller.php'
>
> > > >> > In the Model 'CmsFolder' i define a dummy function:
>
> > > >> >   function getLocalTest() {
> > > >> >     return 'www';
> > > >> >   }
>
> > > >> > I want run the function 'getLocalTest()' in the action 'add' in the
> > > >> > controller 'CmsFilesController'. The Code looks like this.
>
> > > >> > - debug($this->CmsFile->CmsFolder->getLocalTest());
>
> > > >> > If this line is running, the error message is displayed. But when i
> > > >> > run the following function, its all ok.
>
> > > >> > - $cmsFolders = $this->CmsFile->CmsFolder->find('list');
>
> > > >> > I do not know what the problem is and hope for their help.
>
> > > >> > Regards Uwe
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: lost stylesheet depending on $html->link format ??

2009-10-14 Thread Jas

Yes! Thank you Dr. Loboto, you fixed it.

Cant believe I missed that.

On Oct 14, 7:16 pm, "Dr. Loboto"  wrote:
> Your error:
> 
> Must be:
> echo $html->css('simplecurve');
>
> On Oct 14, 2:42 pm, Jas  wrote:
>
> > my template is views/layouts/simplecurve.ctp
> > and this is the contents
>
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> > http://www.w3.org/1999/xhtml";>
> > 
> > charset(); ?>
> > 
> > 
> > 
> > 
> > 
> >  > echo $scripts_for_layout; ?>
> > 
> > 
> > 
> >         House Points
> >         http://freecsstemplates.org/";>Put your points in! > h2>
> > 
>
> > 
> >         
> >                  > title="">Home
> >                 About Us
> >                 Products
> >                 Services
> >                 Contact Us
> >         
> > 
> > 
>
> >         
> >         flash(); ?>
> >         
> >         
> > 
> > 
> > 
>
> > 
> > 
>
> > On Oct 14, 5:28 pm, AD7six  wrote:
>
> > > On 14 oct, 04:18, Jas  wrote:
>
> > > > Looking at the page source, everything looks as if it should be
> > > > working. The page is functional, just missing css.
> > > > Its only when I pass a parameter that this happens.
> > > > I've tried taking everything out of the view and the controller
> > > > action, expecting it to show at least an empty layout. still no css.
> > > > Of course without a parameter in the url it works!
>
> > > How about you show the code your using to generate the css link...
>
> > > AD
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



need text box for ajax input and output.

2009-10-14 Thread Jiru

//select.ctp

 $v) {
echo "$v";
  }
}
?>

here it shows the values in dropdown list when i used to select it
using Ajax. But for the same process i need it in text boxes, both the
input and output.  How i can do it ?

regards, jiru
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Submitting form data to a preview page before adding to database

2009-10-14 Thread aylaujp

I have this registration form (user/add/) that allow users to add
username, contact info and info about themselves. It works well and
all when I want to submit it directly to the database, but now I want
to add another step in there, a Preview.  So it would be Form >
Preview/Edit > Publish.

Here's the flow:
1. User is presented with a form (say user/add/) to add name, contact
info, description about themselves, etc.
2. When they are done filling in the info, they click a Preview
button
3. It bring them to a Preview page where they can see what they added
and then they can choose to click the Edit or Publish button
4. Pressing Edit would return to the form for changes and pressing
Publish will then submit to the database

What's an approach for this? I am thinking of creating a Preview
function in the controller which the form action points to but now am
stuck as to how to grab the form data and display them.

Any help will be helpful. Thanks!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: lost stylesheet depending on $html->link format ??

2009-10-14 Thread Dr. Loboto

Your error:

Must be:
echo $html->css('simplecurve');

On Oct 14, 2:42 pm, Jas  wrote:
> my template is views/layouts/simplecurve.ctp
> and this is the contents
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> charset(); ?>
> 
> 
> 
> 
> 
>  echo $scripts_for_layout; ?>
> 
> 
> 
>         House Points
>         http://freecsstemplates.org/";>Put your points in! h2>
> 
>
> 
>         
>                  title="">Home
>                 About Us
>                 Products
>                 Services
>                 Contact Us
>         
> 
> 
>
>         
>         flash(); ?>
>         
>         
> 
> 
> 
>
> 
> 
>
> On Oct 14, 5:28 pm, AD7six  wrote:
>
>
>
> > On 14 oct, 04:18, Jas  wrote:
>
> > > Looking at the page source, everything looks as if it should be
> > > working. The page is functional, just missing css.
> > > Its only when I pass a parameter that this happens.
> > > I've tried taking everything out of the view and the controller
> > > action, expecting it to show at least an empty layout. still no css.
> > > Of course without a parameter in the url it works!
>
> > How about you show the code your using to generate the css link...
>
> > AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: model relations: Problems to run local functions over Model relations

2009-10-14 Thread Dr. Loboto

"AppModel Object" - cake did not find your model file and created
AppModel as Miles and Brian both already said.

On Oct 14, 2:57 am, Obelix  wrote:
> Hello,
> i have test if Model available and it's look like good. The
> Programcode
>
> - debug($this->CmsFile->CmsFolder);
>
> gives me Information about the Model 'CmsFolder'.
>
> AppModel Object
> (
>     [useDbConfig] => default
>     [useTable] => cms_folders
>     [displayField] => id
>     [id] =>
>     [data] => Array
>         (
>         )
>
>     [table] => cms_folders
>     [primaryKey] => id
>     [_schema] => Array
>         (
>       ..
>
> What it could be even more ?
>
> Regards Uwe
>
> On 13 Okt., 18:56, brian  wrote:
>
>
>
> > If Cake doesn't find the model, it uses AppModel. The latter does not
> > have a method getLocalTest().
>
> > On Tue, Oct 13, 2009 at 5:34 AM, Obelix  wrote:
>
> > > Thanks for your Answer.
>
> > > I will test it in the evening.
>
> > > So that does not happen i generate the plugin(cms), model and
> > > controller with 'Cake Code Generation'.
>
> > > I am also surprised that the following code works
>
> > >  - $cmsFolders = $this->CmsFile->CmsFolder->find('list');
>
> > > and the other code dont works.
>
> > > - debug($this->CmsFile->CmsFolder->getLocalTest());
>
> > > In both lines, we referenced the Model (CmsFolder)
>
> > > Regards Uwe
>
> > > On 13 Okt., 01:34, Miles J  wrote:
> > >> That means that your model is not getting loaded, hence the custom
> > >> method does not exist.
>
> > >> Try printing out the parent object to see if the association is
> > >> loaded, if it is not your naming conventions are wrong.
>
> > >> On Oct 12, 3:47 pm, Obelix  wrote:
>
> > >> > Hi,
> > >> > if i run a local function in a other model, cake display a Error
> > >> > Message:
>
> > >> > Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
> > >> > check the manual that corresponds to your MySQL server version for the
> > >> > right syntax to use near 'getLocalTest' at line 1 [CORE/cake/libs/
> > >> > model/datasources/dbo_source.php, line 525]
>
> > >> > The environment looks like this:
>
> > >> > Definition Table:
> > >> >   - cms_folders
> > >> >   - cms_files
>
> > >> > Definition Model:
> > >> >  - CmsFolder      -> hasMany   (CmsFile)        the Filename is
> > >> > 'cms_folder.php'
> > >> >  - CmsFile           -> belongsTo (CmsFolder)   the Filename is
> > >> > 'cms_file.php'
>
> > >> > Definition Controller:
> > >> >  - CmsFolders                                                 the
> > >> > Filename is 'cms_folders_controller.php'
> > >> >  - CmsFiles                                                      the
> > >> > Filename is 'cms_files_controller.php'
>
> > >> > In the Model 'CmsFolder' i define a dummy function:
>
> > >> >   function getLocalTest() {
> > >> >     return 'www';
> > >> >   }
>
> > >> > I want run the function 'getLocalTest()' in the action 'add' in the
> > >> > controller 'CmsFilesController'. The Code looks like this.
>
> > >> > - debug($this->CmsFile->CmsFolder->getLocalTest());
>
> > >> > If this line is running, the error message is displayed. But when i
> > >> > run the following function, its all ok.
>
> > >> > - $cmsFolders = $this->CmsFile->CmsFolder->find('list');
>
> > >> > I do not know what the problem is and hope for their help.
>
> > >> > Regards Uwe
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Controller and Session in View

2009-10-14 Thread Prof. No Time

Thanks Brian,

I am using the AUTH component. I want to access Auth.user() in the
view and I think the only way I can do that is if I can get the
controller in the view so I can say this->controller->Auth->user(). I
guess this is the wrongest way to go right? But I am new and just
floating around trying to find my feet. Please don't be irritated with
my blunders, help me.

Also, when I use the auth component, I'd like to know the following:
1. How and When do I know that the Auth component has successfully (or
otherwise) authenticated the user? Is there something like if ($this-
>Auth->authSuccess){}?
2. How can I perform further actions after a successful auth like,
save the login time, check for file permissions and load them, notify
other people that someone just logged in?

I'm grateful for your help. God bless you!

On Oct 13, 6:11 pm, brian  wrote:
> On Tue, Oct 13, 2009 at 12:37 PM, Prof. No Time
>
>  wrote:
>
> > Hello People, thanks so much for your attempts at my bake problem.
> > Obviously no one was close at all to the answer but I figured out
> > myself how to bake and I have baked successfully quite a number of
> > times now. I am new to this cake thing and I hope you guys can help me
> > sail through. I love Qcubed because they always answer when I cry, I
> > hope cake won't be any different.
>
> > Now to my Question, please, how do I access the CONTROLLER and SESSION
> > in a VIEW? Is it possible? If yes HOW, if no ALTERNATIVE.
>
> In the view, use $session['whatever']. Add debug($session) to see what
> it looks like.
>
> As for accessing the controller, it's not really set up for that and
> you probably don't need to. What are you trying to do?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: lost stylesheet depending on $html->link format ??

2009-10-14 Thread Jas

my template is views/layouts/simplecurve.ctp
and this is the contents



http://www.w3.org/1999/xhtml";>

charset(); ?>









House Points
http://freecsstemplates.org/";>Put your points in!




Home
About Us
Products
Services
Contact Us





flash(); ?>











On Oct 14, 5:28 pm, AD7six  wrote:
> On 14 oct, 04:18, Jas  wrote:
>
> > Looking at the page source, everything looks as if it should be
> > working. The page is functional, just missing css.
> > Its only when I pass a parameter that this happens.
> > I've tried taking everything out of the view and the controller
> > action, expecting it to show at least an empty layout. still no css.
> > Of course without a parameter in the url it works!
>
> How about you show the code your using to generate the css link...
>
> AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



new to cake-php

2009-10-14 Thread aravind raj
i am new to cake-php
..
can get some free simple cakephp applications ...


-- 
Aravind "Think Global Act Local"

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---