Re: Select only one row

2009-09-11 Thread sindbad

Not working. It shows me only the last date of the last report.

On 12 sep., 00:38, Miles J  wrote:
> Well if its for multiple clients, just remove the conditions array.
>
> On Sep 11, 12:42 pm, sindbad  wrote:
>
> > Okay,
>
> > thanks for your reply but from where I get the $id. This should be
> > Client.id but... this query selects only one row but I need to select
> > only one row for each client. I have 1000 clients and 21290 reports.
> > For every client I need to select the date of last report.
>
> > On 11 sep., 21:52, Miles J  wrote:
>
> > > Well you would have to grab the last date. Heres a query, assuming you
> > > followed cake conventions.
>
> > > $result = $this->Report->find('first', array(
> > > 'fields' => 'Report.created',
> > > 'order' => 'Report.id DESC',
> > > 'conditions' => array('Report.client_id' => $id)
> > > ));
>
> > > Then echo it in the view: echo $result['Report']['created'];
>
> > > On Sep 11, 11:42 am, sindbad  wrote:
>
> > > > Hi,
>
> > > > first of all I want to say that I'm new to cake but with a little help
> > > > from book.cakephp.org and Google I've made a simple application for
> > > > managing clients and reports for the clients.
> > > > Each client has many raports. Now, in the index view of the clients I
> > > > need to show the date of last report. This is what I don't know how to
> > > > do it.
> > > > I'll be glad if you could tell me how to select only the date of the
> > > > last report for each of my clients.
> > > > 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: Multiple Cake installation via Apache Virtual Hosts?

2009-09-11 Thread Miles J

If htdocs is your root, then create a folder called app1 and app2
within htdocs. Then path each one to those folders.


ServerName localhost
DocumentRoot "D:/Apache/Apache/htdocs/app1"



ServerName lh2
DocumentRoot "D:/Apache/Apache/htdocs/app2"

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



Re: Multiple Cake installation via Apache Virtual Hosts?

2009-09-11 Thread bbf

In fact, if I set both VirtualHosts to point to:

DocumentRoot "D:/Apache/Apache/htdocs"


NameVirtualHost *


ServerName localhost
DocumentRoot "D:/Apache/Apache/htdocs"



ServerName lh2
DocumentRoot "D:/Apache/Apache/htdocs"




the Cake app works fine when called via "http://localhost";, but
returns the above error when called via "http://lh2";.

So the folder name has nothing to do with it because the files are in
the same folder for both hosts.  It seems like Cake is using the
hostname somewhere... seems like anything other than "localhost" won't
work.  But I've found lots of examples on the web where other
hostnames work fine, so I'm confused.


(BTW, I've added both hostnames to my HOSTS 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
-~--~~~~--~~--~--~---



Multiple Cake installation via Apache Virtual Hosts?

2009-09-11 Thread bbf

I'm trying to get two Cake installs working on my local machine.

I used Apache virtual hosts (1.2) to get the local domains working:
http://localhost   which goes to \htdocs.
http://lh2 which goes to \htdocs2.

localhost works no problem.
lh2  works for anything outside of Cake (e.g. PhpMyAdmin), but if I
try a cake page, I get:

-
Fatal error: Call to undefined method DboSource::connect() in d:\Apache
\Apache\htdocs2\cake\libs\model\datasources\dbo_source.php on line 96
-


Anyone have any idea what's going on?

-
My Apache httpd.conf:

NameVirtualHost *


ServerName localhost
DocumentRoot "D:/Apache/Apache/htdocs"



ServerName lh2
DocumentRoot "D:/Apache/Apache/htdocs2"



--~--~-~--~~~---~--~~
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: Doing a mysql left join

2009-09-11 Thread Whitty

OK,

Getting a little way closer, I've found this article here
http://jbenner.net/blog/understanding-cakephp-associations that
mirrors what it says on the php site under here :
http://book.cakephp.org/view/78/Associations-Linking-Models-Together

What I have at present is a model called personsaddress.php which
contains this code:


array(
 'className'  => 'address',
 'joinTable'  => 'persons_addresses',
 'foreignKey' => 'name_id',
'associationForeignKey'  => 'addr_id',
'unique' => true
)
);
}

?>

and on the fullnames_controller.php I have this function:

function view($id = null) {
$this->Fullname->id = $id;
$this->set('fullname', $this->Fullname->read());
$this->set('linkaddr',  $this->Addresses->read(null, $id));
}

I'm assuming that linkaddr should hold an array with the users
addressdetails, calling view.cpt but I'm getting the error:

Notice (8): Undefined property: FullnamesController::$Addresses [APP/
controllers/fullnames_controller.php, line 10]
Fatal error: Call to a member function read() on a non-object in
/controllers/fullnames_controller.php on line 10

Would be grateful for some pointers?

Thanks

Darren

On Sep 11, 3:43 pm, Whitty  wrote:
> Hi,
>
> I'm a bit new to this, I'm trying to do a left join.
>
> I have a db with People table (id:name_id) in it a linking table
> (linking name_id to addr_id) and an address table with the index
> (addr_id)
>
> the sql command I usually use is:
>
> SELECT persons_address.addr_id FROM addresses left JOIN
> persons_address ON persons_address.addr_id = addresses.addr_id WHERE
> persons_address.name_id ='.$name_id
>
> I'm assuming I need a model for the linking table.
>
> How would I go about creating a query to print out the users name with
> the linked address below? I've got as far as outputting the user name.
>
> Are their any examples?
>
> Darren
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Auth Question

2009-09-11 Thread cakephp_rocks

hello everybody  i have a quick Auth question

i have created a login form in a element in its in default layout
whenever i login it wont referer to the page i was
it redirects  back to ' / '
so i tried this dosent seem to work $this->Auth->loginRedirect =
$referer;

so if i use the users/login instead of  element form it referers me
back where i was any idea

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: Select only one row

2009-09-11 Thread Miles J

Well if its for multiple clients, just remove the conditions array.

On Sep 11, 12:42 pm, sindbad  wrote:
> Okay,
>
> thanks for your reply but from where I get the $id. This should be
> Client.id but... this query selects only one row but I need to select
> only one row for each client. I have 1000 clients and 21290 reports.
> For every client I need to select the date of last report.
>
> On 11 sep., 21:52, Miles J  wrote:
>
> > Well you would have to grab the last date. Heres a query, assuming you
> > followed cake conventions.
>
> > $result = $this->Report->find('first', array(
> > 'fields' => 'Report.created',
> > 'order' => 'Report.id DESC',
> > 'conditions' => array('Report.client_id' => $id)
> > ));
>
> > Then echo it in the view: echo $result['Report']['created'];
>
> > On Sep 11, 11:42 am, sindbad  wrote:
>
> > > Hi,
>
> > > first of all I want to say that I'm new to cake but with a little help
> > > from book.cakephp.org and Google I've made a simple application for
> > > managing clients and reports for the clients.
> > > Each client has many raports. Now, in the index view of the clients I
> > > need to show the date of last report. This is what I don't know how to
> > > do it.
> > > I'll be glad if you could tell me how to select only the date of the
> > > last report for each of my clients.
> > > 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
-~--~~~~--~~--~--~---



phpThumb

2009-09-11 Thread hahmadi82


I'm trying to use this helper with the phpThumb library:
http://code621.com/content/1/phpthumb-helper-for-cakephp

When I run the code to give me a thumbnail I get:

 Array ( [error] => 1 [error_detail] => phpThumb
v1.7.9200805132119thissourceFilename and thissrc are both empty [src] =>
user/blankuser.jpg [w] => 100 [h] => 100 )

Does anyone know what the error_detail means?

-- 
View this message in context: 
http://www.nabble.com/phpThumb-tp25408589p25408589.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
-~--~~~~--~~--~--~---



