vcalendar appended to multipart email as text/calendar MIME type

2014-02-24 Thread Brian Love
Hello,

Does anyone know if it is possible to attach a vcalendar via CakeEmail?  I 
have dug through the documentation and don't see a way to do this.  The 
vcalendar needs to be added as another part (as part of multipart email) to 
the email message body with the MIME content type of text/calendar.  Any 
suggestions would be helpful!

Thanks,
Brian

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Cake 2.0 - How to Specify a Primary Key

2013-01-08 Thread Brian QIS
Hello,

We're coming from a custom CMS, and our MySQL database naming convention is 
a bit different. So, if I have a table called "users" with a primary key of 
"users_id", how do I set my model to look for "users.users_id" as the 
record ID rather than "users.id?"

Thanks!

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Problem with controller redirect

2012-08-09 Thread Brian Allemana
Jeremy,

That was it! Thank you! The Cake Book says that beforeSave() does not take any 
arguments, otherwise I would have tried this. I shoulda checked the API to be 
sure.

Cheers,
-- 
Brian Allemana
web developer + consultant
773.320.4127
b...@brianallemana.com
web: http://www.brianallemana.com
vCard: http://www.brianallemana.com/vcf

On Aug 9, 2012, at 2:31 AM, Jeremy Burns | Class Outfit wrote:

> Not sure if the issue is the same, but I was getting issues with beforeSave() 
> on PHP 5.4.4. The beforeSave() function must have parameters set the same as 
> parent:beforeSave() - in other words public function beforeSave($options = 
> array()) {} - give that a try.
> 
> Jeremy Burns
> Class Outfit
> 
> http://www.classoutfit.com
> 
> On 9 Aug 2012, at 00:13:03, aquariman  wrote:
> 
>> One other point: I have a beforeSave() call in my model. When I disable that 
>> callback the redirect works fine. But even if all the callback does is 
>> return true, the problem noted below will occur.
>> 
>> With callback and no modification to Controller.php the redirect fails. With 
>> no callback and no modification to Controller.php the redirect works fine. 
>> With callback and some output sent within redirect() in Controller.php, the 
>> redirect works fine.
>> 
>> Odd.
>> 
>> On Wednesday, August 8, 2012 6:00:27 PM UTC-5, aquariman wrote:
>> Hello,
>> 
>> Cake 2.1.3. Here's what I've got in my controller:
>> 
>>  function company_info() {
>>  if ($this->request->is('post')) {
>>  if ($this->Business->save($this->request->data)) {  
>>  $this->redirect($this->request->here);
>>  } else {
>>  $this->raiseWarning('Your information could not 
>> be saved');
>>  }
>>  }
>>  }
>> 
>> Problem is, when Cake gets to $this->redirect() it craps out, causing no 
>> output and no redirect (blank screen). Logs show me nothing. However, very 
>> weirdly, if I go to the redirect() method in /lib/Cake/Controller.php and 
>> make the following change at line 788:
>> 
>> if ($exit) {
>>  $this->response->send();
>> echo 'some random text';
>>  $this->_stop();
>> }
>> 
>> Then it works!! ??? How is it that adding output here makes the redirect 
>> work properly? Is this a bug?
>> 
>> Any help appreciated. Best,
>> -Brian
>> 
>> -- 
>> 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.
>> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>>  
>>  
> 
> 
> -- 
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>  
>  

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: self join and HABTM relation

2012-04-06 Thread Brian Bowler
What have you tried so far?

On Fri, Apr 6, 2012 at 5:10 AM, Reza Talamkhani
wrote:

> Hi
> I need to create a 'posts' table in db and show related posts to users...
> need to self join and HABTM (hasAndBelongsToMany) relation...
> please help me
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


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


Re: redirecting problem

2012-04-02 Thread Brian Bowler
Litto some more information would help, is it redirecting to a blank page
instead of redirecting?

On Mon, Apr 2, 2012 at 9:15 AM, Mike Griffin  wrote:

> On Fri, Mar 30, 2012 at 09:42, LITTO CHACKO  wrote:
> > hai guys, i have to met with other problem.. the problem is that whwn
> > i tried to submit a form  it saves all data nad when it is asked
> > to redirect after saving it..it doesn't work???
> >
> >  if ($this->Email->send()) {
> >
> >   $this-
> >>redirect('/seller/message/');
> >   }
> > }
> >
> > it will enter this loop..but after that it is not performing the
> > redirection action?? why??
> >
>
> Is the command spread over two lines like in the email?
>
> How do you know it is going into that loop? Did you try removing "if
> ($this->Email->send()) {" and just testing the redirect on its own?
>
> Is there a path at /seller/message?
>
> You could try changing the redirect line to something like
> $this->redirect(array('controller' => 'sellers', 'action' => 'message'));
>
> Are there any checks in the "message" action that might be redirecting
> back to where it came from?
>
> Mike.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


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


Re: Database configuration problem

2012-03-27 Thread Brian Bowler
That usually means that you didn't close out one of your brackets or
something. Can you post the code (sensitive details omitted)?

On Tue, Mar 27, 2012 at 9:27 AM, AKinwunmi Damilare  wrote:

> Yes it helped. Thanks. But its giving an error saying expecting
> T_function in one of the lines. Pls, help. Thanks
>
> On Mar 27, 12:57 pm, vaughany  wrote:
> > This may be of some use:
> >
> > http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/blog.html#...
> >
> >
> >
> >
> >
> >
> >
> > On Tuesday, 27 March 2012 12:11:03 UTC+1, AKinwunmi Damilare wrote:
> >
> > > Please, i need help in the cakephp database configuration. Thanks
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


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


Re: How do I redirect?

2012-03-19 Thread Brian Bowler
Please do I have the exact same problem and would like to know if you get
this fixed.

On Mon, Mar 19, 2012 at 10:56 AM, glevine  wrote:

> Right, so in the example I was mainly just wanting to show that I was
> reaching those points in the code. Theoretically, if I remove the "print
> 'before redirect';" statement then I should never see "after redirect" but
> I should see "in the index" upon the new page load (since that is post
> redirect).
>
> For some reason, I was still unable to redirect when I wasn't printing to
> the screen before the call to exit. However, I may have just been tired and
> didn't realize I still had a print before exit. So I'll try again and
> respond back with the results.
>
> Thanks
>
>
> On Monday, March 19, 2012 7:56:28 AM UTC-4, euromark wrote:
>>
>> no you can't! or: you really shoudn't
>> you should simply do everything before redirecting.
>>
>> theoretically, you can manually call exit() if you set the exit param to
>> false on redirect.
>> but to me this makes no sense.
>>
>>
>> >> can we do some process after redirect.
>>
>>   --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


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


Re: $this->redirect not working

2012-03-11 Thread Brian Bowler
@Geore, I have tried taking it out and what happens is that it goes to the
'/formulas/instructions/' page minus the ID variables. I assume this
happens because this is happening because of POST. I either want to
redirect to a different page such as 'formulas/manage' (for example) or
redirect to '/formulas/instructions/78' (for example) so that the users
aren't confused. However what happens is that it gets redirected to a blank
page and when I view the page's source it also comes up blank. If I through
a debug in there it shows up with a blank page with the output of a debug
on it.

@Romel and @Vijay, same thing happens it just comes up completely blank.


On Sun, Mar 11, 2012 at 12:01 AM, romel javier gomez herrera <
bmxquiksilver7...@gmail.com> wrote:

> try with this  $this->redirect($this->referer());
>
>
> El 10 de marzo de 2012 21:24, Brian Bowler  escribió:
>
>> So I have this function where the user can add the weight to materials
>> and save them. However after the updateAll, $this->redirect doesn't work at
>> all and the result shows up with a blank page with nothing in the source.
>> In an ideal world I would have it redirect to a different page but at a
>> minimum I would like it to go back to the page where they entered in the
>> weights.
>>
>>   public function instructions($id = null) {
>> $instructions = $this->Formula->findFormula($id);
>> $count = count($instructions);
>> $this->set(array('instructions' => $instructions, 'count' =>
>> $count, 'formulaId' => $id));
>> if(!empty($this->data)) {
>> $count = count($this->request->data);
>> for($i = 0; $i <= $count; $i++) {
>> $this->Formula->updateAll(
>> array('Formula.weight' =>
>> $this->request->data['Formula'][$i]['weight']),
>> array('Formula.id' =>
>> $this->request->data['Formula'][$i]['id'])
>> );
>> }
>> }
>> $this->redirect(array('controller' => 'instructions', 'action' =>
>> 'instructions', $id));
>> }
>>
>> I have no idea what causes this. Any help is much appreciated, even if
>> its just telling me where in the manual to read up on it.
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


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


$this->redirect not working

2012-03-10 Thread Brian Bowler
So I have this function where the user can add the weight to materials and
save them. However after the updateAll, $this->redirect doesn't work at all
and the result shows up with a blank page with nothing in the source. In an
ideal world I would have it redirect to a different page but at a minimum I
would like it to go back to the page where they entered in the weights.

  public function instructions($id = null) {
$instructions = $this->Formula->findFormula($id);
$count = count($instructions);
$this->set(array('instructions' => $instructions, 'count' =>
$count, 'formulaId' => $id));
if(!empty($this->data)) {
$count = count($this->request->data);
for($i = 0; $i <= $count; $i++) {
$this->Formula->updateAll(
array('Formula.weight' =>
$this->request->data['Formula'][$i]['weight']),
array('Formula.id' =>
$this->request->data['Formula'][$i]['id'])
);
}
}
$this->redirect(array('controller' => 'instructions', 'action' =>
'instructions', $id));
}

I have no idea what causes this. Any help is much appreciated, even if its
just telling me where in the manual to read up on it.

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


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


Record-level permissions with ACL in CakePHP 2.0

2012-01-25 Thread Brian
I'm working on the authorization system for my web app. I began
researching various ACL guides back during 1.3, but never found one
that really clicked in my head. I've read the Cookbook tutorials, the
Permissionable behavior, SuperAuth on github, etc trying to find a
record-level auth solution that I understand well.

In the end I left the app to behave like the tutorial (e.g. Aragorn
can have Read access to all Weapons, but there's no way to grant him
access just to a single Weapon like a Sword). This was a compromise,
though, and what I really need is a way to grant permissions on
specific instances of a Model.

Now that CakePHP 2.0 has been released and I've upgraded my app, I'd
like to try tackling this problem again. Are there any resources that
address this kind of ACL for 2.0? Is this already possible and I just
haven't realized it yet?

Thanks for your help.

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


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


Problem with validation

2011-07-11 Thread Brian Lin
I'm experiencing my controller validating data even though the model
has set a $validate array.

I have two different controllers and models, A and B.

So in controllerA, i have a $uses = modelB.
Also I have a viewA function that adds data into tableB using $this-
>ModelB->saveAll($this->data)
In modelB, I have a $validate table that corresponds with the
individual fields in the tableA/form.
Also in viewA, i have a form that is corresponds to the model of B.
However it always saves into tableB even when I put in bad data that
should not validate.

Then I tried using the exact same code in controllerB and started
showing the individual validation messages for the form.

Can anyone explain why this happens?

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


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


Re: nocache breaks when used in loop

2011-04-17 Thread Brian Sweeney
On Sat, Apr 16, 2011 at 1:47 PM, cricket  wrote:

> On Fri, Apr 15, 2011 at 3:37 PM, Brian Sweeney 
> wrote:
> > On Fri, Apr 15, 2011 at 2:47 PM, cricket  wrote:
> >>
> >> What the heck is this?!
> >> echo ""; ?>
> >
> > Oh, and I just wanted to say that I was pretty sure this little snippet
> > would get that kind of reaction. Nice to know that you care enough to
> point
> > out the insanity of it all ;)
>
> Shouldn't it at least have the first one escaped?
> echo "";
>

You are correct. A typo on my part.


> Not that I'm encouraging this sort of thing. ;-)
>

Of course not! ;)


> For the example given, a general product list, another solution would
> be to go with full on view caching and use javascript to read the
> cart's product ids and change a class on each product's element block.
> Given that a flag like this is rather non-critical I don't see any
> harm in having (potentially disabled) JS handle it.
>

I have considered this as a solution, it would make the view much easier to
handle. I try to avoid JS-only solutions for general-purpose web sites if
possible. I may still go this route, but I wanted to explore the possibility
of caching with the server-generated user content a little bit more.

If the list of products were solely the contents of the cart, OTOH,
> the best answer would be no caching at all.


> I can't suggest more than that, though, without a clearer
> understanding of your specific views.


The page is more like a list of all products in a category, with an
add-to-cart option next to it. This is a convenience feature. The user can
also add an item to their cart from the item detail page.

I have another page that lists the items in the cart and this page is not
cached.

I think the discussion has given me enough food for thought. I've already
made some significant improvements on the site that help with the
responsiveness. The controller data caching has helped. And I found that
none of the content had expires headers (yikes).

Speaking of expires headers ... if a view is cached does cake return an
expires header for it? The content does have an expiration so it seems like
this would be plausible.

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


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


Re: nocache breaks when used in loop

2011-04-15 Thread Brian Sweeney
On Fri, Apr 15, 2011 at 2:47 PM, cricket  wrote:

> What the heck is this?!
> echo ""; ?>
>

Oh, and I just wanted to say that I was pretty sure this little snippet
would get that kind of reaction. Nice to know that you care enough to point
out the insanity of it all ;)

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


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


Re: nocache breaks when used in loop

2011-04-15 Thread Brian Sweeney
On Fri, Apr 15, 2011 at 2:47 PM, cricket  wrote:

>  > But yes, this is how I'm passing variables to
> > the view. Except in some of the non-cached code where I'm using
> > requestAction() to get data I need.
>
> But requestAction() is a horrible performance hog so hopefully you'll
> get all of this sorted out enough where you no longer (think you) need
> it.
>

I'm only planning to use this if I intend to actually implement view
caching. I could probably get away with storing the information retrieved by
requestAction() in the user session, which is probably how I should consider
utilizing it. Currently I'm only caching some data from the controller using
the Cache component, which helps. But I see a significant performance
increase if the view is cached as well.