Re: Opinions please: HTML/css/js vs. AS3/Flex/Flex Builder?

2009-09-11 Thread James K

The only real use for Flex is building apps that use the AIR runtime.

There's a reason most developers will tell you they hate
Actionscript... it's terrible and the authoring tools are even worse
(and expensive). A lot today's web developers have taken the stance to
avoid Flash as much as possible and only use it where it's absolutely
necessary. The explosion of javascript frameworks like Mootools and
jQuery negate the need for Flash in most layouts.

IMO, Flash/Flex has no business on a web page unless it's there to
provide an open socket connection (chat client?), is being used to
fasciliate bulk file uploads or is delivering audio/video.

In the end, however, that's just one opinion. I'm sure you'll find
some Flex enthusiasts (who work for Adobe :P) would would disagree
with my assessment.

- James

On Sep 11, 11:16 am, keymaster  wrote:
> The more I read about flex, the more I feel compelled to question
> whether I should be staying with HTML/js/CSS etc. for the front ends
> of the apps I build, or switching to ActionSript 3.0/Flex/Flex builder
> (of course continuing to interface with cakePHP on the server side) ?
>
> Assuming money/learning AS3 is not an issue, any opinions on which
> would be faster/more powerful to develop with?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Possible ACL or Cookie Issue When I Reload Page

2009-09-11 Thread hahmadi82


Does any one know how to fix this?



hahmadi82 wrote:
> 
> There's a very peculiar problem with my site that I can't quite figure
> out.  My "garage" page loads/displays information from the database based
> on the users current session that's logged in.  The user_id used to load
> the information is set to $this->Auth->user('id'). However, if you reload
> the page repeatedly real fast, all the data comes in as blank and I get a
> mysql error saying that the user_id is not set.  At this point, if I click
> on a different page and go back to the "garage" page the data loads fine
> again.  This issue also occurs if you sit on the "garage" page for, lets
> say, 30 minutes and push reload once.  The data doesn't load and I get the
> error until I click on a different page.  Why is this happening?
> 

-- 
View this message in context: 
http://www.nabble.com/Possible-ACL-or-Cookie-Issue-When-I-Reload-Page-tp25373747p25407462.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
-~--~~~~--~~--~--~---



Re: Select only one row

2009-09-11 Thread sindbad

Okay,

thanks for your reply but from where I get the $id. This should be
Client.id but... this query selects only one row but I need to select
only one row for each client. I have 1000 clients and 21290 reports.
For every client I need to select the date of last report.

On 11 sep., 21:52, Miles J  wrote:
> Well you would have to grab the last date. Heres a query, assuming you
> followed cake conventions.
>
> $result = $this->Report->find('first', array(
> 'fields' => 'Report.created',
> 'order' => 'Report.id DESC',
> 'conditions' => array('Report.client_id' => $id)
> ));
>
> Then echo it in the view: echo $result['Report']['created'];
>
> On Sep 11, 11:42 am, sindbad  wrote:
>
> > Hi,
>
> > first of all I want to say that I'm new to cake but with a little help
> > from book.cakephp.org and Google I've made a simple application for
> > managing clients and reports for the clients.
> > Each client has many raports. Now, in the index view of the clients I
> > need to show the date of last report. This is what I don't know how to
> > do it.
> > I'll be glad if you could tell me how to select only the date of the
> > last report for each of my clients.
> > 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: Select only one row

2009-09-11 Thread Miles J

Well you would have to grab the last date. Heres a query, assuming you
followed cake conventions.

$result = $this->Report->find('first', array(
'fields' => 'Report.created',
'order' => 'Report.id DESC',
'conditions' => array('Report.client_id' => $id)
));

Then echo it in the view: echo $result['Report']['created'];

On Sep 11, 11:42 am, sindbad  wrote:
> Hi,
>
> first of all I want to say that I'm new to cake but with a little help
> from book.cakephp.org and Google I've made a simple application for
> managing clients and reports for the clients.
> Each client has many raports. Now, in the index view of the clients I
> need to show the date of last report. This is what I don't know how to
> do it.
> I'll be glad if you could tell me how to select only the date of the
> last report for each of my clients.
> 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
-~--~~~~--~~--~--~---



Select only one row

2009-09-11 Thread sindbad

Hi,

first of all I want to say that I'm new to cake but with a little help
from book.cakephp.org and Google I've made a simple application for
managing clients and reports for the clients.
Each client has many raports. Now, in the index view of the clients I
need to show the date of last report. This is what I don't know how to
do it.
I'll be glad if you could tell me how to select only the date of the
last report for each of my clients.
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: Smarty

2009-09-11 Thread mark_story

Don't use smarty, It really adds nothing, it just makes life harder
than it really needs to be.

-Mark

On Sep 11, 1:56 am, Dave  wrote:
> Hi,
> Trying to use the smartyform helper to create forms.
> Anyone point me to an example?
> Completely lost at the moment
>
> 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: 1.3dev - some problems

2009-09-11 Thread mark_story

There was an issue with the console in the 1.3-dev package.  If you
want to use 1.3 I recommend using a git clone until a new package is
made.

-Mark

On Sep 11, 5:08 am, WebbedIT  wrote:
> I had a quick go with it, but failed miserably at trying to create the
> sessions table from the command line, kept throwing an fatal error
> with missing I18n class.
>
> Reverted back to last stable release, which is now already out of
> date :o)
--~--~-~--~~~---~--~~
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: Formatting Dates in a Select form Field?

2009-09-11 Thread Miles J

You would put the mysql format date on the fields. Round.id, and
Round.rounddate.

If that doesn't work you'll have to do a loop, nothing wrong with
loops!

On Sep 11, 10:05 am, Gerard  wrote:
> Thanks. I would prefer to stay away from the loop but will implement
> it if I have to.  My current find statement is as follows:
> $rounds = $this->Tip->Round->find('list', array('fields' => array
> ('Round.id', 'Round.rounddate')));
>
> This gets the two fields to populate the select field with the ID and
> the date.  Is there an $option setting to change the output, I can't
> find it in the "book"?  Or are you suggesting I just use the custom
> query command - which would be way too simple and I'm embarrassed I
> didn't think of it?
>
> Thanks
>
> On Sep 12, 12:51 am, WebbedIT  wrote:
>
> > either modify your find which generates the list to get mysql to
> > reformat the dates, or run the array through a loop which uses
> > something like date('d-M', strtotime($date)); to reformat the values.
--~--~-~--~~~---~--~~
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: Formatting Dates in a Select form Field?

2009-09-11 Thread Gerard

Thanks. I would prefer to stay away from the loop but will implement
it if I have to.  My current find statement is as follows:
$rounds = $this->Tip->Round->find('list', array('fields' => array
('Round.id', 'Round.rounddate')));

This gets the two fields to populate the select field with the ID and
the date.  Is there an $option setting to change the output, I can't
find it in the "book"?  Or are you suggesting I just use the custom
query command - which would be way too simple and I'm embarrassed I
didn't think of it?

Thanks

On Sep 12, 12:51 am, WebbedIT  wrote:
> either modify your find which generates the list to get mysql to
> reformat the dates, or run the array through a loop which uses
> something like date('d-M', strtotime($date)); to reformat the values.
--~--~-~--~~~---~--~~
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: Doing a calculation as a field in a find

2009-09-11 Thread Andrew Koebbe

Ok. The parentheses worked. So the moral of the story is. Don't use
model names and put the math in parentheses.

Thanks for the help.
--Andrew