>  >>
> >> It's more to do with how the loop is being parsed. Put the nocache
> >> tags outside of the loop.
> >
> > I'd like to place the nocache tags around the whole loop, but this is
> where
> > my simplified example breaks down. The loop contains both cacheable and
> > non-cacheable content. I guess a good analogy to my page would be a
> product
> > list where next to each product is an icon indicating whether or not
> you've
> > placed it in your cart. So my loop actually looks closer to this (again,
> > somewhat simplified):
> >
> >  > echo '';
> > foreach ($products as $product) {
> >   echo '', $product['Product']['name'] , '';
> >   echo (in_array($product['Product']['id'], $user_cart_items) ? 'Yes' :
> > 'No');
> >   echo '';
> > }
> > echo '';
> > ?>
> >
> > So what I want to do is place the nocache tags around the Yes/No echo
> inside
> > the foreach loop. As I mentioned in an earlier email I was able to work
> > around my particular issue by using page elements. I'm also working
> around
> > one of the limitations in view caching by echoing out some PHP code so
> that
> > I can pass the current product id to my page component. So a functional
> > caching example based using the code from above would look like this:
> >
> >  > echo '';
> > foreach ($products as $product) {
> >   echo '', $product['Product']['name'] , '';
> >   $product_id = $product['Product']['id'];
> >   echo ""; ?> >   echo $this->element('cart-control', array('product_id' => $item_id,
> > 'user_cart_items' => $user_cart_items)); ?> >   echo '';
> > }
> > echo '';
>
> What the heck is this?!
> echo ""; ?>
>
> I think you should maybe consider not caching this view. That might be
> simplest.
>

As I said, this works around the limitation of not having access to
controller-set variables when the view is cached. It's actually quite like
using  ... just a bit of a hack around how cake actually does
things. Maybe a bit ugly, but what it does is not much different from what
 does. Kind of an extension of the caching mechanism. Adding this
little bit of hackery and enabling view caching can save quite a bit of
processing time.

Perhaps the "cake" way of doing this (and it just hit me) would be to use
the Cache controller/helper to store/retrieve the necessary data. I like my
way, even if it is ugly. It creates in the cached view everything that is
needed to render the page.

But yes, right now caching data and not caching the view is certainly the
simplest solution.


> > $user_cart_items is instantiated at the top of the page in a nocache
> block.
> > Ugly and confusing, yes? But it works. ;)
> >
> > Since I do have some code that works with the loop, the discussion is
> mostly
> > academic as far as that problem is concerned.
>
> If it's academic, I'm afraid I'd have to give you a D. Your
> interpretation of how view caching *should* work is not realistic.
>

I don't think that's a fair assessment. Maybe I get a D in my understanding
of the mechanics of how cake does caching. But I think my expectations of
view caching are entirely realistic. In fact, I have been able to achieve
what I expected of cake in regards to what's put in the cached file. I just
had to go about it in a less direct way (via page elements rather than code
actually on the page).

And the fact that I know enough to be able to hack around the
limitations/problems should give me some credit. So maybe a C+ ;)

There's likely a better way to go about this, but I'm a one-man shop so I
don't have days/weeks to experiment while other work piles up. This is the
only reason its academic.

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


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


Re: nocache breaks when used in loop

2011-04-15 Thread Brian Sweeney
On Thu, Apr 14, 2011 at 2:49 PM, cricket  wrote:

> On Thu, Apr 14, 2011 at 11:00 AM, Brian Sweeney 
> wrote:
> > I think even though some of the content is state-sensitive the page could
> > still benefit from view caching. It does present some difficulties,
> though,
> > which is why I'm here.
> >
> > But even if I take out the state-sensitive aspects of the page I'm still
> > running into user-specific inconsistencies in the cached view. The worst
> > example is if I access the page initially as an admin vs. normal user.
> The
> > cached page is completely broken in the latter case, but works fine in
> the
> > former.
>
> 
>  if ( (bool) $this->Session->read('Auth.User.admin') )
> {
>echo $this->element('comments/list_admin');
> }
> else
> {
>echo $this->element('comments/list');
> }
> ?>
> 
>
...

>  > But can I access, for example, the authentication component? I pass
> along
> > the instantiation to the view (i.e. $this->set('Auth', $this->Auth)) so
> that
> > I can display some restricted content inline on the page.
>
> When a user logs in, Auth saves the User record to the session with
> the key Auth.User. In a controller, you access this with:
>
> $this->Auth->user('field_name')
>
> In a view:
>
> $this->Session->read('Auth.User.field_name')
>
> To check whether the user is logged in:
>
> if ($this->Session->read('Auth.User.id <http://auth.user.id/>')) { }
>

This might help with one of the problems I've been facing. I'll give it a
try.

> Sorry, I meant component-instantiated variables. Though, as I mentioned
> > above, I'm also doing some things with the auth component in the view.
> > Should I be accessing this information by another means?
>
> Variables to be handed to the view are set() in the controller. In a
> component:
>
> $this->Controller->set('foo', 'bar');
>
> Assuming your component has something like:
>
> public $Controller;
>
> function startup(&Controller)
> {
>$this->Controller = $Controller;
> }
>

I don't have anything like the startup function (I assume that's part of the
default controller class?). But yes, this is how I'm passing variables to
the view. Except in some of the non-cached code where I'm using
requestAction() to get data I need.


> > Perhaps. I'd like to know more about the caching process, though, so I
> have
> > a better feel for what's possible and what's not. This seems like a bug
> to
> > me because the nocache content is being cached after the first iteration.
> > But I realize it could also just be a limitation of how the document is
> > parsed.
>
> It's more to do with how the loop is being parsed. Put the nocache
> tags outside of the loop.
>

I'd like to place the nocache tags around the whole loop, but this is where
my simplified example breaks down. The loop contains both cacheable and
non-cacheable content. I guess a good analogy to my page would be a product
list where next to each product is an icon indicating whether or not you've
placed it in your cart. So my loop actually looks closer to this (again,
somewhat simplified):

';
foreach ($products as $product) {
  echo '', $product['Product']['name'] , '';
  echo (in_array($product['Product']['id'], $user_cart_items) ? 'Yes' :
'No');
  echo '';
}
echo '';
?>

So what I want to do is place the nocache tags around the Yes/No echo inside
the foreach loop. As I mentioned in an earlier email I was able to work
around my particular issue by using page elements. I'm also working around
one of the limitations in view caching by echoing out some PHP code so that
I can pass the current product id to my page component. So a functional
caching example based using the code from above would look like this:

';
foreach ($products as $product) {
  echo '', $product['Product']['name'] , '';
  $product_id = $product['Product']['id'];
  echo ""; ?>element('cart-control', array('product_id' => $item_id,
'user_cart_items' => $user_cart_items)); ?>';
}
echo '';

$user_cart_items is instantiated at the top of the page in a nocache block.
Ugly and confusing, yes? But it works. ;)

Since I do have some code that works with the loop, the discussion is mostly
academic as far as that problem is concerned.


>  >>
> http://nuts-and-bolts-of-cakephp.com/

Re: nocache breaks when used in loop

2011-04-14 Thread Brian Sweeney
On Thu, Apr 14, 2011 at 2:11 AM, cricket  wrote:

> On Wed, Apr 13, 2011 at 11:37 PM, Brian Sweeney 
> wrote:
>
>  > I have a view that's fairly computationally expensive (lots of
> table-formatted data).
> > To speed up the page load I'm trying to use view caching.
>
> Cached views bypass the controller[1], so if your content (the html)
> depends on state-sensitive data it may not be your answer. Like
> francky said, you probably could be using elements with caching
> disabled, or even given alternative cache options than the action
> itself has.
>

I think even though some of the content is state-sensitive the page could
still benefit from view caching. It does present some difficulties, though,
which is why I'm here.

But even if I take out the state-sensitive aspects of the page I'm still
running into user-specific inconsistencies in the cached view. The worst
example is if I access the page initially as an admin vs. normal user. The
cached page is completely broken in the latter case, but works fine in the
former.


>  > A problem which appears to be a bug to me.
>
> It's a bug in your view. To Cake and PHP, it's a gotcha.
>

Perhaps. I'd like to know more about the caching process, though, so I have
a better feel for what's possible and what's not. This seems like a bug to
me because the nocache content is being cached after the first iteration.
But I realize it could also just be a limitation of how the document is
parsed.


>  > which includes user authentication and user-specific inline content I'm
> getting
> > varied results.
>
> You can access the Session from an (uncached) element.
>

But can I access, for example, the authentication component? I pass along
the instantiation to the view (i.e. $this->set('Auth', $this->Auth)) so that
I can display some restricted content inline on the page.

Perhaps this is something I should be looking at admin routing for? I
haven't really looked into that functionality yet.


>  > I'm also hacking around the inability to use component-instantiated
> > components by echoing out some PHP code.
>
> Components are for Controllers and other Components, not Views. Use a
> Helper.
>

Sorry, I meant component-instantiated variables. Though, as I mentioned
above, I'm also doing some things with the auth component in the view.
Should I be accessing this information by another means?


>  > If anyone's interested in more details about what problems I'm having
> and
> > how I'm attempting to work around them I'd be more than happy to share a
> less
> > simplistic example.
>
> A more realistic example would help in coming up with a solution. You
> don't need to paste the entire view, just broad strokes or a snippet
> or two.
>

I'll be back later today with some more concrete examples. I'm going to hack
at it a little more this morning and see what comes of things.


> [1] But see here:
>
> http://nuts-and-bolts-of-cakephp.com/2011/02/05/make-your-cakephp-app-ridiculously-faster-with-view-caching/
>

One of my first find when I started doing this ;)

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


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


Re: nocache breaks when used in loop

2011-04-13 Thread Brian Sweeney
Thanks for pondering the issue a bit more. If there's any details you think
might help let me know. I didn't want to bog down the original post with too
much detail, hoping somebody might have run into the problem in the past.
But I don't mind detailing what's going on and how I'm trying to work around
it.


On Wed, Apr 13, 2011 at 11:08 PM, cricket  wrote:

> On Wed, Apr 13, 2011 at 9:30 PM, BrianS  wrote:
> > On Wednesday, April 13, 2011 8:58:32 PM UTC-4, cricket wrote:
> >>
> >> On Wed, Apr 13, 2011 at 8:57 PM, BrianS  wrote:
> >> > Except that it doesn't help me at all :(
> >>
> >> And that reply doesn't help us help you. More info please.
> >
> > I realize this, and I was in the process of a response to your post. I
> just
> > wanted to point out that just because a problem seems easy doesn't mean
> it
> > is. And though your response ultimately didn't help I appreciate the
> effort.
> > However, euromark's response added nothing at all ... my comment was more
> > directed to him, though I guess I was a bit harsh in how I referenced
> your
> > answer.
> > So don't get me wrong. I truly appreciate you taking the time to respond.
> > You can chock up my curtness to being tired, cranky, and frustrated.
>
> Hey, no sweat. Been there. And my reply wasn't meant to be sassy but I
> can see that it could be taken that way.
>
> I'm still thinking about your problem.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


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


Re: nocache breaks when used in loop

2011-04-13 Thread Brian Sweeney
Thanks for the thoughts. This is what I was planning to try tomorrow.
There's a lot going on in the controller so I figure caching that much would
be better than nothing. I'd still like to get the view cached at some point,
but with all the problems I've been having I'm not sure I'm going to get
there.

Avoiding requestAction would be nice, but I'm going to need it if I ever
actually get view caching to work correctly. I've been able to minimize the
impact somewhat compared to my initial foray (i.e., use a more general
requestAction at the top ... not a specific one in each page element).


On Wed, Apr 13, 2011 at 9:48 PM, francky06l  wrote:

> In case of expensive Db request or computation, to me the best is to
> cache the Data needed to your view or element instead of the view
> itself. If the cache is expired I do not hesitate to make a
> requestAction (devil word), but a requestAction with results being
> cached every X few minutes can be acceptable .. I also did some
> actions that delete the "potential" cached files when data are
> modified, so you can have a cached life time 1 year, and when you
> modify the data, cached is destroyed then rebuilt by the first
> requestAction  until next update to data ...
>
>
>
> On Apr 14, 3:17 am, BrianS  wrote:
> > On Wednesday, April 13, 2011 7:40:45 PM UTC-4, cricket wrote:
> >
> > > 
> > >  > > for ($i = 0; $i < 10; $i++) {
> > > echo "foo";
> > > }
> > > ?>
> > > 
> >
> > Thanks, but this doesn't help much. As I said, the page I'm generating is
> > fairly expensive computationally. Rather than get into the details of the
> > view structure and where it's breaking down I provided a simplified
> example
> > to illustrate the problem. A problem which appears to be a bug to me. But
> > maybe I have a misunderstanding about how cake is creating the caching
> file.
> >
> > Actually, I'm finding the caching functionality to be both cumbersome and
> > buggy. I imagine it works best on a very simple CMS-style site. On my
> site,
> > however, which includes user authentication and user-specific inline
> content
> > I'm getting varied results.
> >
> > I've been able to work around my specific issue by using a page element
> with
> > nocache content. This content from this page element is appropriately
> placed
> > as inline PHP in the cache file. I'm also hacking around the inability to
> > use component-instantiated components by echoing out some PHP code. If
> > anyone's interested in more details about what problems I'm having and
> how
> > I'm attempting to work around them I'd be more than happy to share a less
> > simplistic example.
> >
> > FYI, I'm using 1.2.9. Are there significant improvements in 1.3? I won't
> be
> > able to switch immediately, but I have been considering it. The need for
> > caching, however, is fairly pressing.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

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


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


Re: different pagination across views (not controllers)

2011-01-11 Thread Brian Mckphee
I found my own answer.  To anyone who needs this see the following.

In your function in the controller that you would like to have the
custom order on do this

$this->paginate = array('order' => 'yourModel.yourColumn DESC');
$data = $this->paginate('YourModel', array('yourColumn' =>
'condition'));

On Jan 11, 11:07 am, Devario Johnson  wrote:
> Hi, im sure this is a simple question but i can't find any docs
> related to this...
>
> I have multiple views coming from one controller (as normal)
>
> I would like to paginate them differently in each view.
>
> say view a, b, and c, are paginated ASC and view d, and e, are
> paginated DESC
>
> I have in my controller at the top the var $paginate with order
> defined.
>
> this seems to effect ALL uses of the $this->paginate across any views
> associated with the controller.
>
> How do I get them to act independently?
>
> I already tried removing it from the top and adding it in each
> function but that didnt work.
> I also tried adding 'order' to the actual paginate (find) query and
> that does not work either...
>
> any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Clueless...Help please

2011-01-11 Thread Brian Mckphee
I agree with the last few posters.  You may need to tell your client
to look at their code.  Are you merely a hosting provider or are you a
coder?

On Jan 10, 8:13 am, javier0051  wrote:
> Hi
>
> I am a completely newbie to cake php. A new customer has a site
> developed with cake php and we recently moved the site to one of our
> boxes but we haven't been able to show all the page's content. No
> errors, the news & articles and other stuff are actually in the
> database BUT no contents are displayed. (site's main page:www.acepweb.org.ar
> Undisplayed contents example url (http://www.acepweb.org.ar/c/noticias/
> ultimas-noticias)
>
> The problem comes when trying to access one of the interior sections.
> The contents are in the database, the routing.php file has this line
> "(Router::connect('/c/:categoria/:subcategoria', array('controller' =>
> 'categories', 'action' => 'view', 'categoria' => null, 'subcategoria'
> => null));)" directing to some /c/ folder or whatever it is but it is
> not physically present.
>
> The connection to the db is established propperly but at this point I
> am totally clueless on how to get that example page to display the
> contents it used to display when hosted on the other box, with same
> cPanel, same linux operating system.
>
> Thank you .Help will be totally appreciated

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: CakePHP 1.3 setup on Ubuntu

2010-08-25 Thread The Brian Martin
What does your .htaccess look like?




On Aug 24, 12:22 pm, david  wrote:
> First, let me say I have CakePHP up and running perfectly on windows
> with a wampserver instance running, so I'm familiar with the process.
> I know how to get mod_rewrite setup, and set the permissions
> appropriately, etc.
>
> So, I just installed Ubuntu server 10.04 / Apache 2 / MySQL / PHP, and
> I'm now trying to get CakePHP setup. I've seen plenty of posts
> outlining getting setup on Ubuntu, because the debian arrangement of
> Apache config files can be confusing to those not familiar with it.
> I've used Debian for a long time, so I'm good on that front.
>
> Basically, my problem is the 404 error for cake.generic.css and
> cake.power.gif, which everyone says is caused by a mod_rewrite
> problem. I have tested mod_rewrite separately and it works fine, so I
> know it's running and working.
>
> I've tried the following in my sites-enabled (basically a snippet of
> what would be part of httpd.conf on most other systems):
>
>         DocumentRoot /var/www/cakephp
>         
>                 Options FollowSymLinks
>                 AllowOverride All
>                 allow from all
>         
>         
>                 Options Indexes FollowSymLinks MultiViews
>                 AllowOverride All
>                 Order allow,deny
>                 allow from all
>         
>
> I've changed the directories to /var/www; I've recursively changed the
> owner of /var/www to www-data and set permissions to 755, and
> recursively set 777 to app/tmp.
>
> I'm a bit stumped and have no idea why it's not working. Any thoughts?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


HtmlHelper within Helper causes sql_dump.ctp to fail.

2010-05-30 Thread Brian Jones
Hello,

I have a quirky problem which I just noticed while preparing to
optimize the application my team is building.  I haven't set the debug
value within config/core.php to "2" in a couple weeks to look at the
SQL output, and noticed today that it was completely broken.  After
tinkering around a little, it seems that by using "var $helpers =
array('Html');" within MyHelper so that we have access to $this->Html
methods, it causes cake/libs/views/elements/sql_dump.ctp to completely
fail, and I am not entirely clear why.

My team hasn't altered any of the core CakePHP 1.3 library files, and
pages where we aren't using MyHelper render the sql_dump.ctp output
just fine.  Has anyone experienced this before?  I plan on spending a
little time to troubleshoot this more, but am checking with the list
with the hope that it's something simple that I have overlooked.



Brian Jones
brian.jo...@istpika.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Duplicate Queries 1.2.6 - 1.2.7

2010-05-04 Thread Brian Watson
I have an original app built on 1.2.6 and simply edited my webroot/index.php to 
pull the site using the 1.2.7 lib on the server. Everything works fine except I 
noticed extra queries.

Exactly 4 additional queries happen on 1.2.7 and they are the exact same 
queries to the session table.

I did a quick note of queries for various pages on 1.2.6 and then 1.2.7 and its 
the same on every page.4 Extra session queries. Anyone else seeing this?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Version 1.3 Routing & Vanity URLs

2010-05-04 Thread Brian Watson

Did anyone find a solution to this as I have the exact same problem.

Thanks
- Original Message - 
From: "CharlesTMunger" 

To: "CakePHP" 
Sent: Monday, May 03, 2010 2:01 AM
Subject: Version 1.3 Routing & Vanity URLs



In my 1.2x app I have vanity URLs from the base.  I.e., a user named
"munger" can have his page located at:

www.mysite.com/munger

Accomplishing this was pretty straightforward -- in my routes.php I
had this line at the end:

Router::connect('(?!admin|users|posts)(.*)', array('controller'=>'users', 
'action'=>'view'));


Then, in the view method of my users_controller, I simply did a find
based on user name. I tried upgrading to 1.3 and this doesn't work
anymore  -- I assume it has something to do with not supporting regex
anymore.

So -- any ideas on how to go about accomplishing this in 1.3?

Check out the new CakePHP Questions site http://cakeqs.org and help others 
with their CakePHP related questions.


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 


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: custom controller actions linking 2 datasets by datafield?

2010-03-27 Thread brian
If the Order & Customer associations re good then you can grab the
latter's data through the former model, eg.
$this->Order->Customer->whatever()

You can make the route however you want. It could also just be
"/orders/add/:customer_id", for example.

Router::connect(
'/orders/new/:customer_id',
array('controller' => 'orders', 'action' => 'add'),
array('customer_id' => '[0-9]+', 'pass' => array('customer_id'))
);


The add() method doesn't normally take a param but it's easy to do so.

function add($customer_id = null)
{
if (!empty($this->data))
{
...

if ($this->Order->save($this->data))
{
...
}
}

/* prepare to show form
 */
if (!empty($customer_id))
{
$this->data = $this->Order->Customer->read(null, $customer_id);
}
}


view:

debug($this->data); // to check that it worked

echo $form->hidden('Customer.id');
echo $form->input('Customer.first_name');
...

On Sat, Mar 27, 2010 at 5:20 AM, mivogt-LU  wrote:
> Hello again, as usual I use the weekend to ask what the week collected
> me working with cake...
>
> In my app I have several models and all works fine so far.
> i.e. I have a customer model and an order model
>
> I am able to use the baked add funtion to add customers and orders
> as the order has a customer_id field I am able to select the customer
> the order should be done for.
>
> Now I would like to have a button next to the customer in the customer-
> list (index view) to quick-start a new order having the customer field
> already filled with the customer_id from the selected custome.
>
> As far as I understood, it has to be done a new action inside the
> customer controller
> i.e. customerDoNewOrder() that is calling the order-controller action
> baked as add-action.
>
> My problems are I have no idea how to start adding a new button in the
> index view and how to do the transfer of information between the 2
> models; mean getting the customer_id from the indexview and calling
> the order_add_action from order controller to get a prefilled
> order_add_view.
>
> Any hints and code a realy welcome. Thanks in advance for all you
> might give me.
>
> CU
>
> Michael
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> 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
>
> To unsubscribe from this group, send email to 
> cake-php+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Pagination question

2010-03-11 Thread Brian Allemana

Hello everyone,

My first post to this list. I've been digging the conversation here.  
Glad to know there's a healthy support community around Cake.


I have a situation where I have a somewhat elaborate routing scheme  
for fetching a list of products. I'd like to be able to paginate this  
list and have indeed got everything working that I need on the actual  
pagination processing. What's missing is the ability to pass the page  
number to my Products controller. None of my intuitive attempts at  
making this work have succeeded. I'm on Cake 1.2.


Example: Let's say I want a list of all products of size Junior and  
category Apparel. The URL would look something like:


http://mysite.com/ps-junior/c-apparel

My route will then hand off the appropriate args to my controller.  
However, if I add a page number, viz:


http://mysite.com/ps-junior/c-apparel/page:2

I still get only the first page. So...is there a way to set the page  
number, say, from within the controller? I can't access the  
$paginator object (I think), so maybe I can set a value within the  
$paginate property of the controller?


Here's my route declaration for reference:

// routes for product listing views -- flexible enough to handle  
leaving out any args

Router::connect(
		'/:type/:category/:product_size_category/:product_size/:color/:gender/ 
:vendor/:date/:page',

array(
			'controller' => 'products', 'action' => 'index', 'type' => null,  
'category' => null,
			'product_size_category' => null, 'product_size' => null, 'color'  
=> null,

'gender' => null, 'vendor' => null, 'date' => null, 'page' 
=> null
),
array(
			'pass' => array('type', 'category', 'product_size_category',  
'product_size',

'color', 'gender', 
'vendor', 'date', 'page'),
'type' => 'designers|whats-new|sale',
'category' => 'c-[a-zA-Z0-9&%\{\}_-]+',
'product_size_category' => 'psc-[a-zA-Z0-9\{\}_-]+',
'product_size' => 'ps-[a-zA-Z0-9\{\}_-]+',
'color' => 'cl-[a-zA-Z0-9\{\}_-]+',
'gender' => 'for-[a-zA-Z0-9_-]+',
'vendor' => 'v-[a-zA-Z0-9\{\}_-]+',
'date' => '\d\d\d\d-\d\d-\d\d',
'page' => 'page:\d+'
)
);

Can anyone shed some light?

Many thanks,
-Brian

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Initial loading of Cake problem: Trying to get property of non-object in ...