On Sep 11, 11:01 am, "euromark (munich)" 
wrote:
> did you try it this way:
>
> (field1-field2) as foo
>
> maybe you need the parenthesis... not sure though
> but i know that MAX(...) etc works - so that would be my guess
>
> On 11 Sep., 16:01, Andrew Koebbe  wrote:
>
> > Thanks for the suggestion. If I do that it back-ticks the whole thing
>
> > select `x-y` AS `difference` from ...
>
> > putting spaces around the minus sign produces similar errors. Is there
> > a way to remove the back ticks for that field?
>
> > --Andrew
>
> > On Sep 11, 7:44 am, Rick  wrote:
>
> > > Assuming you don't need recursion, try it without the model names,
> > > i.e.
>
> > > 'x-y as difference'
>
> > > Rick
>
> > > On Sep 10, 5:33 pm, Andrew Koebbe  wrote:
>
> > > > I'm trying to do a simple subtraction as a field in a find statment...
>
> > > > ex.
>
> > > > $this->Model->find('all',array(
> > > >   'fields' => array(
> > > >     'Model.x - Model.y as difference'
> > > >   )
> > > > ));
>
> > > > but it's not parsing that correctly.
>
> > > > It's doing "select `Model`.`x - Model.y as difference` from ..."
>
> > > > Am I missing something simple here?
>
> > > > I know I could do the subtraction outside the query, but I want to be
> > > > able to order the query by the result of this subtraction.
>
> > > > Thanks.
> > > > --Andrew
>
>
--~--~-~--~~~---~--~~
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 call method from another controller?

2009-09-11 Thread Miles J

Thats correct, however there is no memory overhead by adding extra
methods to classes.

On Sep 11, 9:11 am, Mukhamad Ikhsan  wrote:
> when you declare a function on app_controller, that means you instantiate
> that function in every instants of controller.
>
> if every we need something we put the function on app_controller, i thin'k
> that increase the memory overhead, plus we don't correlate the function
> within related class.
>
> but it's odd to calling other function on other controller, many cases is
> calling a function on component/vendor. on MVC paradigm, as far i know the
> controller is just 'passing message' (become a driver) between view <-> data
> so for other functionalities we can create other classes (component, vendor
> e.g : pdf, filehandler, etc).
>
>
>
> On Thu, Sep 10, 2009 at 11:42 PM, Miles J  wrote:
>
> > Well whats the problem with putting it in the AppController? Its your
> > application, so it should be no problem in being global and having
> > someone "access" it.
>
> > If its an action that outputs the same view and contents, then perhaps
> > you should rethink how it works.
>
> > On Sep 10, 1:09 am, Tokasa  wrote:
> > > Hi Miles,
> > > What is wrong on Mukhamad's idea?
>
> > > But what would you suggest, if you'd like to call some other
> > > controller's method but you dont want to put it globaly in
> > > app_controller??
>
> > > Thanks
> > > Tomas
>
> > > On Sep 9, 6:18 pm, Miles J  wrote:
>
> > > > Do not listen to Mukhamad Ikhsan, that way is extremely wrong.
>
> > > > Simply place the method you want to use in the AppController, or
> > > > within a component.
>
> > > > On Sep 9, 6:38 am, Mukhamad Ikhsan  wrote:
>
> > > > > initialize to local variable, $variable = App::import('Controller',
> > > > > array('example'));
>
> > > > > $variable->method
>
> > > > > On Wed, Sep 9, 2009 at 8:36 PM, Mukhamad Ikhsan <
> > ikhsan.o...@gmail.com>wrote:
>
> > > > > > App::import('Controller', array(...));
>
> >http://book.cakephp.org/view/531/Importing-Controllers-Models-Compone...
>
> > > > > > On Wed, Sep 9, 2009 at 3:50 PM, toka...@gmail.com <
> > toka...@gmail.com>wrote:
>
> > > > > >> Hi, how can I call method from another controller?
>
> > > > > >> I have read somthing about requestAction(...) but in help they say
> > ...
> > > > > >> "It is rarely appropriate to use in a controller or model."
>
> > > > > >> Is there other better way??
>
> > > > > >> Thanks
> > > > > >> Tomas
>
> > > > > --
> > > > > Mukhamad Ikhsan
> > > > > +6281572181283
> > > > > Y!id:ikhsan.onlyhttp://www.diodachi.com
>
> --
> Mukhamad Ikhsan
> +6281572181283
> Y!id:ikhsan.onlyhttp://www.diodachi.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Validation in 1.2

2009-09-11 Thread Miles J

Because its wrong. Its a good idea to take a look at the
validation.php library class.

The VALID_NOT_EMPTY constant is a regex string, so it would not apply
at all the way you are doing it.

You are also calling custom functions wrong.

var $validate = array(
'title' => array(
'required' => true,
'length' => array(
'rule' => array('validateLength', 5, 100),
'message'  => 'Invalid length'
),
'notEmpty' => array(
'rule' => 'notEmpty',
'message'  => 'Required title'
)
 ),
'body' => 'notEmpty'
);