2010-03-09 Thread Brian
Hi, I am just starting to load & learn Cake, and I believe that I've
followed the correct process to get started, but I'm running into a
fatal error. I've loaded CakePHP 1.3.0, Apache 2.2, PHP 5.3. After I
load Cake into the Apache htdocs folder, change the folder name to
"first_app", and then try to run it ("http:\localhost\first_app", I
get this error message that I don't know what to do with. Has anybody
run into this before? I'm on a Windows Vista 64 bit machine. I've not
changed anything so far as I know, and I get the same problem with
Cake 1.2.6.

Notice: Trying to get property of non-object in C:\Program Files
(x86)\Apache Software Foundation\Apache2.2\htdocs\first_app\cake\libs
\cache\file.php on line 252

Fatal error: Call to a member function cd() on a non-object in C:
\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs
\first_app\cake\libs\cache\file.php on line 252

Thoughts?

Brian

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 can't list my files from the uploads folder (when app is online). Everything works local.

2010-02-23 Thread brian
Check your error logs and make sure debug is set to 2 (the action that
fetches the view probably sets it to 0 if it's an ajax call).

On Tue, Feb 23, 2010 at 1:17 PM, mattyh88  wrote:
> I work with TinyMCE in my CakeApp.
> When I press the image icon, it shows the image window.
> I've added a browse button. (like in the tutorial:
> http://bakery.cakephp.org/articles/view/adding-a-tinymce-image-browser-the-cakephp-way)
>
> All of this works perfectly local.
> But when I upload it to my webserver, images/index (that's the page
> that should show after clicking the browse button) just shows a blank
> page. No html tags at all (when clicking "view source" in my browser)
>
> What could be causing this?
>
> Thank you,
> mattyh88
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> 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
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: looking for developer (Were based in Cleveland, Ohio)

2010-01-28 Thread brian
So you're looking to hire a coder for free? Programmers are small
businesses, too.

On Thu, Jan 28, 2010 at 8:24 AM, Andrew  wrote:
> There are a few things we would do to make it worth while for the
> developer. You would be part of something that has the ability to do
> real good by organizing specific data in the world and making a
> platform that allows many small businesses to benefit from one
> another. Also, you would receive credit on the site as part of the
> development team with a link pointing to your respective websites. The
> site will be seen by thousands of small to medium size businesses. A
> perfect target audience for smaller developers to get more gigs from.
> You would also be looked at as a possible paid consultant after the
> site goes live.
>
> If you are interested please email me. We are looking to start coding
> this project within a week. The duration of the project should only be
> about 2 weeks and we are not going to beat you up if it takes a little
> longer.
>
> Oh Yeah! I almost forgot another bonus for developers. We will send
> you a free copy of Seth Godin's new book called Linchpin.
>
> --
> Andrew
>
>
>
>
> On Jan 28, 1:51 am, "ecommy.com"  wrote:
>> what kind of project do you want? what's the proposed reward to the
>> coder? part of the business / flat fee per project?
>>
>> On 28 ian., 04:31, stefano  wrote:
>>
>>
>>
>> > Andrew
>>
>> > tell me about the project iam from Chile
>>
>> > S
>>
>> > On Wednesday, January 27, 2010, Andrew  wrote:
>> > > Hi Guys!
>>
>> > > I am looking for a developer. I have a small project might take a few
>> > > weeks. I am looking for someone who wants to donate some time to a
>> > > small startup. You can be anywhere in the world. The company is not
>> > > looking to become the next Google. We simply want to make the world a
>> > > little better.
>>
>> > > --
>> > > Andrew
>>
>> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
>> > > with their CakePHP related questions.
>>
>> > > 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 
>> > > athttp://groups.google.com/group/cake-php?hl=en
>>
>> > --
>> > Stefano Salvatori M.http://stefano.salvatori.cl/
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> 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
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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



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: 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: 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: Debug Error?

2009-10-13 Thread brian

What do you have in the layout file immediately after that?

Also, do you have any code using Debugger class anywhere? That'll kill
your app if debug is set to 0.

On Tue, Oct 13, 2009 at 1:45 PM, Dave Maharaj :: WidePixels.com
 wrote:
>
> I have one page that is blank when i turn debug to 0. Every page on the site
> works except the one.
>
> Set debug to 1 or 2 and i can access the page. But there are no errors
> reported anywhere, view is normal with all the info i need showing up.
>
> All that gets rendered with debug 0 is
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> 
> Development: Teting
> "
> type="image/x-icon" rel="shortcut icon" />
>
> Not sure where to go from here...there is obviously an error but how to find
> it when it works with debug on and no errors?
>
>
> 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: app/webroot path missing using default mod_rewrite setup

2009-10-13 Thread brian

On Tue, Oct 13, 2009 at 2:17 PM, Josh K  wrote:
>
> Thanks.  That works. Would WWW_ROOT still work properly if I ever made
> any changes to the .htaccess setup, moved my webroot directory, or
> changed servers?  I think all I would need to do in that case is to
> set the correct path in app/webroot/index.php, rather than adjusting
> file_get_contents in the controllers.

That's correct. That's the point of setting a constant. Unless you
have a centralised location for the Cake libs (as in when you have
many of your own virtual hosts) you probably shouldn't need to set
WWW_ROOT with an absolute path. Rather you can use the existing
dirname(etc.) scheme.

--~--~-~--~~~---~--~~
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-13 Thread brian

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: app/webroot path missing using default mod_rewrite setup

2009-10-13 Thread brian

On Tue, Oct 13, 2009 at 11:23 AM, Josh K  wrote:
>
> When I enabled mod_write in CakePHP, I set my .htaccess files
> according to 
> http://book.cakephp.org/view/37/Apache-and-mod_rewrite-and-htaccess.
> Accessing the URLs work fine with this default setup.
>
> However, $webroot now  = /, which means paths using the webroot
> variable are incorrect:
>
> file_get_contents($_SERVER['DOCUMENT_ROOT'].$this->webroot .
> "templates/email.html") outputs
>
> home/user/public_html/templates/email.html
>
> but it should be
>
> home/user/public_html/app/webroot/templates/email.html (correct path)
>

Use WWW_ROOT:

file_get_contents(WWW_ROOT.'templates/email.html')

Think of WWW_ROOT as a modified $_SERVER['DOCUMENT_ROOT'], on account
of the redirects that Cake uses. As far as Apache is concerned,
DOCUMENT_ROOT is '/home/user/public_html' (you were missing the
leading /, btw) while, from Cake's perspective, it's actually below
that. Hence the need for a new constant, WWW_ROOT.

--~--~-~--~~~---~--~~
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 locale code to use when using Translate behavior?

2009-10-13 Thread brian

On Tue, Oct 13, 2009 at 11:19 AM, Rawna  wrote:
>
> I was wondering if CakePHP got it stored somewhere. Maybe from the
> L10n class?

Yes, look at the source for the L10n class. Use get().

--~--~-~--~~~---~--~~
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-13 Thread brian

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: Update now save

2009-10-13 Thread brian

On Tue, Oct 13, 2009 at 4:25 AM, Henrik Gemal  wrote:
>
> I have a table with:
> name, hour, status
>
> hour is the hour of the time.
>
> So I have to check each hour that name is ok and set the status.
> So eventually I get a table like:
>
> test, 1, 1
> test, 2, 0
> test, 3, 0
> 
> test, 23, 1
>
> If I use:
> $data = array("Name" => array("status" => $status, "name" => $name,
> "hour" => $hour));
> $this->Name->save($data);
>
> it keeps on adding new lines. I only want one line per hour.
>
> How can I do this?
>
>
> >
>


Add a primary key ("id") to the table.

$id = $this->Name->field(
'id',
array(
'Name.name' => $name,
'Name.hour' => $hour
)
);

$this->Name->id = $id;
$this->Name->saveField('status', $status);

So, I guess you're just letting the data rotate. I mean, there are no
dates so the record for a particular hour is overwritten. Personally,
I'd consider adding a 'created' timestamp column and insert new record
each time. That way, you'd have lots of data with which to compile
stats. But perhaps you don't need that for this app.

--~--~-~--~~~---~--~~
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-13 Thread brian

And what do you see when you view source?

On Tue, Oct 13, 2009 at 2:14 AM, Jas  wrote:
>
> My style or layout, disappears on some pages, I've narrowed it down to
> the way $html->link is setup and have fixed some pages, but not the
> ones that have a parameter, for example /users/edit/1 it still dont
> show any styling or layout.
> I've tried
> echo $html->link('Change my details','/users/edit/'.$user['User']
> ['id']);
> and
> echo $html->link('Change my details', array('controller' =>
> 'users','action'=>'edit',$user['User']['id']),null,null,false);
> When the page goes to the url they both work functionally but, dont
> show any styling. But this did fix pages without a parameter.
>
> Any ideas?
>
> Jas
> >
>

--~--~-~--~~~---~--~~
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-12 Thread brian

On Mon, Oct 12, 2009 at 5:11 PM, DigitalDude
 wrote:
>
> Hey,
>
>
> hmm ok this would be a workaround I think. I was more like using a
> field called is_online, which is 0 when not logged in, when logging in
> it would be set to 1 and then a javascript function could refresh this
> field every let's say minute or so. But if the user closes the
> browser, how would I get to set it back to 0

Which is why relying on a flag is a bad idea. Again: There's no
bullet-proof way to deal with a person closing their browser.

--~--~-~--~~~---~--~~
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: Can you recommend quality (virtual) server hosting?

2009-10-12 Thread brian

johncompanies.com

On Mon, Oct 12, 2009 at 4:34 AM, Martin Westin
 wrote:
>
> Hi, at my day-job we have plans to expand to the US. For that purpose
> I wanted to find a reliable hosting provider. Any good/bad experiences
> you can share would be welcome.
>
> I am looking for:
> • Server hosting / real, virtual or cloud. (we run special system
> software want to control the OS)
> • Able to scale. (the app is heavy by nature so scaling is
> anticipated)
>  • Scaling needs are more likely be disk-space and speed, cpu for
> image/video conversion more than traditional SQL/webfront needs.
> • Very reliable. (clients in out field are not going to like downtime
> one bit)
>
> The tech-geek in me would really like to put the system on a "cloud"
> since it looks to help scaling and the cost of scaling.. plus it is
> kewl :)
>
> I have looked at Amazon a bit but mostly keep reverting to drooling
> over Rackspace cloud.
>
> Any favorites for deploying critical apps? Please share.
>
> Martin
> >
>

--~--~-~--~~~---~--~~
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: Defining URL

2009-10-12 Thread brian

Create a route for it:

Router::connect(
'/manage/experiences/',
array('controller' => 'experiences', 'action' => 'index', 'manage' 
=>true)
);

$html->link('Experience', array('controller' => 'experiences',
'action' => 'index', 'manage' =>true));

On Mon, Oct 12, 2009 at 3:05 PM, Dave Maharaj :: WidePixels.com
 wrote:
>
> But when I hardcode  it (not so cake-way) like this it works fine.
>
> link('Experience', '/manage/experiences/'); ?>
>
> I just thought it could be done like a standard array(controller action)
>
> -Original Message-
> From: Miles J [mailto:mileswjohn...@gmail.com]
> Sent: October-12-09 4:31 PM
> To: CakePHP
> Subject: Re: Defining URL
>
>
> Well if you are using a prefix or a plugin, index is required to determine
> the correct route, else it will fail.
>
> On Oct 12, 11:28 am, "Dave Maharaj :: WidePixels.com"
>  wrote:
>> How can you drop index off the url?
>>
>> link('Experience', array('controller' =>
>> 'experiences', 'action' => null, 'manage' =>true));?>
>>
>> Tried with null, '', or removing action completely but still shows
>> manage/experiences/index
>>
>> 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: TextHelper Problem

2009-10-12 Thread brian

On Mon, Oct 12, 2009 at 3:24 PM, euromark (munich)
 wrote:
>
> well the helper IS NOT available in the controller right away
>
> you need to add
>
> App::import(Helper,Text);
> $this->Text = new TextHelper();
>
> now you can work with it... brian probably didnt read your post and
> thought you talked about a component

My bad. I did assume that a Helper listed in the $helpers array could
be used in the controller without also importing() it. I don't know
that I'd ever tried that.

I think it makes more sense to put this code in the view, fwiw.

--~--~-~--~~~---~--~~
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: TextHelper Problem

2009-10-12 Thread brian

Use $this->Text->whatever() while in the controller and
$text->whatever() in the view.

But note that autoLinkUrls() returns the string. You'll need to modify
the value in $this->data. Either that, or use the method in your view.

On Mon, Oct 12, 2009 at 9:52 AM, Lukar Dennig  wrote:
>
> Hi everyone,
>
> im having a problem with the TextHelper and i totally dont get why...
>
> in a nutshell my controller (based on the Blog Tutorial) looks like
> this:
>
> class NewsController extends AppController {
>
>        var $name = 'News';
>        var $helpers = array('Text');
>
>        function edit($id = null) {
>                $this->News->id = $id;
>                if (empty($this->data)) {
>                        $this->data = $this->News->read();
>                } else {
>                        $text->autoLinkUrls("asd"); // (line 64)
>                        [...]
>                }
>        }
> }
>
> Now when i call the function (save the form) i get:
> "Notice (8): Undefined variable: text [APP\controllers
> \news_controller.php, line 64]"
>
> Without the line everything works. Ive been searching the cookbook for
> an hour but i cant come up with any reason. My AppController is empty
> btw. I also tried "$this->helpers[] = 'Time';" in the function but it
> didnt help.
>
> Any help would be appreciated...
>
> Lukar
>
> >
>

--~--~-~--~~~---~--~~
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-12 Thread brian

Add a last_login field to users table. In Users:login() do something like:

$this->User->id = $this->Auth->user('id');
$this->User->saveField('last_login', date('Y-m-d H:i:s'));

Then you can fetch the id, name, etc. of all users whose last_login is
within some period of time. There's no bullet-proof way to deal with a
person closing their browser but this will at least give an
approximate list.

On Sun, Oct 11, 2009 at 9:07 PM, 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 are online, too, the
> status of these users is shown.
>
> The question is, how could I do such a thing in Cake? Is there any
> chance to retriebe the status of 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"-status to 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 the status back 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: Internal Server Error

2009-10-09 Thread brian

Normally, with CakePHP, you have a controller for each model. That's
not set in stone, of course, but if you have a CompaniesController, it
should automatically have access to a Company model. Hence, you can
simply do $this->Company->whatever(). Perhaps there's some issue
you've uncovered where using ClassRegistry::init('SomeModel') fails
when in the controller for omeModel. Maybe it's a bug, I don't know.
But it doesn't seem to me to be a very serious problem when the
correct usage would be to access the model directly.

In any case, did you actually try what I suggested? If it still fails
when using $this->Company->... then you can start looking elsewhere
for the problem.

On Fri, Oct 9, 2009 at 3:38 PM, rlcabral  wrote:
>
> The connection with the DB is supposed to be done by the model, not by
> the controller. But it does not matter here.
>
> Using the model or the controller, it does not work as expected.
>
>
> On 9 out, 17:56, brian  wrote:
>> Why use ClassRegistry::init() if this code is in your
>> CompaniesController? You should be able to just do:
>>
>> $this->set('companies', $this->Company->getAll());
>>
>> Come to that, why even have a getAll() method?
>>
>> $this->set('companies', $this->Company->find('all'));
>>
>> On Fri, Oct 9, 2009 at 12:52 PM, rlcabral  wrote:
>>
>> > Yes, I was referring to the model names.
>>
>> > Right now the code is really simple because I'm trying to figure out
>> > what is the problem.
>>
>> >        #app/controllers/companies_controller.php
>> >        function admin_search() {
>> >                $companies = ClassRegistry::init('Company')->getall();
>> >                $this->set('companies', $companies);
>> >        }
>>
>> > and the "getall" function in the model Company is:
>>
>> >        #app/models/company
>> >        function getall() {
>> >                return $this->find('all');
>> >        }
>>
>> > Pretty basic, but does not work. However, If I change Company to City
>> > or any other model, it works.
>>
>> > I don't wanna find all, but for now I'm doing this to see where the
>> > problem is. Later I will put the term that I wanna search for.
> >
>

--~--~-~--~~~---~--~~
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: Internal Server Error

2009-10-09 Thread brian

Why use ClassRegistry::init() if this code is in your
CompaniesController? You should be able to just do:

$this->set('companies', $this->Company->getAll());

Come to that, why even have a getAll() method?

$this->set('companies', $this->Company->find('all'));

On Fri, Oct 9, 2009 at 12:52 PM, rlcabral  wrote:
>
> Yes, I was referring to the model names.
>
> Right now the code is really simple because I'm trying to figure out
> what is the problem.
>
>
>        #app/controllers/companies_controller.php
>        function admin_search() {
>                $companies = ClassRegistry::init('Company')->getall();
>                $this->set('companies', $companies);
>        }
>
>
> and the "getall" function in the model Company is:
>
>
>        #app/models/company
>        function getall() {
>                return $this->find('all');
>        }
>
>
> Pretty basic, but does not work. However, If I change Company to City
> or any other model, it works.
>
> I don't wanna find all, but for now I'm doing this to see where the
> problem is. Later I will put the term that I wanna search for.
> >
>

--~--~-~--~~~---~--~~
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: tree behaviour - remove from tree

2009-10-09 Thread brian

How are you calling the method in your controller (or model)?

On Fri, Oct 9, 2009 at 10:28 AM, leo  wrote:
>
> I'm using tree behaviour and want to remove a node from the tree
> without deleting its children.
>
> I'm having trouble getting this to work. The manual says
> 'removeFromTree()' and little else. It seems from the few snippets I
> googled that it takes id as a parameter. Logical, but does nothing.
>
> The API says removefromtree( Model, Id, Delete) note the lack of
> camelcase. This one just errors:
>
>    Warning: Warning (2):  The argument should be an array in [CORE/
> cake/libs/model/behaviors/tree.php, line 676]
>
> Can anybody show me a snippet of something that works?
>
> I can use delete(), but I'd like the control promised by
> removefromtree.
>
>
> >
>

--~--~-~--~~~---~--~~
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: Internal Server Error

2009-10-09 Thread brian

On Fri, Oct 9, 2009 at 11:08 AM, rlcabral  wrote:
>
> Hi,
>
> Something really strange is happening on my app.
>
> I have a function called "search". It is working fine.
>
> However, if I login and use the same search function, I get an
> internal error message.
>
> Now, the most strange thing on this. If I change the code and instead
> of searching on the table "Company" (which is what I want) I search on
> the table "city", it works!

Shouldn't that be "companies" and "cities"? Or were you referring to
model names?

> I tried a normal find call - find("all") - and it works for all the
> tables, except for company.
>
> Again, this error only happens when I'm logged in. If log out,
> everything works fine.
>
> Any idea of what might be the cause?

I'd suspect that the Company model has an error of some kind but the
login thing is strange.

Can you post the search controller code?

--~--~-~--~~~---~--~~
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: E-mail component rendering a template fails with no error message

2009-10-09 Thread brian

On Fri, Oct 9, 2009 at 1:02 AM, Bruno Bergher  wrote:
>
> Hi there,
>
> Summary: when using EmailComponent I bump into a strange problem in
> the View class. Using CakePHP 1.3.0.0.
>
> I'm using EmailComponent  in a very standard way. In my controller I
> have:
>
> $this->Email->to = 's...@email.com';
> $this->Email->from = 'some.ot...@email.com';
> $this->Email->subject = 'Message Subject';
> $this->Email->template = 'template_name';  // under views/elements/
> email/text/template_name.ctp
> $this->Email->sendAs = 'text' ;
> $this->Email->send();
>
> The template exists and is just plain text, no special characters.
>
> This leads to a blank page, regardless of the E_ALL error reporting
> level.
>
> So I go down into the Email component class, adding die("here") calls
> and find out it fails on line 461:
>
> $content = explode("\n", str_replace(array("\r\n", "\r"), "\n", $View-
>>renderLayout($content)));
>
>
> Now I go to $View->renderLayout() and add the same die("here") calls
> there, and realize the problem is actually happening right before line
> 747, which is odd, because it's just:
>
> return $out;

So renderLayout() is probably fine. If you add:

die($View->renderLayout($content));

just before line 461 in the component, what do you get?

Other things to check around that line:

$content -- before the explode() call
$View->layoutPath


> The thing is that if I do debug($out) right before 747, it outputs the
> message perfectly, but in the normal flow of the class, it just breaks
> and returns me a blank screen after some 5 seconds hanging, with no
> error neither on the screen or the logs.
>
> I tried everything and have absolutely no idea what to do from here. I
> fiddled with all the parameters, renamed the template, changed it's
> content, nothing works. It only works when I remove the $this->Email-
>>template line and do like $this->Email->send('any text), but that's
> no good, obviously.
>
> One more curious thing: if above view.php:498 I add
> debug($data_for_layout);
> it fails in the exact same way (the request hangs for some 5 seconds
> and returns blank), but if I try
> pr($data_for_layout);
> it prints it's contents perfectly. Just thought this could be useful.

That's likely just because debug has been set to 0 before that.

--~--~-~--~~~---~--~~
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: ability to users to delete their comment's

2009-10-09 Thread brian

On Fri, Oct 9, 2009 at 11:19 AM, Simon  wrote:
>
> if that code gose to controller then this should go to view but the
> other  users will see this link
> link(__('Delete', true), array('action'=>'delete',
> $comment['Comment']['id']), null, sprintf(__('Are you sure you want to
> delete # %s?', true), $comment['Comment']['id'])); ?>

if ($comment['Comment']['user_id'] == $session->read('Auth.User.id'))
{
echo $html->link(__('Delete', true), array('action'=>'delete',
$comment['Comment']['id']), null, sprintf(__('Are you sure you want to
delete # %s?', true), $comment['Comment']['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: Server has broken links

2009-10-09 Thread brian

Set debug to 2. When set to 0, Cake displays a 404 message. It's
probable that you have an error somewhere. Perhaps your files are not
in sync. Or, maybe there's a permissions problem. Also, check Cake's
error log.

On Fri, Oct 9, 2009 at 4:59 AM, Michael Gaiser  wrote:
> I have been making a site and testing it on my localhost, but when I have
> uploaded it to my real host, it breaks. It is able to load the homepage, but
> the images and css files are unable to be found. The error log shows that it
> is looking in www.site.com/css instead of www.site.com/app/webroot/css
>
> All of the links do not exist. ie www.site.com/users/view/1 tells me that
> /users/view/1 does not exist.
>
> Since the home page is coming up, I can assume that rewrite_mod.so has been
> loaded and the default .htaccess files are working but I am totally clueless
> why everything else is broken. Any suggestions?
>
> ~MJG
>
> >
>

--~--~-~--~~~---~--~~
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: Intergrate cakephp with just static html pages

2009-10-08 Thread brian

Create a .ctp file from the static page, put it at
app/webroot/home.ctp and let PagesControler serve it up.

On Thu, Oct 8, 2009 at 4:09 AM, stefanski  wrote:
>
> Does anybody know what to do, if the static html page should be the
> hompage of the site?
>
> There usually is by far the most traffic, so it would be great to have
> a static html  (which could be generated as well) that the webserver
> could send without having to initialize the cakephp framework.
>
> I guess ther needs to be som rewriterule ... ?
>
> Cheerio, Stefan
>
>
> On 29 Sep., 02:00, brian  wrote:
>> On Mon, Sep 28, 2009 at 10:56 AM, dong.l...@gmail.com
>>
>>
>>
>>  wrote:
>>
>> > Dear all,
>>
>> > I have existed html files for one website, I would like to intergrate
>> > them withcakephpto add some dynamic methods. At the same time, I
>> > want to keep all the oldstaticpages to save time. When I put html
>> > pages in the root folder, it still handle bycakephp. I know it
>> > because the .htaccess file will look for index.php file in the webroot
>> > folder first.
>>
>> > So how can I change the .htaccess file to make it work. I want it can
>> > look for .html files first, if no html files, then it looks for
>> > index.php.
>>
>> > Below is oringal .htaccess file
>>
>> > 
>> >   RewriteEngine on
>> >   RewriteRule    ^$ app/webroot/
>> >   RewriteRule    (.*) app/webroot/$1 [L]
>> > 
>>
>> There's no need to change any of the .htaccess files. Put your HTML
>> files in app/webroot. The .htaccess file in that directory will only
>> pass the request to Cake if the file or directory does not exist
>> there. Note the 2 RewriteCond lines:
>>
>> 
>>     RewriteEngine On
>>     RewriteCond %{REQUEST_FILENAME} !-d
>>     RewriteCond %{REQUEST_FILENAME} !-f
>>     RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
>> 
> >
>

--~--~-~--~~~---~--~~
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: $this->paginate["fields"]

2009-10-07 Thread brian

$this->paginate['fields'][] = "Model.first_name as example";

OR:

array_push($this->paginate['fields'], 'Model.first_name as example');

On Wed, Oct 7, 2009 at 7:00 PM, Kyle Decot  wrote:
>
> I want to append a dynamically created field to my paginated results
> but when I do
>
> $this->paginate['fields'] = "Model.first_name as example";
>
> It only pulls in that field when what I really want is all the fields
> it would normally get, plus this one. Is there a way to do this? 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: pagination: remember the page from where i come

2009-10-07 Thread brian

In the view with the paging, do debug($this->params['paging']). The
page number should be in $this->params['paging']['ModelName']['page'].
You could pass that to the 2nd controller, which would use it to get
you back where you came from.

On Wed, Oct 7, 2009 at 7:29 AM, Obelix  wrote:
>
> Hallo,
> i have a Problem with pagination. In my Example i have 2 Controllers
> defined (CmsFolders / CmsContens). In each Controller i have a Action
> with the name index. This Action and the View display all Data from
> the Database.  The normal work is, to jump from one View to the other
> View and back.  If i jump back to the prev. View i want go to the same
> page where i come from. How can i do this ?
>
> Thanks for your request.
>
>
> >
>

--~--~-~--~~~---~--~~
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 Files do not get read in by the system.

2009-10-07 Thread brian

You're the second person today. Clear out app/tmp/cache/models/ and
set debug > 0 to have Cake check the model schema on each request.

On Wed, Oct 7, 2009 at 9:51 AM, paullb  wrote:
>
>
> I have noticed that my model files do not get read by Cake -AT ALL-. I put
> garbage characters into one file and it didn't impact the running at all.
> Obviously if the file was readin I would have got a syntax error. Could
> someone please enlighten me as to what is going on here?
>
> The program is able to read in correctly from the segments table independent
> of what i put in the file. If this file is not read in and not used, why
> create it?
>
> Cheers,
>
> Brendan
>
> --
> ajax_controller.php
> --
>
> class AjaxController extends AppController {
>    var $name = "Ajax";
>    var $uses = array("Segment","Comment");
>
>
>    //don't use the view and layout files
>    var $autoRender = false;
>
>
>        function getAllLines() {
>
>
> --
> segment_model.php   ("asdfasdfasdf" at the end intentional to demonstrate
> the file is not read)
> --
>
> class Segments extends AppModel {
>        var $useTable = "segments";
>
>        var $recursive = 2;
>
>                as
> }asdfasdfasdf
> --
> View this message in context: 
> http://www.nabble.com/Model-Files-do-not-get-read-in-by-the-system.-tp25787023p25787023.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: Validating a HABTM relationship

2009-10-07 Thread brian

I can't answer your question about HABTM/saveAll() but what I've done
in the past is put the validation rule in the 'JoinModel'. In the
controller for the other model:

$this->SavingModel->JoinModel->set($this->data);

if (!$this->SavingModel->JoinModel->validates())
{
$this->SavingModel->JoinModel->invalidate('JoinModel');
}
else if ($this->SavingModel->save($this->data))
{
...

I do think it's worth filing a bug about what you described, fwiw.
That does seem odd. But I haven't had the best luck with that, either.
The last time, I received the usual sarcastic replies that suggested
I'm clueless. However, although never acknowledged, the bug I reported
was fixed :-)

On Wed, Oct 7, 2009 at 2:15 AM, WebbedIT  wrote:
>
> I will belatedly add my weight to this topic and maybe we can come up
> with a bug to be ticketed with examples between us.
>
> @mcrawford: I believe you are trying to apply the validate rule to the
> wrong model as the fields for the join table do not exist in your
> Question model, hence it will never try to validate them.
>
> What I have done in the past is add the rules to the join model within
> the beforeFilter() of the model I am saving the data from.
>
> function beforeFilter() {
>  parent::beforeFilter();
>  $this->SavingModel->JoinModel->validate = array(
>    'JoinModel' => array(
>      'rule' => array('multiple', array('min'=>1)),
>      'message' => 'Select one or more options'
>    )
>  );
> }
>
> However saveAll's validate logic does not seem to check for habtm
> validate rules as I have mentioned in an earlier post
>
> http://groups.google.com/group/cake-php/browse_thread/thread/3390943040e2ded9/5db36a67bbcedae7
>
> This unfortunately got hijacked from people telling me to learn how to
> use 'multiple rules' even though I kept telling them I was after
> information on using the 'core multiple rule' (the title of the topic
> even gave the correct cookbook page - DOH!).
>
> I assume no-one from the dev team looked at that topic as I kept
> asking someone with more knowledge to try and shed some light but no-
> one did.
>
> The hack I used to resolve the issue is in the above topic and after
> recently upgrading to 1.2.5 stable I can see this hack is still needed
> so I think we'll have to make Cake aware of this ... otherwise how
> will they ever be able to resolve it.
>
> I have never opened a ticket before and see a lot of them get knocked
> back due to poor test cases and stuff, anyone reading this got
> experience of raising good tickets or know of a guide which would
> advise me on how to do it?
> >
>

--~--~-~--~~~---~--~~
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: fopen: failed to open stream

2009-10-07 Thread brian

file.php is where the error was triggered; it's not the file that
cannot be opened. Look more closely at the first path--you need to
allow the webserver to have write access to your app/tmp directory
(and all subdirectories).

On Wed, Oct 7, 2009 at 9:43 AM, Jacksm  wrote:
>
> Hi,
>  I am setting up CakePHP on a hosted linux server. I made it through
> the set up, but I am still getting a lingering error on the welcome
> page below:
>
> Warning: fopen(/home/mysimple/public_html/login/app/tmp/cache/
> persistent/cake_core_core_paths) [function.fopen]: failed to open
> stream: Permission denied in /home/mysimple/public_html/login/cake/
> libs/file.php on line 156
>
> Warning (2): fopen
>
> I have tried changing your permissions to file.php but I am still
> getting the same error. Thanks for your 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: Model Files

2009-10-07 Thread brian

On Wed, Oct 7, 2009 at 9:22 AM, Brendan Paull  wrote:
>
> 3 questions for the group regarding Models
>
> 1. Does CakePHP even read the contents of the model files. I run my
> code, then I completely clear the contents of the file or put garbage
> data in for values such as $useTable and there is absolutely no
> effect. If CAKE is not going to read the model file, what is the point
> in having ? (I tried put test member variables in and reading them out
> later, didn't work)
>
> 2. Related to the above, but putting $hasMany in has no effect (as
> mentioned above CakePHP does not even seem to be reading the model
> files) so the only way that I can set things up is to actually bind it
> in the Controller. This doesn't really seem right to me
>
> 3. Perhaps again related to the above, but I want to write my own
> functions inside the model, I used to be able to in previous versions
> of Cake, but doesn't seem to be able to any more. Cake appears to
> automatically run as a query. Could be related to Cake not even
> reading the model files in the first place.
>

Delete the contents of the app/tmp/cache/models/ directory. If you set
debug > 0, Cake will also re-read the model and database table schema
for it.

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



Re: Set:sort "A Set-compatible path"

2009-10-07 Thread brian

On Wed, Oct 7, 2009 at 10:17 AM, alberto  wrote:
>
> Where I can find the syntax of the variable $path that are passed to
> the Set:sort ?

For sort() you'll probably be using '{n}.ModelName.field_name'. The
'{n}' part represents the array index and you provide that exactly as
shown. You just need to change the 'ModelName' and 'field_name' bits.

The 2nd link here shows how to use '{s}', which is even more fun.

http://debuggable.com/posts/cake-12s-set-class-eats-arrays-for-breakfast:480f4dd6-d084-4fb7-bacc-49fdcbdd56cb
http://blogs.bigfish.tv/adam/2008/03/24/sorting-with-setsort-in-cakephp-12/
http://book.cakephp.org/view/640/Set

--~--~-~--~~~---~--~~
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 in Auth->loginRedirect.

2009-10-06 Thread brian

On Tue, Oct 6, 2009 at 7:01 PM, lokesh sharma  wrote:
>
> Currently I'm facing problem in Auth->loginRedirect.
> AS per my requirement, I have to pass parameter value also in
> controller's action. But after searching alot, I didnt find any option
> except  '$this->Auth->loginRedirect = array('controller' =>
> 'schooladmins', 'action' => 'view');' which means in this array I can
> pass only controller name and action name.
> How can I solve this problem? Please help me out.
> Any help regarding this will be very help full.
>

You can create a route for it. What type of param do you want to pass? If an id:

Router::connect(
'/schooladmins/view/:id/',
array('controller' => 'schooladmins', 'action' => 'view'),
array('id' => '[0-9]+', 'pass' => array('id'))
);

$this->Auth->loginRedirect = array(
'controller' => 'schooladmins',
'action' => 'view',
'id' => $id
);


If you want the URL to actually appear as
/something/else/ID

(where ID is the numeric $id)

Router::connect(
'/something/else/:id/',
array('controller' => 'schooladmins', 'action' => 'view'),
array('id' => '[0-9]+', 'pass' => array('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: acl tutorial - invalid node

2009-10-06 Thread brian

You're passing a class instance to allow(). It should be an array:

array( 'model' => 'Group', 'foreign_key' => $the _group_id)

On Tue, Oct 6, 2009 at 3:28 PM, Manu  wrote:
>
> hi
>
> I try to add permissions with this functions.
>
> function initDB() {
>    $group =& $this->User->Group;
>    //Allow admins to everything
>    $group->id = 1;
>    $this->Acl->allow($group, 'controllers');
>
>    //allow managers to posts and widgets
>    $group->id = 2;
>    $this->Acl->deny($group, 'controllers');
>    $this->Acl->allow($group, 'controllers/Posts');
>    $this->Acl->allow($group, 'controllers/Widgets');
>
>    //allow users to only add and edit on posts and widgets
>    $group->id = 3;
>    $this->Acl->deny($group, 'controllers');
>    $this->Acl->allow($group, 'controllers/Posts/add');
>    $this->Acl->allow($group, 'controllers/Posts/edit');
>    $this->Acl->allow($group, 'controllers/Widgets/add');
>    $this->Acl->allow($group, 'controllers/Widgets/edit');
> }
>
>
> I really only try to do the acl tutorial but I cant get it done.
> you can see the code on the doc site tutorial ACL.
> The get a warning when I try to allow or deny.
>
> On Oct 6, 7:43 pm, brian  wrote:
>> On Tue, Oct 6, 2009 at 9:42 AM, Manu  wrote:
>>
>> > Hi
>>
>> > I'm trying to do the acl tutorial from the cake docs.
>> > Unfortunately I can't edit the permissions.
>> > When I try to setup the permissions I get this warning.
>>
>> > Warning (512): DbAcl::allow() - Invalid node [CORE\cake\libs\controller
>> > \components\acl.php, line 325]
>>
>> > I also tried to set up permissions with the console tool. But I get
>> > the same warning. I also tried different nodes and
>> > it doesn't matter if I try to allow or deny.
>> > I have the entries in the tables. I setup groups and users and I also
>> > have the acos which I added with the build acl function from the
>> > tutorial.
>>
>> > maybe It has something to do with my Apache, PHP or mysql
>> > configuration.
>> > I just installed everything and maybe I missed something.
>> > I have apache http server 2.2 with php 5.2.11.
>>
>> > any ideas ?
>>
>> Can you post your code? The error is triggered because Cake can't find
>> the association between nodes. Look at DbAcl::getAclLink(() in the
>> AclComponent 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: Translate field names

2009-10-06 Thread brian

On Tue, Oct 6, 2009 at 3:11 PM, emmexx  wrote:
>
>
>
> On 6 Ott, 19:54, brian  wrote:
>> Do you have a .po file containing a translation for 'table_id'? And
>> have you set the language?
>
> Not yet but I expected that without a po file, or a translation, the
> label defaulted to the value used automatically by cake.

No, if Cake can't find the key in the po file, it echoes back the key
you pass it.

> I mean, if there's a belongTo field in the table, say category_id, I
> expected that the result of
> echo $form->input('category_id', array('label' => __('category_id',
> True)));
> would be Category, not category_id. That is: no translation >>>
> default value.

But you've already specified the label to Cake so it's not going to
give you the automatic value.

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



Re: Problem with Model Association

2009-10-06 Thread brian

That shouldn't be an issue. What was the file name? If it wasn't
news_post.php that would do it.

On Tue, Oct 6, 2009 at 3:01 PM, Raman  wrote:
>
> Thanks brian, tried that, but it didn't work. I found the solution
> though. I'm using CakePHP version 1.3, so this might be a bug I really
> don't know.
>
> The problem was the capitilization of the 'P' in News'P'ost. I changed
> the model's names, filenames, etc. to just News and voila, it works!
>
> On Oct 6, 2:15 pm, brian  wrote:
>> In Comment.php, add var $belongsTo = array('NewsPost');
>>
>>
>>
>> On Tue, Oct 6, 2009 at 1:02 PM, Raman  wrote:
>>
>> > Hello,
>>
>> > Im very new to CakePHP and have just started to learn Model
>> > Association. If I make any errors in the google group, please excuse
>> > me this is my first time on any google group.
>>
>> > I have 2 databases:
>>
>> > -news_posts
>> >    -id
>> >    -title
>> >    -body
>>
>> > -comments
>> >    -id
>> >    -body
>> >    -newspost_id
>>
>> > Here are the AppModel classes associated with them:
>>
>> > // app/models/newspost.php
>> > class NewsPost extends AppModel {
>> >    var $name = 'NewsPost';
>> >    var $hasMany = 'Comment';
>> > }
>>
>> > // app/models/comment.php
>> > class Comment extends AppModel {
>> >    var $name = 'Comment';
>> > }
>>
>> > The problem is when i call $this->NewsPost->find('all'); from a
>> > controller that var $uses = 'NewsPost';, I get this array:
>>
>> > Array
>> > (
>> >    [0] => Array
>> >        (
>> >            [NewsPost] => Array
>> >                (
>> >                    [id] => 10
>> >                    [Title] => Cool, This works! LOL
>> >                    [Body] => Wow, this really works! OMG LOL OMG
>> > EDITING WORKS FINE
>> >                    [Time] => 1254685359
>> >                )
>>
>> >        )
>>
>> > )
>>
>> > As you can see, there is no [Comment] array in the sub-array [0].
>>
>> > Here is the data for my tables:
>>
>> > news_posts:
>>
>> >   id   |         title       |        body       |
>> >   10  |   News Title   |   News Body   |
>>
>> > comments:
>>
>> >   id   |            body          |       newspost_id       |
>> >   1    |   Comment Body   |             10                |
>>
>> > Any help would be greatly appreciated.
>>
>> > 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: Email Function

2009-10-06 Thread brian
On Tue, Oct 6, 2009 at 1:50 PM, Dave Maharaj :: WidePixels.com
 wrote:
> My controller is getting out of control
>
> I have 3 different registration functions which all send emails
>
> such as:
>
> if ($this->User->save($this->data, true,
> array_intersect(array_keys($this->User->schema()), $white))) {
>   $this->Email->smtpOptions = array(my info here);
>   $this->Email->delivery = 'smtp';
>   $this->Email->to = $this->data['User']['email'];
>   $this->Email->subject = 'Account Confirmation';
>   $this->Email->replyTo = 'noreply@;
>   $this->Email->from = ';
>   $this->Email->sendAs = 'html';
>   $this->Email->template = 'registration';
>   $this->set('data', $this->data);
>   $this->set('ip_address', $_SERVER['REMOTE_ADDR']);
>   $this->set('server_name', $_SERVER['SERVER_NAME']);
>
>   if ($this->Email->send()) {
>     do something here but each registration does something
> different
>  }
>
> I need to turn this into a function which will return true or false if
> $this->Email->send() to continue on.
>
> Any ideas? I tred a few things but it never worked.
>
>
>
> function sendRegistrationEmail($data, $role) {
>   $sendSuccess = false;
>   /* SMTP Options */
>   ...
>
>   if ($this->Email->send()) {
>   $sendSuccess = true;
>   //create the Freelancer page
>   }
>   return $sendSuccess;
>
>   }
>
> Dave


if ($this->User->save(...))
{
// email stuff
$data = array(
'subject' => '...',
'to' => '...'
// etc.
);

if ($this->sendRegistrationEmail($data))
{
// do your role stuff here
}

}


function sendRegistrationEmail($data)
{
$this->Email->subject = $data['subject'];
// etc.

return $this->Email->send();
}

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



Re: Problem with Model Association

2009-10-06 Thread brian

In Comment.php, add var $belongsTo = array('NewsPost');

On Tue, Oct 6, 2009 at 1:02 PM, Raman  wrote:
>
> Hello,
>
> Im very new to CakePHP and have just started to learn Model
> Association. If I make any errors in the google group, please excuse
> me this is my first time on any google group.
>
> I have 2 databases:
>
> -news_posts
>    -id
>    -title
>    -body
>
> -comments
>    -id
>    -body
>    -newspost_id
>
> Here are the AppModel classes associated with them:
>
> // app/models/newspost.php
> class NewsPost extends AppModel {
>    var $name = 'NewsPost';
>    var $hasMany = 'Comment';
> }
>
> // app/models/comment.php
> class Comment extends AppModel {
>    var $name = 'Comment';
> }
>
> The problem is when i call $this->NewsPost->find('all'); from a
> controller that var $uses = 'NewsPost';, I get this array:
>
> Array
> (
>    [0] => Array
>        (
>            [NewsPost] => Array
>                (
>                    [id] => 10
>                    [Title] => Cool, This works! LOL
>                    [Body] => Wow, this really works! OMG LOL OMG
> EDITING WORKS FINE
>                    [Time] => 1254685359
>                )
>
>        )
>
> )
>
> As you can see, there is no [Comment] array in the sub-array [0].
>
> Here is the data for my tables:
>
> news_posts:
>
>   id   |         title       |        body       |
>   10  |   News Title   |   News Body   |
>
> comments:
>
>   id   |            body          |       newspost_id       |
>   1    |   Comment Body   |             10                |
>
> Any help would be greatly appreciated.
>
> 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: email validation

2009-10-06 Thread brian

On Tue, Oct 6, 2009 at 12:47 PM, Simon  wrote:
>
> i have 2 fields email and confirm_email  i tired this validation didnt
> work
>
> 'email_confirm' => array('rule' =>  array( 'notSame'),'message' =>
> 'email not same')

Have a look here:

http://bakery.cakephp.org/articles/view/using-equalto-validation-to-compare-two-form-fields

--~--~-~--~~~---~--~~
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: Changing field names, need help

2009-10-06 Thread brian

I can't think of a compelling reason to do that in Cake. I doubt doing
that would play nicely with FormHelper, for one thing.

On Tue, Oct 6, 2009 at 12:38 PM, PaulMan  wrote:
>
> Hello,
>
> Select .  Workflow.id as Fa, Workflow.name as Fb ...
>
> How can this be done using the 'fields' parameter
>
> for example
> var $belongsTo = array(
> 'Workflow' => array(
>                        'className' => 'Workflow',
>                        'foreignKey' => 'workflow_id',
>                        'conditions' => '',
>                        'fields' => array('id','name'), // <-- Using this 
> paramenter
>                        'order' => ''
>                )
> )
>
> Please help,
> Best Regards to all,
> >
>

--~--~-~--~~~---~--~~
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: Second DB datasource, not related to a model

2009-10-06 Thread brian

On Tue, Oct 6, 2009 at 12:38 PM, p_W  wrote:
>
> At my company we have a large Oracle DB that stores the information
> for all our employees and users.  The app I am writing uses a MSSQL db
> and also has a 'users' table, as we want to store the information for
> the users of our app in a different way than the information is stored
> in the Oracle db.  When the user browses to the app, their employee id
> is pulled from the $_SERVER['HTTP_REMOTE_USER'] variable, and we want
> to pull some basic information about the user (name, status, etc) from
> the Oracle db and store it in the MSSQL table.
>
> How would you advise setting up the connection to the oracle db?  The
> 'user' model is hooked to the MSSQL db, and we only want to use the
> oracle connection to get a bit of info and then it won't be used again
> for that user.  Should I set the oracle connection up in database.php
> and another source and use 'var $useDbConfig = 'oracle'' till I don't
> need the oracle connection anymore, or just use old-fashioned
> odbc_connect() functions in the user model's 'get_info_from_oracle'
> function?

Use Model::setDataSource()

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

--~--~-~--~~~---~--~~
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: Query (using "greater than")

2009-10-06 Thread brian

On Tue, Oct 6, 2009 at 12:20 PM, gimperdan...@gmail.com
 wrote:
>
> thanks!! Maybe the book is outdated or just a typo.
>

Outdated. The behavior changed awhile ago. It should be edited. If you
have a Bakery acct. you can edit it yourself. See ('How You Can
Help'):

http://book.cakephp.org/

If not, what page is that code on?

--~--~-~--~~~---~--~~
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: Translate field names

2009-10-06 Thread brian

Do you have a .po file containing a translation for 'table_id'? And
have you set the language?

http://book.cakephp.org/view/163/Localization-in-CakePHP

On Tue, Oct 6, 2009 at 10:54 AM, emmexx  wrote:
>
> On 25 Set, 12:47, "rich...@home"  wrote:
>> No, you only want to translate the label, not the field name :
>>
>> echo $form->input("field_name", array("label"=>__("field_name")));
>
> I tried what you suggested but the result is not what I espected.
>
> 1st attempt:
>
> echo $form->input('table_id', array('label' => __('table_id')));
>
> The output is:
> table_id
> Table
> that is a label and the name of the joined table.
> Unfortunately I want just one label, Table, translated if there's a
> translation.
>
> 2nd attempt:
> echo $form->input('table_id', array('label' => __('table_id', True)));
>
> The output is:
> table_id
> I expected: Table
>
> I'm missing something? I'm expecting too much from cake?
>
> Thank you
>   maxx
> >
>

--~--~-~--~~~---~--~~
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: acl tutorial - invalid node

2009-10-06 Thread brian

On Tue, Oct 6, 2009 at 9:42 AM, Manu  wrote:
>
> Hi
>
> I'm trying to do the acl tutorial from the cake docs.
> Unfortunately I can't edit the permissions.
> When I try to setup the permissions I get this warning.
>
> Warning (512): DbAcl::allow() - Invalid node [CORE\cake\libs\controller
> \components\acl.php, line 325]
>
> I also tried to set up permissions with the console tool. But I get
> the same warning. I also tried different nodes and
> it doesn't matter if I try to allow or deny.
> I have the entries in the tables. I setup groups and users and I also
> have the acos which I added with the build acl function from the
> tutorial.
>
> maybe It has something to do with my Apache, PHP or mysql
> configuration.
> I just installed everything and maybe I missed something.
> I have apache http server 2.2 with php 5.2.11.
>
> any ideas ?

Can you post your code? The error is triggered because Cake can't find
the association between nodes. Look at DbAcl::getAclLink(() in the
AclComponent 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: Odd Image Path

2009-10-06 Thread brian

On Tue, Oct 6, 2009 at 12:57 PM, Jimbo2150  wrote:
>
> I set up my laptop so that I can access or edit files and view it on
> the browser through my LAN (Apache is on my desktop computer). When I
> loaded the pages in the browser on the laptop, I notice that CSS and
> Images are linked incorrectly. It writes 2 root paths. Eg. Where ever
> there was an $html->css() or $html->image() call it should have
> output:
>
> /rootPath/webroot/css/..
> and
> /rootPath/webroot/img/...
>
> Instead, I get:
>
> /rootPath/rootPath/webroot/css/...
> and
> /rootPath/rootPath/webroot/img/...
>
> What is going on?
>

It actually should be "/img/..." & "/css/...". Do you have mod_rewrite
loaded and set up correctly? On the desktop, how are you accessing the
site?

--~--~-~--~~~---~--~~
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 with bindModel on the fly

2009-10-06 Thread brian

On Tue, Oct 6, 2009 at 2:40 AM, Cristian Cassina
 wrote:
>
> Hi everyone,
>
> this one is puzzling me. In my app, validation works like a charm for
> every model I have, except one. In that one, validation works but,
> here the rules:
>
> var $validate = array(
>                'name' => array(
>                  'rule' => 'alphaNumeric',
>                  'required' => true,
>                  'message' => 'Il campo codice GP deve essere
> alfanumerico',
>                  'allowEmpty' => false
>                ),
>                'customer_name' => array(
>                  'rule' => 'alphaNumeric',
>                  'required' => true,
>                  'message' => 'Il campo codice cliente deve essere
> alfanumerico',
>                  'allowEmpty' => false
>                ),
>                'grammatura' => array(
>                  'rule' => 'numeric',
>                  'message' => 'la grammatura deve essere un numero intero',
>                  'allowEmpty' => false
>                )
>    );
>
> As I was telling you, validation works. In fact, if I leave any of those
> three fields empty, data aren't saved in the database. The problem is
> the message that doesn't show! Even worse, I get the flash message from
> the controller that everything has been saved correctly (when is not)!
> Here is the controller add action as backed via console and modified:
>
>    function add() {
>        if (!empty($this->data)) {
>            $this->Distint->create();
>
> $this->Distint->bindModel(array('hasMany'=>array('DistintsMaterial','DistintsOperation','DistintsMachine','DistintsExtop')));
>            $this->Distint->save($this->data);
>
>            $this->Session->setFlash(__('La distinta base è stata
> salvata', true));
>            $this->redirect(array('action'=>'index'));
>        }
>
> The thing is I had to bind those models to this one on the fly, because
> in the habtm tables I have extra fields to save data within. I suspect
> this binding being the reason of my troubles. No matter what you do with
> the aforementioned validation rules, the only message you'll get is the
> one in the setFlash.
>
> Have you any idea about how to fix this?
> Thank you.
>
> Cristian

I don't know if bindModel() is causing the problem, but you should
have a look at these articles:

http://cricava.com/blogs/index.php?blog=6&title=modelizing_habtm_join_tables_in_cakephp_&more=1&c=1&tb=1&pb=1
http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-join-table-for-habtm-models/

--~--~-~--~~~---~--~~
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: Bug? - Accessing Deep Model Relations In Plugins

2009-10-06 Thread brian

On Mon, Oct 5, 2009 at 8:45 PM, MeanStudios  wrote:
>
> Greetings,
>
> I'm not sure if this is a bug or not but here it goes. If I have 3
> models (Layout, Template, Page).  Layout has many Page and Template.
> Page and Template have only one Layout.  If I am in the
> PagesController and I do something like $this->Page->Layout->findById
> ($id) it should return an array with with Layout data as well as all
> the templates and pages that are related to the passed layout id,
> correct?  Well it's not.  The only way I can get that data is if I do
> a bind right before the findById() like so
> $this->Page->Layout->bindModel(array('hasMany' => array('Template' =>
> array('className' => 'Template';
> $this->Page->Layout->findById($id);
>
> That will return an array of the Layout Data as well as an array of
> all the templates that Layout has associated to it.
>
> Yes, my $hasMany and $belongsTo definitions are setup correctly
> because I can go into the LayoutsController and just do:
> $this->Layout->findById($id);
> and it will return all the data it's supposed to.
>
> Yes I am using prefixes for my plugin controllers, models, views,
> etc.  It's just less confusing if I don't do it here.
>
> I'm pretty sure that I don't need the bind when not working inside a
> template but inside a regular controller.

If the associations are correct, that would seem odd. Can you try it
using Containable?

--~--~-~--~~~---~--~~
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: Field Naming conventions and hasmany records

2009-10-06 Thread brian

On Mon, Oct 5, 2009 at 9:02 PM, #2Will  wrote:
>
> OK, cool thanks. The comment is saving properly now.
>
> so i have this:
>
> echo $form->textarea('ForumComment.comment', array('rows'=>5));
>                if ($form->isFieldError('ForumCommentComment')){
>                        echo $form->error('ForumCommentComment');
>                }
>
> if the comment is blank, how do i raise the error for that field? It
> dosn't do it automagicaly.

I can't remember for sure, but I believe you have to set it manually
in the controller if validate() fails.

$this->validationErrors['ForumComment.comment'] = '...';

If someone else knows a more proper way I'd like to know also.

--~--~-~--~~~---~--~~
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: RequestAction: how to pass form data, form errors and paginate url options FROM along

2009-10-05 Thread brian
On Mon, Oct 5, 2009 at 2:47 PM, brian  wrote:
> Ordinarily, I'd suggest you dump the requestAction() calls and put the
> logic in your model and call it from there. But you need to paginate,
> so it has to be in the controller. In that case, you could put the
> pagination logic in ProfilesController. As for the shout_to() method,
> you could probably put that in the model.
>
> public $uses = array('Profile', 'Shout');
>
> public paginate = array(
>        'Shout' => array(
>           'fields' => array(
>                           'Shout.id',
>                           'Shout.created',
>                           'Shout.body',
>                           'Shout.is_hidden',
>                           'Shout.is_deleted',
>                           'Shout.is_deleted_by_shouter',
>                           'Shout.from_profile_id',
>                           'FromProfile.nickname',
>           ),
>           'contain' => array(
>                           'FromProfile',
>           ),
>           'conditions' => array('Shout.profile_id' => $profileId),
>           'order' => 'created DESC',
>           'limit' => 1
>        )
> );
>
>
> function view($id = null) {
>           if (!$id) {
>                           $this->Session->setFlash(__('Invalid Profile.', 
> true));
>                           $this->redirect(array('action'=>'index'));
>           }
>           $this->set('profile', $this->Profile->read(null, $id));
>
>           $this->set('shouts', $this->paginate('Shout'));
>
>           $this->set('shoutbox', $this->Shout->shout_to($id));
> }
>

One thing I forgot: remove the conditions from the $paginate class var
and set in the action:

$this->paginate['Shout']['conditions'] = array('Shout.profile_id' =>
$profileId);

--~--~-~--~~~---~--~~
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: RequestAction: how to pass form data, form errors and paginate url options FROM along

2009-10-05 Thread brian
Ordinarily, I'd suggest you dump the requestAction() calls and put the
logic in your model and call it from there. But you need to paginate,
so it has to be in the controller. In that case, you could put the
pagination logic in ProfilesController. As for the shout_to() method,
you could probably put that in the model.

public $uses = array('Profile', 'Shout');

public paginate = array(
'Shout' => array(
   'fields' => array(
   'Shout.id',
   'Shout.created',
   'Shout.body',
   'Shout.is_hidden',
   'Shout.is_deleted',
   'Shout.is_deleted_by_shouter',
   'Shout.from_profile_id',
   'FromProfile.nickname',
   ),
   'contain' => array(
   'FromProfile',
   ),
   'conditions' => array('Shout.profile_id' => $profileId),
   'order' => 'created DESC',
   'limit' => 1
)
);


function view($id = null) {
   if (!$id) {
   $this->Session->setFlash(__('Invalid Profile.', 
true));
   $this->redirect(array('action'=>'index'));
   }
   $this->set('profile', $this->Profile->read(null, $id));

   $this->set('shouts', $this->paginate('Shout'));

   $this->set('shoutbox', $this->Shout->shout_to($id));
}

On Mon, Oct 5, 2009 at 2:05 PM, j0n4s.h4rtm...@googlemail.com
 wrote:
>
> Hello,
>
> I have a ProfilesController that got an action "view" and a
> ShoutsController that got the actions "index" and "shouts"
>
>
> // In ProfilesController
>
>        function view($id = null) {
>                if (!$id) {
>                        $this->Session->setFlash(__('Invalid Profile.', true));
>                        $this->redirect(array('action'=>'index'));
>                }
>                $this->set('profile', $this->Profile->read(null, $id));
>                $this->set('shouts', $this->requestAction(
>                        array('controller' => 'shouts', 'action' => 'index'),
>                        array('return', 'pass' => array($id;
>                $this->set('shoutbox', $this->requestAction(
>                        array('controller' => 'shouts', 'action' => 
> 'shout_to'),
>                        array('return', 'pass' => array($id;
>        }
>
>
> // in ShoutsController
>
>        function index($profileId = null) {
>                $this->Shouts->recursive = 0;
>                $this->paginate = array(
>                        'fields' => array(
>                                'Shout.id',
>                                'Shout.created',
>                                'Shout.body',
>                                'Shout.is_hidden',
>                                'Shout.is_deleted',
>                                'Shout.is_deleted_by_shouter',
>                                'Shout.from_profile_id',
>                                'FromProfile.nickname',
>                        ),
>                        'contain' => array(
>                                'FromProfile',
>                        ),
>                        'conditions' => array('Shout.profile_id' => 
> $profileId),
>                        'order' => 'created DESC',
>                        'limit' => 1,
>                );
>                $this->set('shouts', $this->paginate());
>        }
>
>        function shout_to($toProfileId = null) {
>                if ($toProfileId != null and !empty($this->data)) {
>                        $this->Shout->create();
>                        $this->Shout->set(array(
>                                'user_id' => $this->Auth->user('id'),
>                                'profile_id' => $toProfileId,
>                                'from_profile_id' => 
> $this->Shout->Profile->getAuthedId($this-
>>Auth->user(;
>                        if ($this->Shout->save($this->data, true,
>                                        array('user_id', 'profile_id', 
> 'from_profile_id', 'body'))) {
>                                $this->Session->setFlash(__('The Shout has 
> been saved', true));
>                        } else {
>                                $this->Session->setFlash(__('The Shout could 
> not be saved. Please,
> try again.', true));
>                        }
>                }
>                if (isset($this->data['Shout']['has_shouted'])) {
>                        $this->redirect(array('controller' => 'profiles', 
> 'action' =>
> 'view', $toProfileId));
>                }
>        }
>
> Now I have a question about passing forth and back information between
> the "parent calling action" ProfilesController::view() and the
> requested Actions.
>
> Everything works for me but on the shoutbox requestAction:
> - No form errors / validation errors displayed
> - Entered form data not inserted on va

Re: Field Naming conventions and hasmany records

2009-10-05 Thread brian

On Mon, Oct 5, 2009 at 2:52 AM, vekija  wrote:
>
> You'll have to save the topic first and then fetch it's id. From the
> cookbook: "If neither of the associated model records exists in the
> system yet (for example, you want to save a new User and their related
> Profile records at the same time), you'll need to first save the
> primary, or parent model." 
> http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasMany-belongsTo
>

You could force Cake to create a textarea anyway
($form->textarea('ForumComment.comment')) and, after saving the Topic,
get the ID and add it to $this->data['ForumComment']['topic_id'] (or
however your model is configured).

--~--~-~--~~~---~--~~
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: Uploader Plugin now does Model attachments

2009-10-04 Thread brian

On Sun, Oct 4, 2009 at 8:29 PM, Miles J  wrote:
>
> Many have asked for a way to attach files to a Model to do automatic
> file uploading and database saving, within my Uploader Plugin. Well
> now you can, its really easy!
>
> http://www.milesj.me/resources/script/uploader-plugin#Attaching-Files-To-Models-Auto-Upload

Looks really good. I generally use my own--out of a need to upload
more than just images--but I might take this out for a spin.

--~--~-~--~~~---~--~~
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: showEmpty?

2009-10-04 Thread brian

I believe it's 'empty => 'Select your State'. If the param is false,
null, or the empty string, Cake outputs an empty option.

On Sun, Oct 4, 2009 at 8:13 AM, Dave Maharaj :: WidePixels.com
 wrote:
>
> I had a same / similar question for input selects which is related to this.
>
> I have my echo $form->input('State'); which is populated by a find list...so
> I have all my States. How can I add so first option to be "Select your
> State" with no value? Right now Alabama shows up first and if a user does
> not select a State Alabama is automatically saved.
>
> $selected = array('option' => 'Select your State', 'value' => '0')?
>
> Thanks,
>
> Dave
> -Original Message-
> From: Miles J [mailto:mileswjohn...@gmail.com]
> Sent: October-04-09 7:35 AM
> To: CakePHP
> Subject: Re: showEmpty?
>
>
> You should only be using input().
>
> echo $form->input('State', array('options' => array('NJ' => New Jersey',
> 'NY' => 'New York'), 'empty' => false));
>
> On Oct 3, 7:33 pm, Gonzalo Servat  wrote:
>> On Sun, Oct 4, 2009 at 7:21 AM,
> gimperdan...@gmail.com wrote:
>>
>> [..snip..]
>>
>> > This is what I have:
>>
>> > echo $form->select('State', array('NJ' => New Jersey', 'NY' => 'New
>> > York'));
>>
>> > I want to remove the empty option of this select box. According to
>> > the API I need to add $showEmpty = false to the code above.. but
>> > where do I add it? I tried in several different locations and it won't
> work.
>>
>> The function's arguments are:
>>
>> select($fieldName, $options = array(), $selected = null, $attributes =
>> array(), $showEmpty = '')
>>
>> You only supplied the first and second arguments so if you want to
>> keep the defaults for the rest except for $showEmpty, you'd need to do
>> something like the following:
>>
>> echo $form->select('State', array('NJ' => 'New Jersey', 'NY' => 'New
>> York'), null, array(), false)
>>
>> (notice I kept the defaults "null" and "array()" for the arguments
>> between $options and $showEmpty)
>>
>> - Gonzalo
>
>
> >
>

--~--~-~--~~~---~--~~
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: Excluding a node from a tree, and adding a parent node

2009-10-04 Thread brian

On Sat, Oct 3, 2009 at 10:44 PM, Rawna  wrote:
>
> Hi, I'm using Cake's Tree bhavior and I got a couple of questions:
>
> 1. How do I exclude a node when generating a a tree list? (i.e. using
> generatetreelist()) ? I'm going to use it when editing a category.
>
> 2. When adding a new category, it seems that I can't add a new parent
> category. I'm not using a single parent node for everything (is this
> advisable or do I really have to create a common parent node?). What I
> want is to have a blank selection on my dropdown list to indicate that
> the category I'm creating is a parent node.

For an app I built with a Section tree, I used a single parent node,
"root" with a NULL parent_id. When fetching a threaded list, top-level
Sections, etc. I used 'Section.parent_id IS NOT NULL' in the
conditions.

To have Cake create an empty option at the top of your select element,
use 'empty' => true in the params.

--~--~-~--~~~---~--~~
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: Access Classes In Layout Help??

2009-10-03 Thread brian

Put the select widget in an element. Get the select options with
requestAction(). And cache the options so you don't have to fetch them
from the DB each time.

You don't need to change the target of the AJAX call. It doesn't
matter what view you're in. It's just like any other link.

On Sat, Oct 3, 2009 at 3:06 PM, hahmadi82  wrote:
>
>
> Yea, probably much easier for me to explain what I've done and what I'd like
> to do.
>
> So basically I implemented the ajax select box using the code below:
>
> http://www.devmoz.com/blog/2007/04/04/cakephp-update-a-select-box-using-ajax/
>
> My code set up is more less the same as the example posted in that article.
> The ajax select box I created allows a user to select a car make, then year,
> then model.  Currently, I have this working in index.ctp just like the
> example, and the ajax calls the update_select.ctp.
>
> What I would like to do, is move this ajax selector into my navigation bar
> so that the user can change is car at any point during his browsing
> experience.  This means that no matter what view he's on, he can still use
> my ajax selector through the navbar.
>
> The complication is that my code is in my car_controller "index.ctp" and
> uses "update_select.ctp" with observefield (like the example).  I want to
> somehow move this code/functionality into my default.ctp.  Perhaps you guys
> can suggest the best strategy?  Even if I move the code from index.ctp to
> default and access the set variable from the app_controller before filter
> (as suggested), I still have the issue of ajax having to call the
> update_select function which I have no idea where I would move it to
> (perhaps in the app_controller?)...
>
> I apologize for the constant questions and greatly appreciate the help you
> guys have been giving me :)
>
>
>
>
>
> And then we scroll back 15 emails :
>
>
> If this works, then I would suggest to add your layout data to the view
> inside the beforeFilter() method of AppController and then use this data in
> your layout. Might even consider creating an element for the part that uses
> this data ...
>
>
>>
>> :)
>>
>> On Sat, Oct 3, 2009 at 10:34 AM, Miles J  wrote:
>>
>>>
>>> Do it in the beforeFilter() of your AppController, that will apply it
>>> to all views and layouts.
>>>
>>> On Oct 3, 1:18 am, hahmadi82  wrote:
>>> > Now I see!  So the set variables change depending on which view is
>>> showing
>>> > within the default.ctp.  If I add this car action to the app_controller
>>> > (instead of car model) and set the variables there, will all the views
>>> have
>>> > access to that variable? How can I make a global "set" variable that
>>> comes
>>> > from a specific query?
>>> >
>>> >
>>> >
>>> > brian-263 wrote:
>>> >
>>> > > On Fri, Oct 2, 2009 at 10:55 PM, hahmadi82 
>>> wrote:
>>> >
>>> > >> Ok so I actually didn't create a layout for each view from my
>>> > >> controllers.
>>> > >> Instead, all the views use the same layout, which is the
>>> default.ctp.
>>> Is
>>> > >> that incorrect? From my understanding, the default layout is loaded
>>> by
>>> > >> every
>>> > >> view and that's why I have my navigation bar in it.  It seems that I
>>> can
>>> > >> only access those "set" variables from something like
>>> > >> views/layouts/cars/index.ctp but not views/layouts/default.ctp. Is
>>> there
>>> > >> a
>>> > >> difference between the model layouts and the default layout?
>>> >
>>> > > You *almost* have it. Once again:
>>> >
>>> > > When a controller's action is run, its render() method is called
>>> > > automatically (yes, you can call it yourself but please ignore that
>>> > > for now). When that happens, Cake will use the View class to render
>>> > > the view template for that action. These templates are in
>>> > > app/views/controller_name_ending_in_s/action_name.ctp
>>> >
>>> > > Usually, the view template contains some HTML that you have included,
>>> > > along with some variables. Those variables are passed to the View
>>> > > class through the controller's $viewVars class variable. When you
>>> call
>>> > > $this->set('foo', 

Re: How to remove query's description in footer

2009-10-03 Thread brian

In app/config/core.php:

Configure::write('debug', 0);

On Sat, Oct 3, 2009 at 11:39 AM, lokesh sharma  wrote:
>
> I'm beginner in cake PHP. After configure database, model, controller
> & view, I got my page running but in footer I'm getting queries
> related information which  I want to remove.
>
> Any pointer or help will be very appreciable
> 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: Caching dynamic url view

2009-10-03 Thread brian

I misunderstood what you were looking to do.

On Sat, Oct 3, 2009 at 1:16 PM, thinline  wrote:
>
>
> Well most simply because It's not just the 1 page... There are
> hundreds of these pages posts/badge/:id/size:180x150 thats what the
> route would be. My issue is being able to use cacheAction to grab
> dynamic urls. For instance if I wanted to cache /posts/view/* how
> could this be done? You would not want to manually create routes and
> cacheAction entries for each post that is created.
>
>
> On Oct 3, 12:29 pm, brian  wrote:
>> Why not just create a simplified route for that URL? Something like:
>>
>> '/badge',
>> array('controlller' => 'posts', 'action' => 'your_action', 'id' => 23,
>> 'size' => '180x150')
>>
>> On Fri, Oct 2, 2009 at 10:58 PM, thinline  wrote:
>>
>> > I am trying to implement full view caching for a specific method in a
>> > controller.
>>
>> > First I realized that if you set $this->layout = false; then caching
>> > will NOT happen. I have no idea why this occurs. I am not sure if this
>> > is a bug as I had a hard time debugging out how the cache works.
>>
>> > Once, I turned that off I was able to get my view to cache by adding
>> > var $cacheAction = "1 hour";
>>
>> > Since I don't want to cache everything in the view I need to cache
>> > just specific methods. The URL that I would like to cache looks like
>> > this:
>> > /posts/badge/23/size:180x150
>> > where 23 is the post ID and size is a named parameter (there are 2
>> > variations of size).
>>
>> > So my question is what is the proper (if any) match to place in
>> > cacheAction to cache all posts/badges/* Here are some examples that I
>> > have tried:
>>
>> > var $cacheAction = array(
>> >        'badge/*' => '+1 hour',
>> >        'posts/badge/23/size:180x150' => '1 hour',
>> >        'badge/23/size:180x150' => '1 hour',
>> >        'posts/badge/:id/:size' => '1 hour',
>> >        'badge/:id/:size' => '1 hour',
>> > );
>>
>> > None of these seem to match (or at least do not cache for some
>> > reason). I do need to cache posts/badge/*/size:* and trap each of the
>> > parameters being passed.
>>
>> > Again, if I set $cacheAction = "1 hour"; then the cache file is
>> > created (the file tmp/cache/views/posts_badge_23_size_180x150.php is
>> > created)
> >
>

--~--~-~--~~~---~--~~
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: Caching dynamic url view

2009-10-03 Thread brian

Why not just create a simplified route for that URL? Something like:

'/badge',
array('controlller' => 'posts', 'action' => 'your_action', 'id' => 23,
'size' => '180x150')

On Fri, Oct 2, 2009 at 10:58 PM, thinline  wrote:
>
>
> I am trying to implement full view caching for a specific method in a
> controller.
>
> First I realized that if you set $this->layout = false; then caching
> will NOT happen. I have no idea why this occurs. I am not sure if this
> is a bug as I had a hard time debugging out how the cache works.
>
> Once, I turned that off I was able to get my view to cache by adding
> var $cacheAction = "1 hour";
>
> Since I don't want to cache everything in the view I need to cache
> just specific methods. The URL that I would like to cache looks like
> this:
> /posts/badge/23/size:180x150
> where 23 is the post ID and size is a named parameter (there are 2
> variations of size).
>
> So my question is what is the proper (if any) match to place in
> cacheAction to cache all posts/badges/* Here are some examples that I
> have tried:
>
> var $cacheAction = array(
>        'badge/*' => '+1 hour',
>        'posts/badge/23/size:180x150' => '1 hour',
>        'badge/23/size:180x150' => '1 hour',
>        'posts/badge/:id/:size' => '1 hour',
>        'badge/:id/:size' => '1 hour',
> );
>
> None of these seem to match (or at least do not cache for some
> reason). I do need to cache posts/badge/*/size:* and trap each of the
> parameters being passed.
>
> Again, if I set $cacheAction = "1 hour"; then the cache file is
> created (the file tmp/cache/views/posts_badge_23_size_180x150.php is
> created)
>
> >
>

--~--~-~--~~~---~--~~
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: Access Classes In Layout Help??

2009-10-03 Thread brian

On Sat, Oct 3, 2009 at 4:18 AM, hahmadi82  wrote:
>
>
> Now I see!  So the set variables change depending on which view is showing
> within the default.ctp.  If I add this car action to the app_controller
> (instead of car model) and set the variables there, will all the views have
> access to that variable? How can I make a global "set" variable that comes
> from a specific query?

I think you're still not quite seeing it. But I'm having some
difficulty understanding what it is you're trying to do. Maybe you
should post some code.

--~--~-~--~~~---~--~~
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: Using a page outside of CakePHP

2009-10-03 Thread brian

On Sat, Oct 3, 2009 at 2:54 AM, Josh K  wrote:
>
> Thanks for the reply.  I would actually like to use the two pages
> outside of the Cake document root since I have Cake and its app files
> on a subdirectory.  For example:
>
> I would like to copy:
>
> /home/public_html/cake/app/views/forms/form1
>
> to
>
> /home/public_html/form1.php
>
> What type of php includes would I need to do this?
>

I don't follow your reasoning but, anyway, you'd need to have add some
conditions to your .htaccess file in public_html. Something like:

RewriteCond %{REQUEST_URI} !^your_form
RewriteCond %{REQUEST_URI} !^your_other_form

But I don't have much experience using Cake in a subdirectory so
someone else might know better.

--~--~-~--~~~---~--~~
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: Using a page outside of CakePHP

2009-10-02 Thread brian

On Fri, Oct 2, 2009 at 11:09 PM, Gonzalo Servat  wrote:
>
> On Sat, Oct 3, 2009 at 1:01 PM, Josh K  wrote:
>>
>> Is it possible to use a page outside of a CakePHP application? All but
>> two pages of my Cake app require authentication. I have two public
>> forms that submit data to the application.
>
> You could stick the pages in your /app/webroot/. Any files in there
> are not processed by CakePHP.

Also, you could create views for those forms and tell Auth to allow them:

the controller:

function beforeFilter()
{
  parent::beforeFilter();
  $this->Auth->allow(array('the_action', '...');
}

You might want to do that if you'd like those form pages to use the
existing layout 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: Access Classes In Layout Help??

2009-10-02 Thread brian

On Fri, Oct 2, 2009 at 10:55 PM, hahmadi82  wrote:
>
>
> Ok so I actually didn't create a layout for each view from my controllers.
> Instead, all the views use the same layout, which is the default.ctp. Is
> that incorrect? From my understanding, the default layout is loaded by every
> view and that's why I have my navigation bar in it.  It seems that I can
> only access those "set" variables from something like
> views/layouts/cars/index.ctp but not views/layouts/default.ctp. Is there a
> difference between the model layouts and the default layout?

You *almost* have it. Once again:

When a controller's action is run, its render() method is called
automatically (yes, you can call it yourself but please ignore that
for now). When that happens, Cake will use the View class to render
the view template for that action. These templates are in
app/views/controller_name_ending_in_s/action_name.ctp

Usually, the view template contains some HTML that you have included,
along with some variables. Those variables are passed to the View
class through the controller's $viewVars class variable. When you call
$this->set('foo', 'bar'), you are passing the value, 'bar' to the
controller's $viewVars array with a key, 'foo'.

When the controller's $viewVars is handed off to the View class, it
extracts them, essentially creating a var named $foo that contains the
value 'bar'.

Now, after the View has finished using the view template to render
something to output it creates a variable called, $content_for_layout.

It then renders the layout template. That's a file in
app/views/layout/name_of_your_layout.ctp. If you don't specify a
layout, Cake uses 'default'.

Inside the layout template is (should be) a variable named ...
$content_for_layout. This is where the contents of your rendered view
are written to the layout.

So, try this: In one of your controller actions, add $this->set('foo', 'bar');

In your app/views/layouts/default.ctp add this, just above $content_for_layout

echo $foo;

You should see 'bar' in there, somewhere. View source and search for
it, because your CSS may hide it.

Anyway, perhaps you should post the relevant part of your layout file
and the controller action.

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



Re: learning by example: twitter?

2009-10-02 Thread brian

If you're using jQuery, have a look at the form plugin. It'll allow
you to painlessly have a form submit through an AJAX call. Ad you can
set up a callback function to take care of changing the display,
handling data sent back from the server, etc.

But, if you're brand new to Cake (or jQuery) realise that you're going
to need to take small steps at first.

On Fri, Oct 2, 2009 at 7:52 PM, Christian  wrote:
>
> I have a form on my site, that after it submits.. I want to sends off
> some data to some model, but stay on the page and reveals a new div/
> form below. Without an entire page refresh if possible.
>
> I compare this to something like the twitter main page when you're
> logged in. You write up a post, click submit and it appears in the
> live feed below.
>
> Some areas where I'm fuzzy:
>
> 1. How do you (properly) go about encapsulating a 'main page' that
> lists recent posts, and off to the side other things clearly not
> associated with a 'post' model
>
> 2. How can you submit a form and have it do some processing on a model
> unassociated with the view you're currently on? the action="controller/
> method" will automatically redirect you to the view associated with
> that controller method.
>
> 3. I assume AJAX is needed to have something reveal itself without
> refresh.
>
>
> I like cake, but am experiencing some growing pains until I figure out
> how to accomplish my goals within the mold.
>
> thanks,
>
> Christian
> >
>

--~--~-~--~~~---~--~~
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: Still sort array help

2009-10-02 Thread brian

natcasesort() returns a boolean, not an array.

debug(natcasesort($merged));

On Fri, Oct 2, 2009 at 6:07 PM, Dave Maharaj :: WidePixels.com
 wrote:
>
> No matter what i try I still cant sort an array.
>
> $merged = array_merge ($new_skills, $selected);
>    debug($merged);
> Array
> (
>    [0] => Tree
>    [1] => Zoo
>    [2] => Hello
>    [3] => Test
>    [4] => Cool
>    [5] => 3 Doors Down
>    [6] => Yellow
> )
>
>
>
>
>    $sorted = natcasesort($merged);
>    debug($sorted);
>
> Array
> (
>  1
> )
>
>
> I simply want to sort the merged array alphbeticaly but everything just
> returns 1
>
> Tried sort();
> array_multisort()
> natsort();
>
> Ideas?
>
> 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: Auth component loop redirect

2009-10-02 Thread brian

On Fri, Oct 2, 2009 at 9:36 AM, mathaios  wrote:
>
> Brian you nailed it...I was having a small navigation element in the
> layout
>
> thank you!
>

Yeah, that one was driving me nuts once. I was so happy to find that post!

--~--~-~--~~~---~--~~
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, containable -> what $key for sort()

2009-10-02 Thread brian

On Fri, Oct 2, 2009 at 5:49 AM, Melanie Sommer
 wrote:
>
> Hello,
>
> I am using containable behaviour in paginate() in my controller namend
> "E".
>
> In my view I can use sort('title of cell in table E') to sort the
> results. But I did not find a way to sort by any fields not belonging
> to table E.
>
> I tried sort('D.cell name') - but the syntax seems to be wrong.
>
> So, what is the correct syntax for $key in PaginatorHelper::sort()
> when using containble behaviour?

The first param is the text to display in the link. Cake can usually
figure out what to do if it's also a field name (or something like
that). Try putting the Model.field_name as second param:

$paginator->sort('text in link', 'D.cell name', array('title' =>
'title attribute of link'))

--~--~-~--~~~---~--~~
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 about on merge two different Model paginate

2009-10-01 Thread brian

On Thu, Oct 1, 2009 at 9:08 AM, byqsri  wrote:
>
> Can someone help me about this?
>
> On 7 Set, 09:13, "marco.rizze...@gmail.com" 
> wrote:
>> Hi
>> I have this situation:
>> I have a model Event and a model News ,  Both models have  the field
>> 'created' .
>> Now in my view I would create a single list where there is  there are
>> both each others order by created.
>> Example
>>
>> Event 1    07/09/09
>> News 1    07/09/09
>> News 2    06/07/09
>> ..
>> ..
>> ..
>>
>> I would manage this list with paginate.
>> Is someone can suggest me a pattern  that I can use to do a thing like
>> this?
>> Many thanks

I'm sure Set class can help with this. I had an idea but it's not
quite there, I think.

Say these are your data (inner arrays would all contain more key =>
val, of course);

$events = array(
'Event' => array(
array('created' => '2007-10-02'),
array('created' => '1998-02-03'),
array('created' => '2001-04-30'),
array('created' => '2002-05-23'),
array('created' => '2003-07-21')
)
);
$news = array(
'News' => array(
array('created' => '2003-04-12'),
array('created' => '2003-10-24'),
array('created' => '2000-01-03'),
array('created' => '2000-01-05'),
array('created' => '2000-05-28')
)
);

I'd think that this would do it:.

$foo = Set::sort(
Set::merge($events, $news),
'{s}.{n}.created', 'desc'
);

But that returns an empty 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
-~--~~~~--~~--~--~---



  1   2   3   4   5   6   7   8   9   10   >