On Sep 11, 12:53 am, Dave  wrote:
> For some reason this is not checking validation and is allowing me to
> enter empty fields in both title and body.
> Code for model/cont/view is below. I'm using cake 1.2.5
> Any pointers would be muchly appreciated
>
> // model
> class Post extends AppModel {
>     var $name = 'Post';
>         var $validate = array(
>         'title' => array(
>                 'required' => VALID_NOT_EMPTY,
>                 'length' => array( 'rule' => 'validateLength', 'min'
> => 5, 'max' => 100 )
>         ),
>         'body' => VALID_NOT_EMPTY
>         );
>         function validateLength($value, $params = array()) {
>         $valid = false;
>
>         $params = am(array(
>             'min' => null,
>             'max' => null,
>         ), $params);
>
>         if (empty($params['min']) || empty($params['max'])) {
>             $valid = false;
>         } else if (strlen($value) >= $params['min'] && strlen($value)
> <= $params['max']) {
>             $valid = true;
>         }
>
>         return $valid;
>     }
>
> }
>
> //controller
>
> class PostsController extends AppController {
>         var $name = 'Posts';
>         function index() {
>                 $this->set('posts', $this->Post->find('all'));
>         }
>         function view($id = null) {
>                 $this->Post->id = $id;
>                 $this->set('post', $this->Post->read());
>         }
>         function add() {
>         if (!empty($this->data)) {
>             // We don't do any real saving, we just validate the model
>
>             if ($this->Post->validates() && $this->Post->save($this->data)) {
>
>                                 $this->Session->setFlash('Your post
> has been saved.');
>                                 $this->redirect(array('action' =>
> 'index'));
>             }
>         }
>         }
>         function delete($id) {
>                 $this->Post->delete($id);
>                 $this->Session->setFlash('The post with id: '.$id.'
> has been deleted.');
>                 $this->redirect(array('action'=>'index'));
>         }
>         function edit($id = null) {
>                 $this->Post->id = $id;
>                 if (empty($this->data)) {
>                         $this->data = $this->Post->read();
>                 } else {
>                         if ($this->Post->save($this->data)) {
>                                 $this->Session->setFlash('Your post
> has been updated.');
>                                 $this->redirect(array('action' =>
> 'index'));
>                         }
>                 }
>         }
>
> }
>
> // add view
>
> Add Post
> {javascript func=link url="/tiny_mce/tiny_mce.js" assign=""
> __show_call=""}
> {assign_assoc var='error' value='error=>Please specify a valid body'}
> {form func='create' assign='' __show_call=false}
> {form func=input fieldName=Title class="test" size="30" assign=""
> __show_call=""}
> {form func=label fieldName=Body  assign="" __show_call=""}
> {form func=textarea fieldName=Body class="test" size="30" assign=""
> __show_call="" error=$error}
> {form func='submit' fieldName=Submit assign='' __show_call=false}
> {form func='end' fieldName=Submit assign='' __show_call=false}
--~--~-~--~~~---~--~~
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 call method from another controller?

2009-09-11 Thread Mukhamad Ikhsan
when you declare a function on app_controller, that means you instantiate
that function in every instants of controller.

if every we need something we put the function on app_controller, i thin'k
that increase the memory overhead, plus we don't correlate the function
within related class.

but it's odd to calling other function on other controller, many cases is
calling a function on component/vendor. on MVC paradigm, as far i know the
controller is just 'passing message' (become a driver) between view <-> data
so for other functionalities we can create other classes (component, vendor
e.g : pdf, filehandler, etc).


On Thu, Sep 10, 2009 at 11:42 PM, Miles J  wrote:

>
> Well whats the problem with putting it in the AppController? Its your
> application, so it should be no problem in being global and having
> someone "access" it.
>
> If its an action that outputs the same view and contents, then perhaps
> you should rethink how it works.
>
> On Sep 10, 1:09 am, Tokasa  wrote:
> > Hi Miles,
> > What is wrong on Mukhamad's idea?
> >
> > But what would you suggest, if you'd like to call some other
> > controller's method but you dont want to put it globaly in
> > app_controller??
> >
> > Thanks
> > Tomas
> >
> > On Sep 9, 6:18 pm, Miles J  wrote:
> >
> > > Do not listen to Mukhamad Ikhsan, that way is extremely wrong.
> >
> > > Simply place the method you want to use in the AppController, or
> > > within a component.
> >
> > > On Sep 9, 6:38 am, Mukhamad Ikhsan  wrote:
> >
> > > > initialize to local variable, $variable = App::import('Controller',
> > > > array('example'));
> >
> > > > $variable->method
> >
> > > > On Wed, Sep 9, 2009 at 8:36 PM, Mukhamad Ikhsan <
> ikhsan.o...@gmail.com>wrote:
> >
> > > > > App::import('Controller', array(...));
> >
> > > > >
> http://book.cakephp.org/view/531/Importing-Controllers-Models-Compone...
> >
> > > > > On Wed, Sep 9, 2009 at 3:50 PM, toka...@gmail.com <
> toka...@gmail.com>wrote:
> >
> > > > >> Hi, how can I call method from another controller?
> >
> > > > >> I have read somthing about requestAction(...) but in help they say
> ...
> > > > >> "It is rarely appropriate to use in a controller or model."
> >
> > > > >> Is there other better way??
> >
> > > > >> Thanks
> > > > >> Tomas
> >
> > > > --
> > > > Mukhamad Ikhsan
> > > > +6281572181283
> > > > Y!id:ikhsan.onlyhttp://www.diodachi.com
> >
>


-- 
Mukhamad Ikhsan
+6281572181283
Y!id:ikhsan.only
http://www.diodachi.com

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



Re: PHP IDEs

2009-09-11 Thread Miles J

I use eclipse at work and its pretty bad. The project tree also
freezes up and eclipse crashes, it hogs a ton of memory, it always has
unexpected errors, etc.

On Sep 11, 6:42 am, Bert Van den Brande  wrote:
> I also use Eclipse PDT.
>
> Pro's :
> * out of the box support for debugging with Zend and XDebug (what
> developer can live without debugging ?)
> * code completion
> * SVN integration (requires plugin)
> * Mylyn (task based contexts) and the Jira | TRAC connector
>
> Con's :
> * memory usage is rather big
> * overall performance drops now and then
>
> Tried NetBeans a couple of times but couldn't get used to the
> shortcuts + didn't see any real advantages over Eclipse ...
>
> Friendly greetings,
> Bert
>
> On Fri, Sep 11, 2009 at 9:55 AM, Werschinger  
> wrote:
>
> > I want to add to Kornelije's post that there's also free Komodo Edit,
> > which I use under Mac OS and like a lot. Some features I often use:
> > - snippets
> > - custom keyboard combinations
> > - split view (e.g. when editing two parts of a long file)
>
> > It is available for all major operating systems.
>
> > The IDE is much more powerful but also costly.
--~--~-~--~~~---~--~~
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: Error: Create the class Index.phpController below in file: app\controllers\index.php_controller.php

2009-09-11 Thread Miles J

Seems like a mod_rewrite problem, check your apache settings.

On Sep 11, 2:22 am, Daniel Pradeep 
wrote:
> Hi All,
>
> I have developed and tested an application using CakePHP in my windows
> development server. After ensuring that everything was fine, I moved
> it to production server, which is again a dedicated windows server.
> But here is where I got struck.
>
> I received "Error: Create the class Index.phpController below in file:
> app\controllers\index.php_controller.php" when I tried to run the
> application.
>
> Do you guys have any suggestions for me?
>
> Please help me out in this.
>
> Thanks.
>
> Daniel Pradeep
--~--~-~--~~~---~--~~
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: Opinions please: HTML/css/js vs. AS3/Flex/Flex Builder?

2009-09-11 Thread Miles J

I personally think flex is terrible, and I have developed in it.
Theres a reason you rarely see any flex sites.

Also full flash sites are a horrible idea. For one there is no SEO,
secondly there is no search engine indexing, thirdly some users might
not have the right flash version, etc, etc.

On Sep 11, 8:16 am, keymaster  wrote:
> The more I read about flex, the more I feel compelled to question
> whether I should be staying with HTML/js/CSS etc. for the front ends
> of the apps I build, or switching to ActionSript 3.0/Flex/Flex builder
> (of course continuing to interface with cakePHP on the server side) ?
>
> Assuming money/learning AS3 is not an issue, any opinions on which
> would be faster/more powerful to develop with?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Error Layout

2009-09-11 Thread lordG

Hi Guys,

I have read a few articles for changing the layout for error messages.
However, I was wondering if anyone knows of enhancements coming that
actually solve the problem in a simple way.

For example, it would make sense perhaps to have the AppError class
have a class variable of layout, which the __constructor or
__outputMessage would then set the controller layout accordingly.

Any ideas?

G
--~--~-~--~~~---~--~~
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: Doing a calculation as a field in a find

2009-09-11 Thread euromark (munich)

did you try it this way:

(field1-field2) as foo

maybe you need the parenthesis... not sure though
but i know that MAX(...) etc works - so that would be my guess




On 11 Sep., 16:01, Andrew Koebbe  wrote:
> Thanks for the suggestion. If I do that it back-ticks the whole thing
>
> select `x-y` AS `difference` from ...
>
> putting spaces around the minus sign produces similar errors. Is there
> a way to remove the back ticks for that field?
>
> --Andrew
>
> On Sep 11, 7:44 am, Rick  wrote:
>
> > Assuming you don't need recursion, try it without the model names,
> > i.e.
>
> > 'x-y as difference'
>
> > Rick
>
> > On Sep 10, 5:33 pm, Andrew Koebbe  wrote:
>
> > > I'm trying to do a simple subtraction as a field in a find statment...
>
> > > ex.
>
> > > $this->Model->find('all',array(
> > >   'fields' => array(
> > >     'Model.x - Model.y as difference'
> > >   )
> > > ));
>
> > > but it's not parsing that correctly.
>
> > > It's doing "select `Model`.`x - Model.y as difference` from ..."
>
> > > Am I missing something simple here?
>
> > > I know I could do the subtraction outside the query, but I want to be
> > > able to order the query by the result of this subtraction.
>
> > > Thanks.
> > > --Andrew
--~--~-~--~~~---~--~~
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: Complex model associations, pagination and containable

2009-09-11 Thread martinp

Hello

Thanks for your replies. I thought I was watching this topic, but
wasn't aware that the discussion had continued without me!

Brian - I think you've hit the nail on the head regarding my
containment problem, but I still don't have it working.
Miles J - I assure you they are all belongsTo associations. What is
wrong with my conditions array?

I've stripped it back a bit to try and get the 'School' association
working first. Here's what I have:

$this->paginate['CourseResult'] = array(
'fields' => array(
'CourseResult.id',
'CourseResult.course_id',
'CourseResult.no_of_weeks',
'CourseResult.year',
'CourseResult.price'
),
'contain' => array(
'Course' => array(
'fields' => array(
'Course.id',
'Course.school_id',
'Course.name',
'Course.course_language_id',
'Course.course_type_id',

'Course.course_qualification_id',
'Course.course_level_min',
'Course.course_level_max',
'Course.published',
'Course.deleted'
),
'School' => array(
'fields' => array(
'School.id',
'School.name',
'School.city',
'School.country_id'
)
)
)
),
'conditions' => $conditions
);
$rows = $this->paginate('CourseResult');

Working with the same conditions as above and with the same result.

On Sep 4, 9:31 pm, Miles J  wrote:
> Correct me if im wrong, but are you allowed to use $conditions the way
> he is? On top of that, I feel like were not seeing all the queries,
> all of those associations cant be belongsTo.
--~--~-~--~~~---~--~~
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: Formatting Dates in a Select form Field?

2009-09-11 Thread WebbedIT

either modify your find which generates the list to get mysql to
reformat the dates, or run the array through a loop which uses
something like date('d-M', strtotime($date)); to reformat the values.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Pictures in blog

2009-09-11 Thread Theo McCaie
I'm looking to serve up pictures with a blog post and hoping for
architectural advice. There can be any number of pictures any where in the
article.

To create a post there is a form with a text area (for the blog) and a
picture upload field (and fields with info about the picture eg align right,
descripton etc).
Finally a small bit of java which replicates the inputs again so you can add
more blog or pictures, rinse and repeat.

What is the best way do you guys think to implement this. Currently the file
is uploaded and a  tag is appended to the blog post and saved in the
data base. This isn't a great solution.

I'd love to heat some ideas for a flexible way of storing, and editing this
data.

Thanks

Theo.

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



Opinions please: HTML/css/js vs. AS3/Flex/Flex Builder?

2009-09-11 Thread keymaster

The more I read about flex, the more I feel compelled to question
whether I should be staying with HTML/js/CSS etc. for the front ends
of the apps I build, or switching to ActionSript 3.0/Flex/Flex builder
(of course continuing to interface with cakePHP on the server side) ?

Assuming money/learning AS3 is not an issue, any opinions on which
would be faster/more powerful to develop with?

--~--~-~--~~~---~--~~
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: 1.3dev - some problems

2009-09-11 Thread euromark (munich)

i usually use the php or "cake" sessions


On 11 Sep., 11:08, WebbedIT  wrote:
> I had a quick go with it, but failed miserably at trying to create the
> sessions table from the command line, kept throwing an fatal error
> with missing I18n class.
>
> Reverted back to last stable release, which is now already out of
> date :o)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Formatting Dates in a Select form Field?

2009-09-11 Thread gedm

I have an array of data ($rounds) retrieved from a find('list')
command which looks like:
[1] => 2009-09-06
[2] => 2009-09-13
[3] => 2009-09-20
[4] => 2009-09-27
[5] => 2009-10-04
[6] => 2009-10-11
[7] => 2009-10-18
[8] => 2009-10-25
[9] => 2009-11-01
[10] => 2009-11-08
[11] => 2009-11-15

The dates populate a Select form field using the view code
$form->input('round_id');

I would like to reformat the dates in the Select field to d-mmm

How do I reformat the values in the Select form field?

Thanks

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



Doing a mysql left join

2009-09-11 Thread Whitty

Hi,

I'm a bit new to this, I'm trying to do a left join.

I have a db with People table (id:name_id) in it a linking table
(linking name_id to addr_id) and an address table with the index
(addr_id)

the sql command I usually use is:

SELECT persons_address.addr_id FROM addresses left JOIN
persons_address ON persons_address.addr_id = addresses.addr_id WHERE
persons_address.name_id ='.$name_id

I'm assuming I need a model for the linking table.

How would I go about creating a query to print out the users name with
the linked address below? I've got as far as outputting the user name.

Are their any examples?

Darren


--~--~-~--~~~---~--~~
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: Doing a calculation as a field in a find

2009-09-11 Thread Andrew Koebbe

Thanks for the suggestion. If I do that it back-ticks the whole thing

select `x-y` AS `difference` from ...

putting spaces around the minus sign produces similar errors. Is there
a way to remove the back ticks for that field?

--Andrew

On Sep 11, 7:44 am, Rick  wrote:
> Assuming you don't need recursion, try it without the model names,
> i.e.
>
> 'x-y as difference'
>
> Rick
>
> On Sep 10, 5:33 pm, Andrew Koebbe  wrote:
>
> > I'm trying to do a simple subtraction as a field in a find statment...
>
> > ex.
>
> > $this->Model->find('all',array(
> >   'fields' => array(
> >     'Model.x - Model.y as difference'
> >   )
> > ));
>
> > but it's not parsing that correctly.
>
> > It's doing "select `Model`.`x - Model.y as difference` from ..."
>
> > Am I missing something simple here?
>
> > I know I could do the subtraction outside the query, but I want to be
> > able to order the query by the result of this subtraction.
>
> > Thanks.
> > --Andrew
>
>
--~--~-~--~~~---~--~~
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: TinyMCE + MCFileManager

2009-09-11 Thread WebbedIT

OK, I got this working using the ExternalAuthenticator which makes a
remote request to a file within cake (in my case /users/mcAuth) where
you can access your session data and then pass information back to
MCImageManager adjusting the configuration to match the user.  Was
relatively easy once I put my mind to it.

Got to say I am well impressed with TinyMCE + MCFileManager ... the
app I am working with is going to be an online community for charities
and their supporters and when a user from a charity is logged in, it
pulls the cause_id from the users session and knows which folders on
the server they have access to.

Costs around £75 per site to have the two plugins for TinyMCE, I had
them downloaded and installed in a cpl of hours and has provided my
project with a cracking WYSIWYG editor with ability to insert images
and links to files.

When I have launched my project I plan on doing a full writeup on all
I have learned over the last year (this is my second big app, first
one took 8 months, this one is bigger but only taken me 1 month and
nearing completion).

Gotta love CakePHP, once you know how to do something it's a lot
faster the second time around :o)
--~--~-~--~~~---~--~~
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: PHP IDEs

2009-09-11 Thread Bert Van den Brande

I also use Eclipse PDT.

Pro's :
* out of the box support for debugging with Zend and XDebug (what
developer can live without debugging ?)
* code completion
* SVN integration (requires plugin)
* Mylyn (task based contexts) and the Jira | TRAC connector

Con's :
* memory usage is rather big
* overall performance drops now and then

Tried NetBeans a couple of times but couldn't get used to the
shortcuts + didn't see any real advantages over Eclipse ...


Friendly greetings,
Bert

On Fri, Sep 11, 2009 at 9:55 AM, Werschinger  wrote:
>
> I want to add to Kornelije's post that there's also free Komodo Edit,
> which I use under Mac OS and like a lot. Some features I often use:
> - snippets
> - custom keyboard combinations
> - split view (e.g. when editing two parts of a long file)
>
> It is available for all major operating systems.
>
> The IDE is much more powerful but also costly.
>
> >
>

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

2009-09-11 Thread Bert Van den Brande

Though Smarty may be handy in some usecases, I also would suggest to
use the Cake formhelper ...

On Fri, Sep 11, 2009 at 2:37 PM, Smelly Eddie  wrote:
>
> Drop Smarty.
>
> Cake makes form generation a snap.
>
> Please read the book. (@CAKEPHP.ORG)
>
>
>
> On Sep 11, 1:56 am, Dave  wrote:
>> Hi,
>> Trying to use the smartyform helper to create forms.
>> Anyone point me to an example?
>> Completely lost at the moment
>>
>> 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: app problems after upgrading cake to newer versions.. [within 1.2.4.xx] ?

2009-09-11 Thread Bert Van den Brande

Interesting to see the basic memory footprint of a basic CakePHP page.
Without reference material of course there's way to evaluate this data :)

Glad the problem is sorted out ...


On Thu, Sep 10, 2009 at 1:19 PM, Tokasa  wrote:
>
> I did few more testing :)
> I have put this in my script to see how memory is occupied...
>
> http://us2.php.net/manual/en/function.memory-get-usage.php
> http://us2.php.net/manual/en/function.memory-get-peak-usage.php
>
>
> I have compared 2 use cases:
>
> 1) very very simple script BAKED by cakephpit was index page with
> 4 records in db - no more data displayed!
> 2) and my issue script commented above...this takes much more records
> then I mentioned before (1-2 rec.)...I was not correct sorry for
> confusion.
>
> I first case it eats approx 6.75 MB and in second case it eats at the
> end of script 8.15 MB.
>
> From this I see that cake take at least some 6MB to start :)
>
> I am ok with that,
> thanks...
>
>
> On Sep 10, 12:24 pm, Bert Van den Brande  wrote:
>> Is 8MB much ... all depends on the functionality of the scripts.
>>
>> Personally I almost always need higher limits from the moment you
>> start working with shells/scripts that consume lot's of data.
>>
>> Seeing that you only read 2 records from the database I suspect there
>> is some functionality inside the controller/view that consumes lot's
>> of memory.
>>
>> On Thu, Sep 10, 2009 at 11:58 AM, Tokasa  wrote:
>>
>> > in the element "draw_form_item.ctp" on line 35  I do only request
>> > action to get data and I pass them to  render another element but
>> > the database is almost empty...I am fetching 1-2 records...
>>
>> > is it wrong that I render element from other element? could this
>> > increase the memory??
>>
>> > On Sep 10, 11:55 am, Tokasa  wrote:
>> >> Hi Bert,
>> >> thanks for your reply.
>>
>> >> I have tried to raise memory limit from 8MB to 9MB and it works then
>> >> OK
>>
>> >> Anyway do you have any idea if 9MB memory usage is absolutely NORMAL
>> >> or I have to optimize something??
>> >> I know I can increase it e.g. up to 128MB but I dont know yet what
>> >> hosting company accepts...
>>
>> >> Thanks
>> >> Tomas
>>
>> >> On Sep 9, 12:25 pm, Bert Van den Brande  wrote:
>>
>> >> > I think it also depends on what your own code is doing in
>> >> > "draw_form_item.ctp" on line 35 .
>>
>> >> > Possibly the CakePHP upgrade requires a little bit of extra memory,
>> >> > and your script was already near the limit of 8MB using the previous
>> >> > CakePHP version ?
>>
>> >> > Try raising the memory limit a bit and evaluate the outcome.
>>
>> >> > Friendly greetings,
>> >> > Bert
>>
>> >> > On Wed, Sep 9, 2009 at 11:12 AM, toka...@gmail.com 
>> >> > wrote:
>>
>> >> > > Hi, I have got some little issue and I would appreciate if anybody can
>> >> > > help me out :)
>>
>> >> > > In some specific part PHP (not even cake I guess) gives me strange
>> >> > > error.
>>
>> >> > > 
>> >> > > Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
>> >> > > allocate 19456 bytes) in /Users/tokasa/www/project/app/views/elements/
>> >> > > forms/draw_form_item.ctp on line 35
>> >> > > 
>>
>> >> > > The thing I do no understand is that it occurs only between upgrade
>> >> > > from 1.2.4.8166 to 1.2.4.8284 or even the newest 1.2.5.
>>
>> >> > > On spring I started developing an application in cake 1.2.4.8004 ->
>> >> > > upgrade to 1.2.4.8120 -> 1.2.4.8166. and everythin was fine. As I said
>> >> > > this problems pops up going to higher version starting the 1.2.4.8284.
>>
>> >> > > I have got two teories... my code was wrong and fortunately it worked
>> >> > > in older versions DUE to some old bug...
>>
>> >> > > OR
>>
>> >> > > developers had changed something significant...
>>
>> >> > > There is something I have found in my debugging times... It may have
>> >> > > something to do with requestAction(...).
>> >> > > I i comment that it works...
>>
>> >> > > Thanks for any Idea!!
>> >> > > I nobody has something I will report that as a bug...
>>
>> >> > > Tomas
> >
>

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



Error: Create the class Index.phpController below in file: app\controllers\index.php_controller.php

2009-09-11 Thread Daniel Pradeep

Hi All,

I have developed and tested an application using CakePHP in my windows
development server. After ensuring that everything was fine, I moved
it to production server, which is again a dedicated windows server.
But here is where I got struck.

I received "Error: Create the class Index.phpController below in file:
app\controllers\index.php_controller.php" when I tried to run the
application.

Do you guys have any suggestions for me?

Please help me out in this.

Thanks.

Daniel Pradeep

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



How can i check session id

2009-09-11 Thread Abdus Samad

Dear Auther,
 How can i check session id for empty or null
otherwise print the session id??

--~--~-~--~~~---~--~~
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: Doing a calculation as a field in a find

2009-09-11 Thread Rick

Assuming you don't need recursion, try it without the model names,
i.e.

'x-y as difference'

Rick


On Sep 10, 5:33 pm, Andrew Koebbe  wrote:
> I'm trying to do a simple subtraction as a field in a find statment...
>
> ex.
>
> $this->Model->find('all',array(
>   'fields' => array(
>     'Model.x - Model.y as difference'
>   )
> ));
>
> but it's not parsing that correctly.
>
> It's doing "select `Model`.`x - Model.y as difference` from ..."
>
> Am I missing something simple here?
>
> I know I could do the subtraction outside the query, but I want to be
> able to order the query by the result of this subtraction.
>
> Thanks.
> --Andrew
--~--~-~--~~~---~--~~
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 && plugin

2009-09-11 Thread AgBorkowski

i solved this problem by add "LikecontentSection" to fieldname
  echo $form->input('LikecontentSection.title');

On 9 Wrz, 19:49, "andrzejborkow...@gmail.com"
 wrote:
> WTF loks at namespaces LikecontentSection && Section
>
> my VIEW
>                 create('Section',array
> ('plugin'=>'likecontent','controller'=>'sections','action'=>'add'));?>
>                         
>                                 
>                                                          echo 
> $form->input('parent',array('empty'=>'('.__('general
> category',true).')'));
>                                 echo $form->input('title');
>                                 echo $form->input('desc');
>                                 echo $form->input('more');
>                         ?>
> MODEL && before save debug
>
> Array
> (
>     [LikecontentSection] => Array
>         (
>             [view] => yes
>             [Section] => Array
>                 (
>                     [parent_id] =>
>                     [title] => strona główna
>                     [desc] => strona glowna agreguje wsytzskie
> najnowsze informacje ktore pojawiaja sie na stronie naszej funmdacji
>                     [more] =>
>                 )
>
>             [modified] => 2009-09-09 17:45:35
>             [created] => 2009-09-09 17:45:35
>             [lft] => 1
>             [rght] => 2
>         )
>
> )
> Why i have 2 dimension and stupid query
> Query: INSERT INTO `likecontent_sections` (`view`, `modified`,
> `created`, `lft`, `rght`, `url`) VALUES ('yes', '2009-09-09 17:45:35',
> '2009-09-09 17:45:35', 1, 2, '')
--~--~-~--~~~---~--~~
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: Smarty

2009-09-11 Thread Smelly Eddie

Drop Smarty.

Cake makes form generation a snap.

Please read the book. (@CAKEPHP.ORG)



On Sep 11, 1:56 am, Dave  wrote:
> Hi,
> Trying to use the smartyform helper to create forms.
> Anyone point me to an example?
> Completely lost at the moment
>
> 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
-~--~~~~--~~--~--~---



TinyMCE + MCFileManager

2009-09-11 Thread WebbedIT

Has anyone managed to incorporate TinyMCE + MCFileManager and got the
authentication working correctly?  There are authentication plugins
for Drupal, Joomla, Mambo, Mooz, PHPNuke, Wordpress but nothing for
CakePHP.

I am saving my sessions to the database (I'm not too hot with sessions
etc.) and need to be able to pass $Session->auth data to the
SessionAuthenticator which MCFileManager uses to check a user is
authenticated and alter configurations depending on user access rights
etc.

Any help would be greatly appreciated.  For now I will bypass
authentication to play with it some more.
--~--~-~--~~~---~--~~
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: Question on the method input of Form helper relative to type 'date'

2009-09-11 Thread byqsri

Ok ... all is right ... But this 'start_date' field isn't a model's
field but a date to do a search.
I can use it like a Model.start_date but conceptually this is wrong.

On 11 Set, 11:04, WebbedIT  wrote:
> When you move away from the conventions and things go wrong, it's so
> much harder to debug.  What does e($form->input
> ('ModelName.start_date'); produce?
>
> It should produce
>
>  .
>  .
> 
>
> I reckon the problem lies somewhere in the fact your resultant code
> does not have a ModelName and your field is startDate (which should be
> start_date using convention) yet your telling $form->input to use
> starDate (missing 't').
--~--~-~--~~~---~--~~
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 reach a url from form inputs without using ajax

2009-09-11 Thread WebbedIT

There would be no need for ajax, but possibly a javascript observer.

However all your really wanting to do is submit to

/links/edit/$id

Try changing your action to /links/edit which should pass the id to
the action in the $this->data array.
--~--~-~--~~~---~--~~
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: 1.3dev - some problems

2009-09-11 Thread WebbedIT

I had a quick go with it, but failed miserably at trying to create the
sessions table from the command line, kept throwing an fatal error
with missing I18n class.

Reverted back to last stable release, which is now already out of
date :o)
--~--~-~--~~~---~--~~
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: Question on the method input of Form helper relative to type 'date'

2009-09-11 Thread WebbedIT

When you move away from the conventions and things go wrong, it's so
much harder to debug.  What does e($form->input
('ModelName.start_date'); produce?

It should produce

 .
 .


I reckon the problem lies somewhere in the fact your resultant code
does not have a ModelName and your field is startDate (which should be
start_date using convention) yet your telling $form->input to use
starDate (missing 't').
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Class in label (form->radio)

2009-09-11 Thread WebbedIT

Use $form->input with 'type'=>'radio' and apply the class to the
containing div, that way you can use selectors to apply whatever
styles you wish to the radio inputs and the label.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Ask : Anyone want this site source code? or give me some advice?

2009-09-11 Thread yodi
Hello, 

I have build sites about logo sharing : http://freelogo.web.id.
It use CakePHP 1.2 Final and Jquery 1.2 and have build in one week.

Just asking that anyone interesting with this site code?
or maybe give me some advices?

If there are someone need it, i will opened it to help them.

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: model->saveAll is only for add(create)?

2009-09-11 Thread WebbedIT

In order to add a new ShiftDetail to an existing Shift you would need
to display multiple ShiftDetail forms within the form using the naming
convention

$form->input('ShiftDetail.0.id');
$form->input('ShiftDetail.0.field1');
$form->input('ShiftDetail.0.field2');

$form->input('ShiftDetail.1.id');
$form->input('ShiftDetail.1.field1');
$form->input('ShiftDetail.1.field2');

$form->input('ShiftDetail.2.id');
$form->input('ShiftDetail.2.field1');
$form->input('ShiftDetail.2.field2');

If your data array contains an value for ShiftDetail.0.id, ShiftDetail.
1.id or ShiftDetail.2.id then they will be updated, if not they will
be created.

You're probably going to have to offer an 'New ShiftDetail' link
somewhere that sends an Ajax request to append a new ShiftDetail form
as and when a user needs to add another ShiftDetail ... but on editing
a Shift you just run through a loop showing a form for each existing
ShiftDetail record.

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



Re: Cake not saving CREATED and MODIFIED field to the join table when saving related records

2009-09-11 Thread wirtsi

Hi

you need to set it as DEFAULT NULL

`modified` datetime DEFAULT NULL,

wirtsi

On 9 Sep., 15:21, doze  wrote:
> Hello,
>
> The problem is in the title "Cake not saving CREATED and MODIFIED
> field to the join table when saving related records", here's the
> models involved:
>
> -- -
> -- Table `dbname`.`user`
> -- -
> CREATE  TABLE IF NOT EXISTS `dbname`.`user` (
>   `id` INT NOT NULL AUTO_INCREMENT ,
>   `first_name` VARCHAR(255) NOT NULL ,
>   `last_name` VARCHAR(255) NOT NULL ,
>   `street_address` VARCHAR(255) NULL ,
>   `postal_code` VARCHAR(5) NULL ,
>   `city` VARCHAR(255) NULL ,
>   `phone` VARCHAR(255) NOT NULL ,
>   `email` VARCHAR(255) NULL ,
>   `gender` INT(1) NOT NULL ,
>   `username` VARCHAR(45) NULL ,
>   `password` VARCHAR(255) NULL ,
>   `active` BOOLEAN NOT NULL DEFAULT 1 ,
>   `registered` BOOLEAN NOT NULL DEFAULT 1 ,
>   `created` DATETIME NULL ,
>   `modified` DATETIME NULL ,
>   PRIMARY KEY (`id`) )
> ENGINE = InnoDB;
>
> -- -
> -- Table `dbname`.`usergroup`
> -- -
> CREATE  TABLE IF NOT EXISTS `dbname`.`usergroup` (
>   `id` INT NOT NULL AUTO_INCREMENT ,
>   `name` VARCHAR(255) NOT NULL ,
>   `created` DATETIME NULL ,
>   `modified` DATETIME NULL ,
>   PRIMARY KEY (`id`) )
> ENGINE = InnoDB;
>
> -- -
> -- Table `dbname`.`user_usergroup`
> -- -
> CREATE  TABLE IF NOT EXISTS `dbname`.`user_usergroup` (
>   `id` INT NOT NULL AUTO_INCREMENT ,
>   `user_id` INT NOT NULL ,
>   `usergroup_id` INT NOT NULL ,
>   `created` DATETIME NULL ,
>   `modified` DATETIME NULL ,
>   PRIMARY KEY (`id`) )
> ENGINE = InnoDB;
>
> And cake models:
>
>  class User extends AppModel {
>     var $useTable = 'user';
>     var $actsAs = array('Containable');
>     var $hasAndBelongsToMany = array(
>         'Usergroup' =>
>             array(
>                 'className'              => 'Usergroup',
>                 'joinTable'              => 'user_usergroup',
>                 'foreignKey'             => 'user_id',
>                 'associationForeignKey'  => 'usergroup_id',
>                 'unique'                 => true
>             )
>     );}
>
> ?>
>
>  class Usergroup extends AppModel {
>     var $useTable = 'usergroup';
>     var $hasAndBelongsToMany = array(
>         'User' =>
>             array(
>                 'className'              => 'User',
>                 'joinTable'              => 'user_usergroup',
>                 'foreignKey'             => 'usergroup_id',
>                 'associationForeignKey'  => 'user_id',
>                 'unique'                 => true
>             )
>     );}
>
> ?>
>
> And here is the view I'm using to send the form data:
>
>      echo $form->create('User', array('url' => array('controller' => '/
> user', 'action' => 'set_usergroups')));
>     echo $form->input('id', array( 'type' => 'hidden' ) );
>     echo $form->input('Usergroup.Usergroup', array(
>        'type' => 'select',
>        'multiple' => 'checkbox',
>        'options' => $usergroupList,
>        'label'=> __('usergroups', true)
>     ));
>     echo $form->end(__('save', true));
> ?>
>
> And here's the relevant part's from controller:
>
>      function set_usergroups($id = null) {
>         if (!empty($this->data)) {
>             if ($this->User->save($this->data)) {
>                 $this->Session->setFlash(__('data saved successfully',
> true));
>             } else {
>                 $this->Session->setFlash(__('error while saving data',
> true));
>             }
>         }
>         $this->User->id = $id;
>         $this->data = $this->User->read();
>         $usergroupList = $this->User->Usergroup->find('list');
>         $this->set('usergroupList', $usergroupList);
>     }
> ?>
>
> So... Cake creates the records to the user_usergroup join table OK,
> but it does not set the CREATED and MODIFIED field dates. Can someone
> give help with that?
>
> 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: PHP IDEs

2009-09-11 Thread Werschinger

I want to add to Kornelije's post that there's also free Komodo Edit,
which I use under Mac OS and like a lot. Some features I often use:
- snippets
- custom keyboard combinations
- split view (e.g. when editing two parts of a long file)

It is available for all major operating systems.

The IDE is much more powerful but also costly.

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



Validation in 1.2

2009-09-11 Thread Dave

For some reason this is not checking validation and is allowing me to
enter empty fields in both title and body.
Code for model/cont/view is below. I'm using cake 1.2.5
Any pointers would be muchly appreciated


// model
class Post extends AppModel {
var $name = 'Post';
var $validate = array(
'title' => array(
'required' => VALID_NOT_EMPTY,
'length' => array( 'rule' => 'validateLength', 'min'
=> 5, 'max' => 100 )
),
'body' => VALID_NOT_EMPTY
);
function validateLength($value, $params = array()) {
$valid = false;

$params = am(array(
'min' => null,
'max' => null,
), $params);

if (empty($params['min']) || empty($params['max'])) {
$valid = false;
} else if (strlen($value) >= $params['min'] && strlen($value)
<= $params['max']) {
$valid = true;
}

return $valid;
}
}

//controller

class PostsController extends AppController {
var $name = 'Posts';
function index() {
$this->set('posts', $this->Post->find('all'));
}
function view($id = null) {
$this->Post->id = $id;
$this->set('post', $this->Post->read());
}
function add() {
if (!empty($this->data)) {
// We don't do any real saving, we just validate the model

if ($this->Post->validates() && $this->Post->save($this-
>data)) {
$this->Session->setFlash('Your post
has been saved.');
$this->redirect(array('action' =>
'index'));
}
}
}
function delete($id) {
$this->Post->delete($id);
$this->Session->setFlash('The post with id: '.$id.'
has been deleted.');
$this->redirect(array('action'=>'index'));
}
function edit($id = null) {
$this->Post->id = $id;
if (empty($this->data)) {
$this->data = $this->Post->read();
} else {
if ($this->Post->save($this->data)) {
$this->Session->setFlash('Your post
has been updated.');
$this->redirect(array('action' =>
'index'));
}
}
}
}


// add view

Add Post
{javascript func=link url="/tiny_mce/tiny_mce.js" assign=""
__show_call=""}
{assign_assoc var='error' value='error=>Please specify a valid body'}
{form func='create' assign='' __show_call=false}
{form func=input fieldName=Title class="test" size="30" assign=""
__show_call=""}
{form func=label fieldName=Body  assign="" __show_call=""}
{form func=textarea fieldName=Body class="test" size="30" assign=""
__show_call="" error=$error}
{form func='submit' fieldName=Submit assign='' __show_call=false}
{form func='end' fieldName=Submit assign='' __show_call=false}


--~--~-~--~~~---~--~~
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: Hi CakePhp fans, paginator with a alias field.

2009-09-11 Thread Cosmin Paul

I found this:

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

Why it is not included in latest table version, have any idea ?


Thanks for the code !

On Thu, Sep 10, 2009 at 6:51 PM, grigri  wrote:
>
> Try this:
>
> class YourModel extends AppModel {
>  // ...
>
>  function hasField($name) {
>    if ($name === 'initial_monthly_payment') {
>      return true;
>    }
>    return parent::hasField($name);
>  }
>
>  function beforeFilter($query) {
>                if (!empty($query['order'])) {
>                        foreach($query['order'] as $i => $a) {
>                                if (!is_array($a)) {
>                                        continue;
>                                }
>                                foreach($a as $k => $v) {
>                                        $alias = $this->alias;
>                                        $field = $k;
>                                        if (strpos($field, '.') !== false) {
>                                                list($alias, $field) = 
> explode('.', $field, 2);
>                                        }
>                                        if ($alias == $this->alias && $field ==
> 'initial_monthly_payment') {
>                                                $query['order'][$i] = 'RAND()';
>                                        }
>                                }
>                        }
>                        return $query;
>                }
>  }
> }
>
> hth
> grigri
>
> On Sep 10, 2:36 pm, Cosmin Paul  wrote:
>> Because I use the query to mysql for some math.
>> CakePhp dose't let me use
>> $paginator->sort('Initial Monthly repayments','initial_monthly_payment');
>> 
>>    
>>     $initial_monthly_payment = MATH FORMULAS;
>>   .
>>  
>>     .
>>     .
>>     $initial_monthly_payment.'` as `initial_monthly_payment'
>>     .
>>     .
>>  
>> 
>>
>> I don't have 'initial_monthly_payment' as a field in the table.
>>
>> Haw can I fix this ?
>>
>> Thanks for the time!
> >
>



-- 
Paul-Cosmin Constandachi
Tel: 0723.46.46.42

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



Undefined index: id [CORE/cake/libs/model/model.php, line 1312]

2009-09-11 Thread Eduardo Romero

Hi folks I have an HABTM relation table with no id, Cake complains
when saving:

Undefined index:  id [CORE/cake/libs/model/model.php, line 1312]


The table looks like:

examenes_referencias
 referencia_id
 examen_id


I changed the line 1312 to this: http://bin.cakephp.org/saved/50559

No error after that. I couldn't figure out how to open a bug on trac,
nor I'm sure that is a "real" bug or that that's the best fix. But
it's a fix :)

Hope it helps. Adding id to the table fixes it too.

--~--~-~--~~~---~--~~
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: Cache Problem with safari 4

2009-09-11 Thread Martin Westin

I am not sure that is a cache problem or anything you can fix. Are you
sure

I use Safari 4 all the time and I am under the impression that the
browser sometimes doesn't do any request at all when using the back
button. It simply re-displays what it a few moments ago. I have not
checked if the browser technically does a request or not. It is just a
feeling I get.

/Martin


On Sep 11, 6:13 am, p_tucky  wrote:
> Hi, I have cache problem with safari 4.
> Any one have problem like me?
>
> I’ve tried with this code but does not work. It take me to the
> previous page and have still show the text on form.
>
> function beforeFilter()
> {
>
>if($this->action == ‘login’) {
>   $this->disableCache();
>}
>
> Header( “Last-Modified: ” . gmdate( “D, j M Y H:i:s” ) . ” GMT” );
> Header( “Expires: ” . gmdate( “D, j M Y H:i:s”, time() ) . ”
> GMT” );
> Header( “Cache-Control: no-store, no-cache, must-revalidate” );
>
> }
>
> FF and IE both don’t have any problem, when click “back button” and no
> cache.
> Safari 4 it seem still have cache when click “back button”.
>
> Any solution please advise.
> 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
-~--~~~~--~~--~--~---