Re: Cake optimization

2012-01-02 Thread Phang Mulianto
you rite adsix. .agree . see where the problem caused and fix it..and if
you already optimize everything before need the debug kit it will safe you
too...

for the os level well, every kernel of linux can be optimized, some came
with default server usage setting, with of course different workload
interpretation from the os default setup..that if you have the control of
the os.

caching is the most efective way. .. beside code optimization
On Jan 3, 2012 2:09 PM, "AD7six"  wrote:

>
>
> On Jan 3, 6:55 am, Dee Johnson  wrote:
> > I would like to have somewhere ~1 sec load time
> >
> > I actually figured out the problem though.  When using persistModel =
> true
> > it actually caused ALOT of unexpected speed results.  I removed it and
> all
> > calls are around 1 - 3 seconds.
> >
> > Also, automagic form elements wont load with it for some reason.
> >
> > see this articlehttp://
> stackoverflow.com/questions/2148416/cakephp-controllerpersistm...
> >
> > Thanks for the javascript caching suggestion.  I will try that as well.
>  I
> > am maintaining a tool that I created where the sole purpose is modifying
> /
> > inputting data primarily which is why containable worked or me alot.  Any
> > other suggestions similar to containable?
> >
> > What modifications would you recommend on the OS layer?
>
> You are wasting your time unless you can identify something that is
> the cause for some/all of the delay you are seeing.
>
> E.g. let's say your db queries are taking 0.1s. if you implement a
> better caching mechanism you might be able to bring that down to 0.01s
> - which means your pages still take 7.99s.
>
> Therefore: look for and identify something that is actually slow
>
> * you can do that on a high level using debug kit
> * xdebug profiling would be 'best' it'll give you a lot of information
> and allow you to drill down to specific problems or let you see you're
> calling fast functions 1000s of times adding up to delays
> * you can do it yourself quite easily simply using $line = time() . '
> ' . __FILE__ . ':' . __LINE__; `echo "$line" >> my.log`; or something
> very similar (note complete absence of anything cakephp-specific in
> that).
>
> Also check your application and webserver logs - if they are full of
> errors (a common cause for slow apps in 1.3 and before is an
> unwritable tmp dir) sort that out first.
>
> AD
>
> --
> 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


REST Error Handling

2012-01-02 Thread Will
Hi all,

I'm looking for a way to return a generic error every time something
goes wrong with a REST request.  So for example, I would like to
return a simple, XML response like:


There was a problem processing your request.


Anytime something goes wrong when something is accessed via REST (e.g.
the template is in the View/$ControllerName/xml folder) but NOT when
the page is accessed normally (the template is in the View/
$ControllerName/ folder).  Is there way way to do this in Cake?  Or
perhaps a smarter way to achieve similar functionality?

Thanks,

-Will

-- 
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: Cake optimization

2012-01-02 Thread Miles J
http://milesj.me/blog/read/caching-queries

On Jan 2, 10:09 pm, AD7six  wrote:
> On Jan 3, 6:55 am, Dee Johnson  wrote:
>
>
>
>
>
>
>
>
>
> > I would like to have somewhere ~1 sec load time
>
> > I actually figured out the problem though.  When using persistModel = true
> > it actually caused ALOT of unexpected speed results.  I removed it and all
> > calls are around 1 - 3 seconds.
>
> > Also, automagic form elements wont load with it for some reason.
>
> > see this 
> > articlehttp://stackoverflow.com/questions/2148416/cakephp-controllerpersistm...
>
> > Thanks for the javascript caching suggestion.  I will try that as well.  I
> > am maintaining a tool that I created where the sole purpose is modifying /
> > inputting data primarily which is why containable worked or me alot.  Any
> > other suggestions similar to containable?
>
> > What modifications would you recommend on the OS layer?
>
> You are wasting your time unless you can identify something that is
> the cause for some/all of the delay you are seeing.
>
> E.g. let's say your db queries are taking 0.1s. if you implement a
> better caching mechanism you might be able to bring that down to 0.01s
> - which means your pages still take 7.99s.
>
> Therefore: look for and identify something that is actually slow
>
> * you can do that on a high level using debug kit
> * xdebug profiling would be 'best' it'll give you a lot of information
> and allow you to drill down to specific problems or let you see you're
> calling fast functions 1000s of times adding up to delays
> * you can do it yourself quite easily simply using $line = time() . '
> ' . __FILE__ . ':' . __LINE__; `echo "$line" >> my.log`; or something
> very similar (note complete absence of anything cakephp-specific in
> that).
>
> Also check your application and webserver logs - if they are full of
> errors (a common cause for slow apps in 1.3 and before is an
> unwritable tmp dir) sort that out first.
>
> AD

-- 
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: DebugKit Toolbar - core processing (derived)

2012-01-02 Thread AD7six


On Dec 29 2011, 4:41 pm, Alex Bovey  wrote:
> Hi all,
>
> I've just moved a site (at the client's request) from my own VPS where it
> was performing very well to some cheap shared hosting (123-reg.co.uk) and
> surprise surprise it's pretty slow.
>
> Using the DebugKit Toolbar I'm seeing a massive performance hit in core
> processing (derived) on the timeline - it's taking up to 40 seconds!  Any
> pointers for where to start looking for the cause of this?

Is debug kit the first component in the $components array?

AD

-- 
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: Cake optimization

2012-01-02 Thread AD7six


On Jan 3, 6:55 am, Dee Johnson  wrote:
> I would like to have somewhere ~1 sec load time
>
> I actually figured out the problem though.  When using persistModel = true
> it actually caused ALOT of unexpected speed results.  I removed it and all
> calls are around 1 - 3 seconds.
>
> Also, automagic form elements wont load with it for some reason.
>
> see this 
> articlehttp://stackoverflow.com/questions/2148416/cakephp-controllerpersistm...
>
> Thanks for the javascript caching suggestion.  I will try that as well.  I
> am maintaining a tool that I created where the sole purpose is modifying /
> inputting data primarily which is why containable worked or me alot.  Any
> other suggestions similar to containable?
>
> What modifications would you recommend on the OS layer?

You are wasting your time unless you can identify something that is
the cause for some/all of the delay you are seeing.

E.g. let's say your db queries are taking 0.1s. if you implement a
better caching mechanism you might be able to bring that down to 0.01s
- which means your pages still take 7.99s.

Therefore: look for and identify something that is actually slow

* you can do that on a high level using debug kit
* xdebug profiling would be 'best' it'll give you a lot of information
and allow you to drill down to specific problems or let you see you're
calling fast functions 1000s of times adding up to delays
* you can do it yourself quite easily simply using $line = time() . '
' . __FILE__ . ':' . __LINE__; `echo "$line" >> my.log`; or something
very similar (note complete absence of anything cakephp-specific in
that).

Also check your application and webserver logs - if they are full of
errors (a common cause for slow apps in 1.3 and before is an
unwritable tmp dir) sort that out first.

AD

-- 
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: Display both featured AND last posts.

2012-01-02 Thread Jeremy Burns | Class Outfit
That makes a lot more sense.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 3 Jan 2012, at 05:48:21, Kanwal wrote:

> 
> hi
> 
> you can use
> 
> $featuredposts=$this->Post->find('all',array('conditions' =>
> array('Post.featured' => '1'),'limit' => 10));
> $this->set('featured',$eaturedposts);
> 
> $lastposts=$this->Post->find('all',array('order' => array('Post.id
> DESC'),'limit' => 10));
> $this->set('lastposts',$lastposts);
> 
> On Jan 2, 8:00 pm, "J."  wrote:
>> I want to display both feat. and last posts on my home page.
>> 
>> So, in my Pages controller, I have this :
>> 
>> $this->loadModel('Post');
>> $posts = $this->set('posts', $this->Post->find('all',
>> array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
>> 
>> and in my view I use :
>> 
>>  
>> 
>> How can I display latest posts in an other foreach too since I already
>> defined it in the controller ?
>> 
>> Thanks for your time !
> 
> -- 
> 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: Test controllers throwing exceptions

2012-01-02 Thread AD7six


On Dec 28 2011, 4:22 pm, Matteo Landi  wrote:
> Hi everybody,
>
> I have a custom exception handler for all the exceptions raised inside
> controllers; when I run the controllers' testsuite, I noticed that exceptions
> are propagated to the tests instead of being handled by my handler. Is this 
> the
> normal behaviour? What if I want to make some assertions on the output of the
> exception produced by the handler? Is this out of the scope of ControllerTest
> logic or is it ok to test that kind of things inside controller tests?

It is a bad idea to do what you ask, but if you want to know how -
just use the source
https://github.com/cakephp/cakephp/blob/master/lib/Cake/Test/Case/Error/ErrorHandlerTest.php

Your tests should only be testing for (expected) exceptions being
thrown - If you want to test your  exception handler logic - you'd do
that separately, e.g. see link.

What does the exception logic that is being missed do? The question
implies you are misusing exceptions.

AD

-- 
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: Cake optimization

2012-01-02 Thread Dee Johnson
Thank you for the suggestion, I will give it a try.

-- 
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: Cake optimization

2012-01-02 Thread Dee Johnson
I would like to have somewhere ~1 sec load time 

I actually figured out the problem though.  When using persistModel = true 
it actually caused ALOT of unexpected speed results.  I removed it and all 
calls are around 1 - 3 seconds. 

Also, automagic form elements wont load with it for some reason.

see this article 
http://stackoverflow.com/questions/2148416/cakephp-controllerpersistmodel-and-form-automagic

Thanks for the javascript caching suggestion.  I will try that as well.  I 
am maintaining a tool that I created where the sole purpose is modifying / 
inputting data primarily which is why containable worked or me alot.  Any 
other suggestions similar to containable? 

What modifications would you recommend on the OS layer? 

-- 
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: Routing to /img a request to /app/img

2012-01-02 Thread AD7six


On Jan 2, 9:37 pm, Mario  wrote:
> Ty for the answer.
>
> Fixed everywhere, but unfortunately is not an option for an already
> shipped mobile app client...
> Of course future versions will take care of the issue, but I would
> like to solve it server side also for the existing ones.

If you don't simply solve this with mod_rewrite (add a rule ala ^app/
(.*) $1 to your _webroot_ .htaccess file), just route /img/* to a
controller action that uses media view.

AD

-- 
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: Tree Helper Cake 2.0

2012-01-02 Thread AD7six


On Dec 30 2011, 9:45 am, Tilen Majerle 
wrote:
> http://www.megaupload.com/?d=0UI55OY3
>
> This works for me in 2.0 :)

Why on earth would you distribute code via megaupload?

AD

-- 
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: Display both featured AND last posts.

2012-01-02 Thread Kanwal

hi

you can use

$featuredposts=$this->Post->find('all',array('conditions' =>
array('Post.featured' => '1'),'limit' => 10));
$this->set('featured',$eaturedposts);

$lastposts=$this->Post->find('all',array('order' => array('Post.id
DESC'),'limit' => 10));
$this->set('lastposts',$lastposts);

On Jan 2, 8:00 pm, "J."  wrote:
> I want to display both feat. and last posts on my home page.
>
> So, in my Pages controller, I have this :
>
>                 $this->loadModel('Post');
>                 $posts = $this->set('posts', $this->Post->find('all',
> array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
>
> and in my view I use :
>
>  
>
> How can I display latest posts in an other foreach too since I already
> defined it in the controller ?
>
> Thanks for your time !

-- 
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: CAKEPHP PDF File Download Problem MAC PC Safari Browser.

2012-01-02 Thread Kanwal
arif

Are you using download link on website?Then here is answer
link('Pdf', '/files/myfile.pdf'); ?>
or
link('pdf', $this->webroot('files'.DS.'test.pdf'); ?
>
or for newer version of cakephp
link('pdf', $html->webroot('files'.DS.'test.pdf'); ?
>
or
Link Text



On Jan 2, 11:08 am, arif hossen  wrote:
> Dear All,
>
> CAKEPHP Download Problem IN MAC PC Safari Browser :
>
> Currently My PDF File Possible to download by Mozilla, IE, Safari from
> windows.
> When i download pdf file from MAC Pc Safari Browser  then facing problem.
>
> When i download pdf file from mac safari browser then add extra extension
> .html with pdf file name.
>
> I need to download only .pdf extension file.
>
> Example : myfile.pdf.html
>
> Please Give me Suggestion and Solutions.
>
> --
>
> Regards,
> *Mohammad Arif Hossen
> Software Engineer at
> Japan Bangladesh IT(JABA IT)*
> **Cell: +88 01714355911
> Blog :www.arifhossen.wordpress.com

-- 
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: Filter on multiple tags

2012-01-02 Thread Jeremy Burns | Class Outfit
Take a look at this: https://github.com/CakeDC/search  It'll do this for you 
very nicely.


Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 2 Jan 2012, at 18:10:23, Dwayne Hanekamp wrote:

> Hello all,
> 
> I've been struggling on this for the last two days. I'm creating a
> webshop on which people should be able to filter products on multiple
> tags. Database structure is the following:
> 
> Tags => Id | Name
> Products => Id | Category_id | Name | etc...
> Tags_Products | Id | Product_id | Tag_id
> Categories | Id | parent_id | name
> 
> The user can first select a category and each category has
> subcategories which  have products which have their tags. So after
> they've selected a category or subcategory they can filter down using
> the tags of the products in the categories.
> 
> For the find query i made next options array:
> Array ( [fields] => Array ( [0] => DISTINCT Product.id [1] =>
> Product.* ) [conditions] => Array ( [OR] => Array
> ( [Product.Category_id] => 1 [Category.parent_id] => 1 ) [AND] =>
> Array ( [AND] => Array ( [FilterTag.name] => Array ( [0] => smartphone
> [1] => apple ) ) ) ) )
> 
> The 'FilterTag' is a fake model made in the function beneath:
> 'hasOne' => array(
>   'ProductsTag',
>   'FilterTag' => array(
>   'className' => 'Tag',
>   'foreignKey' => false,
>   'conditions' => array('FilterTag.id = 
> ProductsTag.tag_id'),
>   'unique' => true,
> )
> 
> Now the problem is that i want it to find products that have both tags
> in stead of one of the tags. It currently does the next query:
> 
> SELECT DISTINCT `Product`.`id`, `Product`.*, `Product`.`id` FROM
> `products` AS `Product` LEFT JOIN `categories` AS `Category` ON
> (`Product`.`category_id` = `Category`.`id`) LEFT JOIN `products_tags`
> AS `ProductsTag` ON (`ProductsTag`.`product_id` = `Product`.`id`) LEFT
> JOIN `tags` AS `FilterTag` ON (`FilterTag`.`id` =
> `ProductsTag`.`tag_id`) WHERE ((`Product`.`Category_id` = '1') OR
> (`Category`.`parent_id` = 1)) AND `FilterTag`.`name` IN ('smartphone',
> 'apple')
> 
> So it looks for products which have one of the tags. But i want it to
> search for products that have both of the tags.
> 
> I hope you guys can help me, Thanks in advance!
> 
> Dwayne
> 
> -- 
> 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: Display both featured AND last posts.

2012-01-02 Thread Jeremy Burns | Class Outfit
There's no point in doing two identical finds - it's inefficient. If you really 
want two variables with exactly the same content, do this:

$posts = $this->Post->find('all', array('conditions' => array('Post.featured' 
=> '1'),'limit' => 10)));

$this->set('posts', $posts);
$this->set('posts2', $posts);

I'm still a little confused about what you are trying to achieve.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 2 Jan 2012, at 17:53:29, J. wrote:

> Didn't knew this. Thanks a lot, works perfectly !
> 
> On 2 jan, 18:36, Linas Jakucionis  wrote:
>> Hi,
>> 
>> $this->set specifies the variable name that is supposed to be used in
>> the template, so your code snippet should look like this:
>> 
>> $this->set('posts', $this->Post->find('all', array('conditions' =>
>> array('Post.featured' => '1'),'limit' => 10)));
>> $this->set('posts2', $this->Post->find('all',array('conditions' =>
>> array('Post.featured' => '1'),'limit' => 10)));
>> 
>> Linas
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> On Mon, Jan 2, 2012 at 11:38 AM, J.  wrote:
>>> But I can't habe both of them named $posts, right ?
>> 
>>> this->loadModel('Post');
>>>$posts = $this->set('posts', $this->Post->find('all',
>>> array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
>>>$posts2 = $this->set('posts', $this->Post-
 find('all',
>>> array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
>> 
>>> And if I do a  it doesn't work...
>> 
>>> On 2 jan, 17:17, euromark  wrote:
 create a second query, pass the result on to the view and loop over it
 absolutely no different from your above code.
>> 
 On 2 Jan., 16:00, "J."  wrote:
>> 
> I want to display both feat. and last posts on my home page.
>> 
> So, in my Pages controller, I have this :
>> 
> $this->loadModel('Post');
> $posts = $this->set('posts', $this->Post->find('all',
> array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
>> 
> and in my view I use :
>> 
>  
>> 
> How can I display latest posts in an other foreach too since I already
> defined it in the controller ?
>> 
> Thanks for your time !
>> 
>>> --
>>> Our newest site for the community: CakePHP Video 
>>> Tutorialshttp://tv.cakephp.org
>>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
>>> others with their CakePHP related questions.
>> 
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
>>> athttp://groups.google.com/group/cake-php
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php

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


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


Re: Using Configure or other methods to set app-wide "constants"

2012-01-02 Thread Kanwal
You can use a simple way in app_controller like
var $ipaddr=$_SERVER['REMOTE_ADDR'];

and access in any controller function like:
echo $this->ipaddr;


On Jan 2, 7:12 pm, geste  wrote:
> Gary, euromark,
>
> OK, yes I was able use Configure::write in boostrap.php.
>
> If I can just use the CakePHP database connector, I think I'll just
> write a small snippet that looks up that secondary identifier and add
> that to bootstrap.php.
>
> Thanks,
>
> J
>
> On Jan 2, 2:35 pm, bujanga  wrote:
>
>
>
>
>
>
>
> > This is really not a configuration item, though you can set it using
> > Configure::write(). Of course, $_SERVER['REMOTE_ADDR'] must be
> > provided by your web 
> > server.http://php.net/manual/en/reserved.variables.server.php
> > If you are trying to create a user setting, a session cookie would be
> > much more appropriate. Alternatively,  I often log the user's IP
> > address to the DB upon login.
>
> > Gary
>
> > On Mon, Jan 2, 2012 at 3:48 PM, geste  wrote:
> > > All,
>
> > > I am looking for the easiest, most global way to set a couple of app-
> > > wide constants, more or less, that would derive from Apache variables,
> > > specifically $_SERVER['REMOTE_USER'] and $_SERVER['REMOTE_ADDR'] and
> > > that would be used throughout the app both in models and controllers.
>
> > > A Configure:write method in app_controller.php seemed like it might be
> > > the place to set like so:
>
> > >  Configure::write('User.Address',$_SERVER['REMOTE_ADDR']);
>
> > > but it looks like that method only wants text strings for the write
> > > method and anyhow it did not work whether I tried it at top of
> > > app_controller.php or in a beforeFilter function in
> > > app_controller.php.
>
> > > I also tried more generic means such as using PHP getenv like so:
>
> > >  $ipaddr = getenv('REMOTE_ADDR');
>
> > > and that partly works, but I am not seeing a way to make it glovally
> > > available. Using the form
>
> > >  var  $ipaddr = getenv('REMOTE_ADDR');
>
> > > at top of app_controller.php just does not work, but I am guessing I
> > > am misusing that "var" construct.
>
> > > Any thoughts welcome!
>
> > > J
>
> > > --
> > > Our newest site for the community: CakePHP Video 
> > > Tutorialshttp://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php

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


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


Re: How to add varied content in posts?

2012-01-02 Thread euromark
my favorite is bbcode, as well. clean, understandable for visitors and
easy to adjust and extend. it also has a high level of security if
applied correctly.
I also like that it decouples html from the markup.
you can add stuff like [youtube]someid[/youtube] etc which will
translate into the real deal on output.


On 3 Jan., 01:02, Daniel  wrote:
> On Jan 2, 4:16 am, Geoff Douglas  wrote:
>
> > There are several ways to do that.
>
> > Here are a few that I can think of off the top of my head:
>
> > There are wysiwyg (like TinyMCE) editors,
> > OR markup language options such as Textile, or Markdown, or bbCode, or
> > WikiCreole
>
> > If you use any these you will need to add a way for users to upload images,
> > and store them some place that makes sense, so that the user can pull them
> > up.
>
> > Anyways... that's what I know.
>
> Thanks.
>
> I first tried out recruiting parser but could not get it to work.
> Then I found bbcode.php at  http://www.phpclasses.org, which I got
> working.  It does not support images though, but I was able to extend
> it to display images from my applications gallery.

-- 
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: cakephp 2.0.4: How to use Session Component in Plugin Components?

2012-01-02 Thread euromark
did you forget to add
var $components = array('Session')
to this component? that's probably it


On 3 Jan., 02:04, Salines  wrote:
> Undefined property: TwitterAuthComponent::$Session 
> [*APP/Plugin/Twitter/Controller/Component/TwitterAuthComponent.php*, line 
> *133*]
>
> Fatal error: Call to a member function check() on a non-object in
> /home/nix/localhost.dev/cms/Plugin/Twitter/Controller/Component/TwitterAuth 
> Component.php
> on line 133
>
> public function accessTokenSession() {//line 133      *return 
> $this->Session->check('Twitter.Auth.oauth_token') && 
> $this->Session->check('Twitter.Auth.oauth_token_secret');*
>
>
>
>
>
>
>
> }

-- 
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: cakephp 2.0.4: How to use Session Component in Plugin Components?

2012-01-02 Thread Salines


Undefined property: TwitterAuthComponent::$Session 
[*APP/Plugin/Twitter/Controller/Component/TwitterAuthComponent.php*, line *133*]

Fatal error: Call to a member function check() on a non-object in 
/home/nix/localhost.dev/cms/Plugin/Twitter/Controller/Component/TwitterAuthComponent.php
 
on line 133


public function accessTokenSession() {//line 133  *return 
$this->Session->check('Twitter.Auth.oauth_token') && 
$this->Session->check('Twitter.Auth.oauth_token_secret');*

}

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


using $this->Model->validationErrors across associations

2012-01-02 Thread mikeottinger
Hi all, just a quick question. I have a simple model association between a 
Work and Image model with a one-to-many association between the two. When I 
call saveAll on the Work model it'll save the associated images as well. 
But when validation errors occur on the Work and images, it seems that 
$this->Work->validationErrors will only give me the validation errors of 
the work model and not the images. Is there a way, from the controller, to 
get in one shot all of the validation errors across all the associations? 
Or do I need to go digging into each model for them individually?

Thanks in advance!

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


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


Re: Cake 1.3 and localization of time and date

2012-01-02 Thread 清水紘己
You need to see following section of the manual with "LC_TIME" keyword:
http://book.cakephp.org/2.0/en/appendices/new-features-in-cakephp-1-3.html?highlight=lc_time
The Book seems to be unkind for it, TimeHelper, not appendices,
document should have detail information I think!

2012/1/3 MetZ :
> Hi all.
> I am currently "struggling" with localizing my created and modified
> values from db.
>
> I am using the Time helper, and have tried to get it to output real
> nice.
>
> echo $time->niceShort($post['Post']['created']);
>
> This gived me the Today, Yesterday, and Dec 29th 2011, 23:33
>
> Translating of the Today and Yesterday I have done in my locale.po
> file, so they are no problem, but I can not seem to get the Dec 29th
> 2011 to display as: 29 Des 2011 or similar.
>
> How can I get it working? Any suggestions?
> I have all, Jan -> Dec in locale.po file, but they do not translate
> using time helper.
>
> Any and all help! Much Appreciated!
> Thanks!
> -Tom
>
> --
> 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: Using Configure or other methods to set app-wide "constants"

2012-01-02 Thread geste
Gary, euromark,

OK, yes I was able use Configure::write in boostrap.php.

If I can just use the CakePHP database connector, I think I'll just
write a small snippet that looks up that secondary identifier and add
that to bootstrap.php.

Thanks,

J

On Jan 2, 2:35 pm, bujanga  wrote:
> This is really not a configuration item, though you can set it using
> Configure::write(). Of course, $_SERVER['REMOTE_ADDR'] must be
> provided by your web 
> server.http://php.net/manual/en/reserved.variables.server.php
> If you are trying to create a user setting, a session cookie would be
> much more appropriate. Alternatively,  I often log the user's IP
> address to the DB upon login.
>
> Gary
>
>
>
> On Mon, Jan 2, 2012 at 3:48 PM, geste  wrote:
> > All,
>
> > I am looking for the easiest, most global way to set a couple of app-
> > wide constants, more or less, that would derive from Apache variables,
> > specifically $_SERVER['REMOTE_USER'] and $_SERVER['REMOTE_ADDR'] and
> > that would be used throughout the app both in models and controllers.
>
> > A Configure:write method in app_controller.php seemed like it might be
> > the place to set like so:
>
> >  Configure::write('User.Address',$_SERVER['REMOTE_ADDR']);
>
> > but it looks like that method only wants text strings for the write
> > method and anyhow it did not work whether I tried it at top of
> > app_controller.php or in a beforeFilter function in
> > app_controller.php.
>
> > I also tried more generic means such as using PHP getenv like so:
>
> >  $ipaddr = getenv('REMOTE_ADDR');
>
> > and that partly works, but I am not seeing a way to make it glovally
> > available. Using the form
>
> >  var  $ipaddr = getenv('REMOTE_ADDR');
>
> > at top of app_controller.php just does not work, but I am guessing I
> > am misusing that "var" construct.
>
> > Any thoughts welcome!
>
> > J
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

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


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


Re: Using Configure or other methods to set app-wide "constants"

2012-01-02 Thread geste
Thanks for your response.

(This app can only be accessed via an Apache auth module that sets
REMOTE_USER)

On Jan 2, 2:13 pm, euromark  wrote:
> yes, you can use Configure::write()
> that's absolute fine, but try to set it in bootstrap.php if they are
> supposed to be global (side wide)
> that would be a cleaner approach than using some AppController method
> to do so.

Yes, I am trying to determine the earliest point in the process where
I can make these available.  I was able to define a USERAADDR constant
in bootstrap.php but had not tried Configure::Write there.  (Which I
will now do).

I tried to keep my initial post simple, but one complication is that I
also want to set anther global identifier that is kept in the
application's user/person table.  I am figure that I could just drop
some one-off SQL query code in bootstarp.php, but thought I would try
to do it the "Cake way" and so was trying to use existing model/
controller structure.

J

>
> On 2 Jan., 22:48, geste  wrote:
>
>
>
> > All,
>
> > I am looking for the easiest, most global way to set a couple of app-
> > wide constants, more or less, that would derive from Apache variables,
> > specifically $_SERVER['REMOTE_USER'] and $_SERVER['REMOTE_ADDR'] and
> > that would be used throughout the app both in models and controllers.
>
> > A Configure:write method in app_controller.php seemed like it might be
> > the place to set like so:
>
> >   Configure::write('User.Address',$_SERVER['REMOTE_ADDR']);
>
> > but it looks like that method only wants text strings for the write
> > method and anyhow it did not work whether I tried it at top of
> > app_controller.php or in a beforeFilter function in
> > app_controller.php.
>
> > I also tried more generic means such as using PHP getenv like so:
>
> >  $ipaddr = getenv('REMOTE_ADDR');
>
> > and that partly works, but I am not seeing a way to make it glovally
> > available. Using the form
>
> >  var  $ipaddr = getenv('REMOTE_ADDR');
>
> > at top of app_controller.php just does not work, but I am guessing I
> > am misusing that "var" construct.
>
> > Any thoughts welcome!
>
> > J

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


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


Re: How to add varied content in posts?

2012-01-02 Thread Daniel
On Jan 2, 4:16 am, Geoff Douglas  wrote:
> There are several ways to do that.
>
> Here are a few that I can think of off the top of my head:
>
> There are wysiwyg (like TinyMCE) editors,
> OR markup language options such as Textile, or Markdown, or bbCode, or
> WikiCreole
>
> If you use any these you will need to add a way for users to upload images,
> and store them some place that makes sense, so that the user can pull them
> up.
>
> Anyways... that's what I know.

Thanks.

I first tried out recruiting parser but could not get it to work.
Then I found bbcode.php at  http://www.phpclasses.org, which I got
working.  It does not support images though, but I was able to extend
it to display images from my applications gallery.

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


cakephp 2.0.4: How to use Session Component in Plugin Components?

2012-01-02 Thread Salines
Hello, i have trouble to use Session component inside my plugin components.
How to load session component?

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


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


Re: Using Configure or other methods to set app-wide "constants"

2012-01-02 Thread bujanga
This is really not a configuration item, though you can set it using
Configure::write(). Of course, $_SERVER['REMOTE_ADDR'] must be
provided by your web server.
http://php.net/manual/en/reserved.variables.server.php
If you are trying to create a user setting, a session cookie would be
much more appropriate. Alternatively,  I often log the user's IP
address to the DB upon login.

Gary



On Mon, Jan 2, 2012 at 3:48 PM, geste  wrote:
> All,
>
> I am looking for the easiest, most global way to set a couple of app-
> wide constants, more or less, that would derive from Apache variables,
> specifically $_SERVER['REMOTE_USER'] and $_SERVER['REMOTE_ADDR'] and
> that would be used throughout the app both in models and controllers.
>
> A Configure:write method in app_controller.php seemed like it might be
> the place to set like so:
>
>  Configure::write('User.Address',$_SERVER['REMOTE_ADDR']);
>
> but it looks like that method only wants text strings for the write
> method and anyhow it did not work whether I tried it at top of
> app_controller.php or in a beforeFilter function in
> app_controller.php.
>
> I also tried more generic means such as using PHP getenv like so:
>
>  $ipaddr = getenv('REMOTE_ADDR');
>
> and that partly works, but I am not seeing a way to make it glovally
> available. Using the form
>
>  var  $ipaddr = getenv('REMOTE_ADDR');
>
> at top of app_controller.php just does not work, but I am guessing I
> am misusing that "var" construct.
>
> Any thoughts welcome!
>
> J
>
>
>
> --
> 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: Using Configure or other methods to set app-wide "constants"

2012-01-02 Thread euromark
yes, you can use Configure::write()
that's absolute fine, but try to set it in bootstrap.php if they are
supposed to be global (side wide)
that would be a cleaner approach than using some AppController method
to do so.


On 2 Jan., 22:48, geste  wrote:
> All,
>
> I am looking for the easiest, most global way to set a couple of app-
> wide constants, more or less, that would derive from Apache variables,
> specifically $_SERVER['REMOTE_USER'] and $_SERVER['REMOTE_ADDR'] and
> that would be used throughout the app both in models and controllers.
>
> A Configure:write method in app_controller.php seemed like it might be
> the place to set like so:
>
>   Configure::write('User.Address',$_SERVER['REMOTE_ADDR']);
>
> but it looks like that method only wants text strings for the write
> method and anyhow it did not work whether I tried it at top of
> app_controller.php or in a beforeFilter function in
> app_controller.php.
>
> I also tried more generic means such as using PHP getenv like so:
>
>  $ipaddr = getenv('REMOTE_ADDR');
>
> and that partly works, but I am not seeing a way to make it glovally
> available. Using the form
>
>  var  $ipaddr = getenv('REMOTE_ADDR');
>
> at top of app_controller.php just does not work, but I am guessing I
> am misusing that "var" construct.
>
> Any thoughts welcome!
>
> J

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


Using Configure or other methods to set app-wide "constants"

2012-01-02 Thread geste
All,

I am looking for the easiest, most global way to set a couple of app-
wide constants, more or less, that would derive from Apache variables,
specifically $_SERVER['REMOTE_USER'] and $_SERVER['REMOTE_ADDR'] and
that would be used throughout the app both in models and controllers.

A Configure:write method in app_controller.php seemed like it might be
the place to set like so:

  Configure::write('User.Address',$_SERVER['REMOTE_ADDR']);

but it looks like that method only wants text strings for the write
method and anyhow it did not work whether I tried it at top of
app_controller.php or in a beforeFilter function in
app_controller.php.

I also tried more generic means such as using PHP getenv like so:

 $ipaddr = getenv('REMOTE_ADDR');

and that partly works, but I am not seeing a way to make it glovally
available. Using the form

 var  $ipaddr = getenv('REMOTE_ADDR');

at top of app_controller.php just does not work, but I am guessing I
am misusing that "var" construct.

Any thoughts welcome!

J



-- 
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: Function preg-match

2012-01-02 Thread Tilen Majerle
English please ! :)
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/1/2 Munizaga 

> Como diablos saco este mensaje de la primera aplicacion de illasaron,
> estoy con cake 2.0.4
> preg_match() [function.preg-match]: Delimiter must not be alphanumeric
> or backslash
> Por favor una ayuda.
>
> --
> 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


Function preg-match

2012-01-02 Thread Munizaga
Como diablos saco este mensaje de la primera aplicacion de illasaron,
estoy con cake 2.0.4
preg_match() [function.preg-match]: Delimiter must not be alphanumeric
or backslash
Por favor una ayuda.

-- 
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: Routing to /img a request to /app/img

2012-01-02 Thread Mario
Ty for the answer.

Fixed everywhere, but unfortunately is not an option for an already
shipped mobile app client...
Of course future versions will take care of the issue, but I would
like to solve it server side also for the existing ones.

Best,

Mario


On Jan 2, 8:31 pm, euromark  wrote:
> one question:
> is fixing the obvious error in the "poor previous configuration" not
> an option?
> if would probably fix other similar errors, as well
>
> On 2 Jan., 20:09, Mario  wrote:
>
>
> > Hi all!
>
> > One question on routing: due to a poor previous configuration I would
> > need all the requests for image files sent to /app/attachments/... be
> > seen by Cake as sent to /attachments/... (where /attachments is a
> > folder in webroot, just like /img) so that the image can be served
> > instead of getting an "Error: [MissingActionException] Action
> > AppController::attachments() could not be found".
>
> > How can I achieve that?
>
> > I would really appreciate if anyone could point me to the right
> > direction.
>
> > Best,
>
> > Mario

-- 
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: Routing to /img a request to /app/img

2012-01-02 Thread euromark
one question:
is fixing the obvious error in the "poor previous configuration" not
an option?
if would probably fix other similar errors, as well


On 2 Jan., 20:09, Mario  wrote:
> Hi all!
>
> One question on routing: due to a poor previous configuration I would
> need all the requests for image files sent to /app/attachments/... be
> seen by Cake as sent to /attachments/... (where /attachments is a
> folder in webroot, just like /img) so that the image can be served
> instead of getting an "Error: [MissingActionException] Action
> AppController::attachments() could not be found".
>
> How can I achieve that?
>
> I would really appreciate if anyone could point me to the right
> direction.
>
> Best,
>
> Mario

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


Routing to /img a request to /app/img

2012-01-02 Thread Mario
Hi all!

One question on routing: due to a poor previous configuration I would
need all the requests for image files sent to /app/attachments/... be
seen by Cake as sent to /attachments/... (where /attachments is a
folder in webroot, just like /img) so that the image can be served
instead of getting an "Error: [MissingActionException] Action
AppController::attachments() could not be found".

How can I achieve that?

I would really appreciate if anyone could point me to the right
direction.

Best,

Mario

-- 
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: Cake is NOT able to connect to the database.

2012-01-02 Thread Renato de Freitas Freire
You are absolutely right.

I just enabled pdo_mysql on my php.ini and it worked!

Ronghua: try this hint. Worked for me.

--
Renato Freire




2012/1/1 清水��己 

> My last guess is pdo mysql is not enabled.
>
> 2012/1/1 Renato de Freitas Freire :
> > I had the same problem when start using cake 2.0.4 on my work, but I
> tried
> > it on my pc and it work fine.
> >
> > It might be something with your server configuration.
> >
> > I will doble check it on monday on my work.
> > Any news I tell you.
> >
> > But you can try it on other server, or try to upgrade your mysql, or
> > something like that.
> >
> > --
> > Renato Freire
> >
> >
> >
> >
> > 2012/1/1 Ronghua 
> >>
> >> Yes, I grant all privileges to the user. Actually, if I write a php
> >> file to connect to mysql directly, I can query the result from table.
> >>
> >>  >> $host='localhost';
> >> $user_name='testuser';
> >> $password='123456'; //这里是你设置的密码
> >>
> >> $conn=mysql_connect($host,$user_name,$password);
> >> if (!$conn)
> >> {
> >> die('connect fail:'.mysql_error());
> >> }
> >> echo 'connect success!';
> >> mysql_select_db("cake_testing", $conn);
> >> $result = mysql_query("SELECT * FROM test");
> >> while($row = mysql_fetch_array($result))
> >> {
> >> echo $row['ref']." ".$row['content'];
> >> echo "";
> >> }
> >> if (mysql_close($conn))
> >> {
> >> echo '...';
> >> echo '到数据库的连接已经成功关闭';
> >> }
> >> ?>
> >>
> >> On 1月1日, 上午10时39分, 清水��己  wrote:
> >> > Did you have done GRANT it?
> >> >
> >> > 2012/1/1 Ronghua :
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > > I also tried my root login configuration, but it doesn't work as
> well.
> >> >
> >> > > On 1月1日, 上午1时51分, "Timothy O'Reilly" <
> timothy.john.orei...@gmail.com>
> >> > > wrote:
> >> > >> I'm sure you have tried it, but have you tried Login "Root" and
> >> > >> Password
> >> > >> "Root"?
> >> > >> Regards,
> >> > >> Tim
> >> >
> >> > >> On Sat, Dec 31, 2011 at 2:59 AM, Ronghua 
> >> > >> wrote:
> >> > >> > Hi, today is first day I'm using cake. I have setup CakePHP
> 2.0.4.
> >> > >> > In
> >> > >> > \app\Config\database.php, the configuration is as below
> >> > >> >  >> >
> >> > >> > class DATABASE_CONFIG {
> >> > >> >public $default = array(
> >> > >> >'datasource' => 'Database/Mysql',
> >> > >> >'persistent' => false,
> >> > >> >'host' => 'localhost',
> >> > >> >'login' => 'testuser',
> >> > >> >'password' => '123456',
> >> > >> >'database' => '',
> >> > >> >'prefix' => '',
> >> > >> >'encoding' => ''
> >> > >> >);
> >> > >> > }
> >> >
> >> > >> > I can connect to mysql with MySQLQueryBrowser by testuser and pwd
> >> > >> > 123456, but I can't connect to database through Cake. Here is the
> >> > >> > description in the website. Can someone help me here? From the
> >> > >> > website
> >> > >> > reference, seems nothing else need to change.
> >> >
> >> > >> > Your version of PHP is 5.2.6 or higher.
> >> >
> >> > >> > Your tmp directory is writable.
> >> >
> >> > >> > The FileEngine is being used for caching. To change the config
> edit
> >> > >> > APP/Config/core.php
> >> >
> >> > >> > Your database configuration file is present.
> >> >
> >> > >> > Cake is NOT able to connect to the database.
> >> >
> >> > >> > --
> >> > >> > Our newest site for the community: CakePHP Video Tutorials
> >> > >> >http://tv.cakephp.org
> >> > >> > Check out the new CakePHP Questions
> >> > >> > sitehttp://ask.cakephp.organdhelp
> >> > >> > others with their CakePHP related questions.
> >> >
> >> > >> > To unsubscribe from this group, send email to
> >> > >> > cake-php+unsubscr...@googlegroups.com For more options, visit
> this
> >> > >> > group
> >> > >> > athttp://groups.google.com/group/cake-php
> >> >
> >> > > --
> >> > > Our newest site for the community: CakePHP Video
> >> > > Tutorialshttp://tv.cakephp.org
> >> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
> help
> >> > > others with their CakePHP related questions.
> >> >
> >> > > To unsubscribe from this group, send email to
> >> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> >> > > group athttp://groups.google.com/group/cake-php
> >>
> >> --
> >> Our newest site for the community: CakePHP Video Tutorials
> >> http://tv.cakephp.org
> >> Check out the new CakePHP Questions site http://ask.cakephp.org and
> help
> >> others with their CakePHP related questions.
> >>
> >>
> >> To unsubscribe from this group, send email to
> >> cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> >> at http://groups.google.com/group/cake-php
> >
> >
> > --
> > 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 o

Dropdownfeld

2012-01-02 Thread Ivo Wolgensinger
Hallo zusammen

Ich wende zum ersten Mal cakephp an und habe auch bereits eine erste
Ansicht mit Abfrage hinbekommen. Nun möchte ich in einem Formular ein
Dropdown-Feld generieren aus einer Tabelle, die bisher nichts mit dem
Controller zu tun hat. Die Tabelle heisst "countries" und angezeigt
werden soll das Feld "printablename" (alphabetisch aufsteigend
sortiert) mit value "iso2".

Was ich bis jetzt herausgefunden habe ist:

Im Controller soll sowas stehen wie:
-
function beforeFilter() {
// conditional ensures only actions that need the vars will
receive them
if (in_array($this->action, array('add', 'edit'))) {
$this->set('countries', $this->Country->find('list'));
}
}
-
Hiermit kann ich die Daten für die views "add" und "edit" verwenden.

Aber bereits hier generiert es mit einen Fehler:
"Call to a member function find() on a non-object in ..." -> Zeile
startend mit $this...

Leider finde ich nirgend eine ausführliche Anleitung wie ich dies
gestalte von A bis Z.

Für Hinweise bin ich Euch dankbar!

Beste Grüsse

Ivo

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


Filter on multiple tags

2012-01-02 Thread Dwayne Hanekamp
Hello all,

I've been struggling on this for the last two days. I'm creating a
webshop on which people should be able to filter products on multiple
tags. Database structure is the following:

Tags => Id | Name
Products => Id | Category_id | Name | etc...
Tags_Products | Id | Product_id | Tag_id
Categories | Id | parent_id | name

The user can first select a category and each category has
subcategories which  have products which have their tags. So after
they've selected a category or subcategory they can filter down using
the tags of the products in the categories.

For the find query i made next options array:
Array ( [fields] => Array ( [0] => DISTINCT Product.id [1] =>
Product.* ) [conditions] => Array ( [OR] => Array
( [Product.Category_id] => 1 [Category.parent_id] => 1 ) [AND] =>
Array ( [AND] => Array ( [FilterTag.name] => Array ( [0] => smartphone
[1] => apple ) ) ) ) )

The 'FilterTag' is a fake model made in the function beneath:
'hasOne' => array(
'ProductsTag',
'FilterTag' => array(
'className' => 'Tag',
'foreignKey' => false,
'conditions' => array('FilterTag.id = 
ProductsTag.tag_id'),
'unique' => true,
)

Now the problem is that i want it to find products that have both tags
in stead of one of the tags. It currently does the next query:

SELECT DISTINCT `Product`.`id`, `Product`.*, `Product`.`id` FROM
`products` AS `Product` LEFT JOIN `categories` AS `Category` ON
(`Product`.`category_id` = `Category`.`id`) LEFT JOIN `products_tags`
AS `ProductsTag` ON (`ProductsTag`.`product_id` = `Product`.`id`) LEFT
JOIN `tags` AS `FilterTag` ON (`FilterTag`.`id` =
`ProductsTag`.`tag_id`) WHERE ((`Product`.`Category_id` = '1') OR
(`Category`.`parent_id` = 1)) AND `FilterTag`.`name` IN ('smartphone',
'apple')

So it looks for products which have one of the tags. But i want it to
search for products that have both of the tags.

I hope you guys can help me, Thanks in advance!

Dwayne

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


Cake 1.3 and localization of time and date

2012-01-02 Thread MetZ
Hi all.
I am currently "struggling" with localizing my created and modified
values from db.

I am using the Time helper, and have tried to get it to output real
nice.

echo $time->niceShort($post['Post']['created']);

This gived me the Today, Yesterday, and Dec 29th 2011, 23:33

Translating of the Today and Yesterday I have done in my locale.po
file, so they are no problem, but I can not seem to get the Dec 29th
2011 to display as: 29 Des 2011 or similar.

How can I get it working? Any suggestions?
I have all, Jan -> Dec in locale.po file, but they do not translate
using time helper.

Any and all help! Much Appreciated!
Thanks!
-Tom

-- 
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: Display both featured AND last posts.

2012-01-02 Thread J.
Didn't knew this. Thanks a lot, works perfectly !

On 2 jan, 18:36, Linas Jakucionis  wrote:
> Hi,
>
> $this->set specifies the variable name that is supposed to be used in
> the template, so your code snippet should look like this:
>
> $this->set('posts', $this->Post->find('all', array('conditions' =>
> array('Post.featured' => '1'),'limit' => 10)));
> $this->set('posts2', $this->Post->find('all',array('conditions' =>
> array('Post.featured' => '1'),'limit' => 10)));
>
> Linas
>
>
>
>
>
>
>
> On Mon, Jan 2, 2012 at 11:38 AM, J.  wrote:
> > But I can't habe both of them named $posts, right ?
>
> > this->loadModel('Post');
> >                $posts = $this->set('posts', $this->Post->find('all',
> > array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
> >                $posts2 = $this->set('posts', $this->Post-
> >>find('all',
> > array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
>
> > And if I do a  it doesn't work...
>
> > On 2 jan, 17:17, euromark  wrote:
> >> create a second query, pass the result on to the view and loop over it
> >> absolutely no different from your above code.
>
> >> On 2 Jan., 16:00, "J."  wrote:
>
> >> > I want to display both feat. and last posts on my home page.
>
> >> > So, in my Pages controller, I have this :
>
> >> >                 $this->loadModel('Post');
> >> >                 $posts = $this->set('posts', $this->Post->find('all',
> >> > array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
>
> >> > and in my view I use :
>
> >> >  
>
> >> > How can I display latest posts in an other foreach too since I already
> >> > defined it in the controller ?
>
> >> > Thanks for your time !
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

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


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


Re: Display both featured AND last posts.

2012-01-02 Thread Linas Jakucionis
Hi,

$this->set specifies the variable name that is supposed to be used in
the template, so your code snippet should look like this:

$this->set('posts', $this->Post->find('all', array('conditions' =>
array('Post.featured' => '1'),'limit' => 10)));
$this->set('posts2', $this->Post->find('all',array('conditions' =>
array('Post.featured' => '1'),'limit' => 10)));

Linas

On Mon, Jan 2, 2012 at 11:38 AM, J.  wrote:
> But I can't habe both of them named $posts, right ?
>
> this->loadModel('Post');
>                $posts = $this->set('posts', $this->Post->find('all',
> array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
>                $posts2 = $this->set('posts', $this->Post-
>>find('all',
> array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
>
> And if I do a  it doesn't work...
>
>
>
> On 2 jan, 17:17, euromark  wrote:
>> create a second query, pass the result on to the view and loop over it
>> absolutely no different from your above code.
>>
>> On 2 Jan., 16:00, "J."  wrote:
>>
>>
>>
>>
>>
>>
>>
>> > I want to display both feat. and last posts on my home page.
>>
>> > So, in my Pages controller, I have this :
>>
>> >                 $this->loadModel('Post');
>> >                 $posts = $this->set('posts', $this->Post->find('all',
>> > array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
>>
>> > and in my view I use :
>>
>> >  
>>
>> > How can I display latest posts in an other foreach too since I already
>> > defined it in the controller ?
>>
>> > Thanks for your time !
>
> --
> 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: Display both featured AND last posts.

2012-01-02 Thread J.
But I can't habe both of them named $posts, right ?

this->loadModel('Post');
$posts = $this->set('posts', $this->Post->find('all',
array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
$posts2 = $this->set('posts', $this->Post-
>find('all',
array('conditions' => array('Post.featured' => '1'),'limit' => 10)));

And if I do a  it doesn't work...



On 2 jan, 17:17, euromark  wrote:
> create a second query, pass the result on to the view and loop over it
> absolutely no different from your above code.
>
> On 2 Jan., 16:00, "J."  wrote:
>
>
>
>
>
>
>
> > I want to display both feat. and last posts on my home page.
>
> > So, in my Pages controller, I have this :
>
> >                 $this->loadModel('Post');
> >                 $posts = $this->set('posts', $this->Post->find('all',
> > array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
>
> > and in my view I use :
>
> >  
>
> > How can I display latest posts in an other foreach too since I already
> > defined it in the controller ?
>
> > Thanks for your time !

-- 
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: Display both featured AND last posts.

2012-01-02 Thread euromark
create a second query, pass the result on to the view and loop over it
absolutely no different from your above code.


On 2 Jan., 16:00, "J."  wrote:
> I want to display both feat. and last posts on my home page.
>
> So, in my Pages controller, I have this :
>
>                 $this->loadModel('Post');
>                 $posts = $this->set('posts', $this->Post->find('all',
> array('conditions' => array('Post.featured' => '1'),'limit' => 10)));
>
> and in my view I use :
>
>  
>
> How can I display latest posts in an other foreach too since I already
> defined it in the controller ?
>
> Thanks for your time !

-- 
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: Redirect a user if he wants to see a page when logged in

2012-01-02 Thread J.
Thanks a lot !

On 2 jan, 15:32, luca capra  wrote:
> In the controller you can use either:
>
> if($this->Auth->user("User.id")){
>    $this->redirect("/homepage2");
>    // or
>    $this->render("homepage2");
>
> }
>
> Il 02/01/2012 14:42, Tilen Majerle ha scritto:
>
>
>
>
>
>
>
> > you want to display some content only, if user is logged in right ?
>
> > you can do in a view something like that
>
> > if ($this->Session->check('Auth.User.id '))
> > {
> > //render element for example
> > }
> > --
> > Lep pozdrav, Tilen Majerle
> >http://majerle.eu
>
> > 2012/1/2 J.  > >
>
> >     I want to display a complete other homepage when user is logged in,
> >     but I don't want him to access the logged out user.
>
> >     I thought I could use something like this :
>
> >      >     if ($this->Session->check('Auth.User.id ')) {
> >     echo("logged");
> >     }
> >     ?>
>
> >     and replacing the echo by $this->redirect, but this doesn't work in a
> >     View.
>
> >     Any help ?
>
> >     --
> >     Our newest site for the community: CakePHP Video Tutorials
> >    http://tv.cakephp.org
> >     Check out the new CakePHP Questions sitehttp://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 athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
> > help others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > group athttp://groups.google.com/group/cake-php

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


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


Display both featured AND last posts.

2012-01-02 Thread J.
I want to display both feat. and last posts on my home page.

So, in my Pages controller, I have this :

$this->loadModel('Post');
$posts = $this->set('posts', $this->Post->find('all',
array('conditions' => array('Post.featured' => '1'),'limit' => 10)));

and in my view I use :

 


How can I display latest posts in an other foreach too since I already
defined it in the controller ?

Thanks for your time !

-- 
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: Question about posts index and auth issue

2012-01-02 Thread heohni
But now I not a step further?
Does anyone has a hint for 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


Re: OpenID server/provider component

2012-01-02 Thread Rex@Cake
Requesting the Gurus again.
Any help would be a great favor.

-- 
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: Question about posts index and auth issue

2012-01-02 Thread Jeremy Burns | Class Outfit
Surely setting the allow variable is enough. If the user is not logged, they 
are not allowed. Simple. No need to check further, let the auth component do it.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 2 Jan 2012, at 14:39:11, luca capra wrote:

> A simple way could be checking if the user is logged in, like
> 
> public function beforeFilter() {
>parent::beforeFilter();
>if($this->Auth->user()) {
> $this->Auth->allow(array('index', 'frontindex'));
>}
> }
> 
> 
> Il 02/01/2012 10:18, heohni ha scritto:
>> Hi,
>> 
>> I have a page, where I want to display my blog posts by calling a
>> requestAction to a function called frontindex() function.
>> public function frontindex() {
>> $all = $this->Post->find('all', array('order' =>  'created
>> DESC'));
>> $this->set('posts', $all);
>> return $all;
>> }
>> I am only displaying the headline and the body, nothing else.
>> 
>> To add new posts and to edit I want the admin to login.
>> After login, the admin should see the index(), with add(), edit() and
>> delete() function.
>> 
>> I wonder now, how to do this best.
>> 
>> In my posts controller I have this:
>> public function beforeFilter() {
>> parent::beforeFilter();
>> $this->Auth->allow(array('frontindex'));
>> }
>> 
>> BUT!
>> 
>> After submitting the login form, I can never reach the index() I just
>> keep seeing the login form.
>> In my AppController I have:
>> public $components = array(
>> 'Session',
>> 'Auth' =>  array(
>> 'loginRedirect' =>  array('controller' =>  'posts', 'action'
>> =>  'index'),
>> 'logoutRedirect' =>  array('controller' =>  'pages',
>> 'action' =>  'display', 'home'),
>> 'authorize' =>  array('Controller'),
>> 'authError' =>  'Bitte loggen Sie sich ein!'
>> )
>> );
>> 
>> 
>> It  only works, when I do this:
>> public function beforeFilter() {
>> parent::beforeFilter();
>> $this->Auth->allow(array('index', 'frontindex'));
>> }
>> Adding the index.
>> BUT then my index is open to the public.
>> 
>> I am totally lost in this, how the hell can I make it right?
>> Please give me some advice!
>> 
> 
> -- 
> 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


Cakephp 2.0 ACL

2012-01-02 Thread abhilash
Currently working over cakephp 2.0.4. i have two users "admin" and
"user". i'm stuck over the part where we need to grant permissions for
the "user" or a regular user. do i need to type any commands inside
the app folder ?

-- 
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: Question about posts index and auth issue

2012-01-02 Thread luca capra

A simple way could be checking if the user is logged in, like

public function beforeFilter() {
parent::beforeFilter();
if($this->Auth->user()) {
 $this->Auth->allow(array('index', 'frontindex'));
}
}


Il 02/01/2012 10:18, heohni ha scritto:

Hi,

I have a page, where I want to display my blog posts by calling a
requestAction to a function called frontindex() function.
public function frontindex() {
 $all = $this->Post->find('all', array('order' =>  'created
DESC'));
 $this->set('posts', $all);
 return $all;
 }
I am only displaying the headline and the body, nothing else.

To add new posts and to edit I want the admin to login.
After login, the admin should see the index(), with add(), edit() and
delete() function.

I wonder now, how to do this best.

In my posts controller I have this:
public function beforeFilter() {
 parent::beforeFilter();
 $this->Auth->allow(array('frontindex'));
 }

BUT!

After submitting the login form, I can never reach the index() I just
keep seeing the login form.
In my AppController I have:
public $components = array(
 'Session',
 'Auth' =>  array(
 'loginRedirect' =>  array('controller' =>  'posts', 'action'
=>  'index'),
 'logoutRedirect' =>  array('controller' =>  'pages',
'action' =>  'display', 'home'),
 'authorize' =>  array('Controller'),
 'authError' =>  'Bitte loggen Sie sich ein!'
 )
 );


It  only works, when I do this:
public function beforeFilter() {
 parent::beforeFilter();
 $this->Auth->allow(array('index', 'frontindex'));
 }
Adding the index.
BUT then my index is open to the public.

I am totally lost in this, how the hell can I make it right?
Please give me some advice!



--
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: Redirect a user if he wants to see a page when logged in

2012-01-02 Thread luca capra

In the controller you can use either:

if($this->Auth->user("User.id")){
  $this->redirect("/homepage2");
  // or
  $this->render("homepage2");
}

Il 02/01/2012 14:42, Tilen Majerle ha scritto:

you want to display some content only, if user is logged in right ?

you can do in a view something like that

if ($this->Session->check('Auth.User.id '))
{
//render element for example
}
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/1/2 J. >


I want to display a complete other homepage when user is logged in,
but I don't want him to access the logged out user.

I thought I could use something like this :


Session->check('Auth.User.id ')) {
echo("logged");
}
?>

and replacing the echo by $this->redirect, but this doesn't work in a
View.

Any 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


--
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: Redirect a user if he wants to see a page when logged in

2012-01-02 Thread Tilen Majerle
you want to display some content only, if user is logged in right ?

you can do in a view something like that

if ($this->Session->check('Auth.User.id'))
{
//render element for example
}
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/1/2 J. 

> I want to display a complete other homepage when user is logged in,
> but I don't want him to access the logged out user.
>
> I thought I could use something like this :
>
>
>  if ($this->Session->check('Auth.User.id')) {
> echo("logged");
> }
> ?>
>
> and replacing the echo by $this->redirect, but this doesn't work in a
> View.
>
> Any 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
>

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


Redirect a user if he wants to see a page when logged in

2012-01-02 Thread J.
I want to display a complete other homepage when user is logged in,
but I don't want him to access the logged out user.

I thought I could use something like this :


Session->check('Auth.User.id')) {
echo("logged");
}
?>

and replacing the echo by $this->redirect, but this doesn't work in a
View.

Any 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


session.gc_maxlifetime

2012-01-02 Thread euromark
Woudnt it make sense for the CakeSession to modify the
session.gc_maxlifetime param, as well?
As of right now it just sets the other params.
But the session file still gets "deleted" way too soon in many cases
The default setting is absurd: "1440" => 24 minutes

The question is - in what cases does the server use gc_maxlifetime to
run the garbige collector?
I know for a fact: php, cake
what about cache and database? they seem to use the values we provide
in the core.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 access to $this->webroot controller's variable from a model?

2012-01-02 Thread Laerte M. Rodrigues
if they have the absolute path, use const WEBROOT_DIR

2012/1/2 Tilen Majerle 

> he is probably need absolute path for webroot, not browser :)
> --
> Lep pozdrav, Tilen Majerle
> http://majerle.eu
>
>
>
> 2012/1/2 Laerte M. Rodrigues 
>
>> I use Cakephp 2.0 and the static method Helper::url('/') return the URL
>> from WebRoot
>>
>>
>> 2012/1/2 清水紘己 
>>
>>> >Laerte M. Rodrigues
>>> You meant Router::url(), right?
>>>
>>> It will return proper value through web, but not in cli at edge cases.
>>> Recommended way is manually to use Model::set() method or receive
>>> value via property, like $Post->webroot = $this->webroot(or
>>> Post::$webroot = ...).
>>> Because testing it is harder in cli test runner.
>>>
>>> 2012/1/2 Laerte M. Rodrigues :
>>> > use Helper::url('/')
>>> >
>>> >
>>> > 2012/1/2 byqsri 
>>> >>
>>> >> Hi
>>> >> I would ask how can I access to "$this->webroot" controller's variable
>>> >> from a model?
>>> >> Many Thanks
>>> >> Marco
>>> >>
>>> >> --
>>> >> 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
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > Grato,
>>> >
>>> > Laerte Mateus Rodrigues
>>> > Mestrando em informática (PUC Minas)
>>> >
>>> >
>>> > --
>>> > 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
>>>
>>
>>
>>
>> --
>> Grato,
>>
>> Laerte Mateus Rodrigues
>> Mestrando em informática (PUC Minas)
>>
>>  --
>> 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
>



-- 
Grato,

Laerte Mateus Rodrigues
Mestrando em informática (PUC Minas)

-- 
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: Extend ControllerTestCase

2012-01-02 Thread Matteo Landi
Bump!

On Dec/28, Matteo Landi wrote:
> Excuse me for bringing up this old topic, but I have one more question.
> 
> My TestController wrapper object contains a method which tests the
> authentication layer (it's a custom layer, not the one shipped within 
> cakephp);
> consequently all the controllers' tests can easily issue
> $this->testAuthKeys(...) and check whether the authentication layer has been
> correctly implemented by tested controllers.
> 
> The problem is that if I assign to the aforementioned function the name
> ``testAuthLayer'' (or ``test*'' in general), the testsuite will try and test
> the method itself. Is there a way to avoid this? (other than workarounds like
> $this->_testAuthKeys..)
> 
> 
> Regards,
> Matteo
> 
> On Dec/11, Matteo Landi wrote:
> > Thank for the fast response:
> > - placed the wrapper inside app/Lib/Test
> > - added App::uses('MyWrapper...', 'Test') on top of all my controllers tests
> > - changed 'extends ControllerTestCase' to 'extends MyWrapper...'
> > et voila!
> > 
> > 
> > Regards,
> > Matteo
> > 
> > On Sun, Dec 11, 2011 at 11:54 AM, euromark  
> > wrote:
> > > also create a package name for it (e.g. Test)
> > >
> > > App::uses('My...', 'Test');
> > > App::uses('My...', 'PluginName.Test');
> > >
> > >
> > > On 11 Dez., 11:52, euromark  wrote:
> > >> I place mine in the Lib folder
> > >> either plugin (cross app) or app Lib folder.
> > >> in 2.0 you can
> > >>
> > >> On 11 Dez., 11:30, Matteo Landi  wrote:
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >> > Hi,
> > >> > where is the right place to put a class which extends and add some
> > >> > functionalities to ControllerTestCase so that I can it inside all my
> > >> > controllers tests? Imagine all my controllers tests implement a
> > >> > testAction wrapper: it would be handy to extend ControllerTestCase,
> > >> > implement such wrapper in there, and finally make all my tests extend
> > >> > MyControllerTestCase instead of the legacy one.
> > >>
> > >> > Regards,
> > >> > Matteo
> > >>
> > >> > --http://www.matteolandi.net/
> > >
> > > --
> > > 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
> > >
> > 
> > 
> > 
> > -- 
> > http://www.matteolandi.net/
> 
> -- 
> http://www.matteolandi.net

-- 
http://www.matteolandi.net

-- 
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: Test controllers throwing exceptions

2012-01-02 Thread Matteo Landi
Bump!

On Dec/28, Matteo Landi wrote:
> Hi everybody,
> 
> I have a custom exception handler for all the exceptions raised inside
> controllers; when I run the controllers' testsuite, I noticed that exceptions
> are propagated to the tests instead of being handled by my handler. Is this 
> the
> normal behaviour? What if I want to make some assertions on the output of the
> exception produced by the handler? Is this out of the scope of ControllerTest
> logic or is it ok to test that kind of things inside controller tests?
> 
> 
> Regards,
> Matteo
> 
> -- 
> http://www.matteolandi.net

-- 
http://www.matteolandi.net

-- 
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 access to $this->webroot controller's variable from a model?

2012-01-02 Thread Tilen Majerle
he is probably need absolute path for webroot, not browser :)
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/1/2 Laerte M. Rodrigues 

> I use Cakephp 2.0 and the static method Helper::url('/') return the URL
> from WebRoot
>
>
> 2012/1/2 清水紘己 
>
>> >Laerte M. Rodrigues
>> You meant Router::url(), right?
>>
>> It will return proper value through web, but not in cli at edge cases.
>> Recommended way is manually to use Model::set() method or receive
>> value via property, like $Post->webroot = $this->webroot(or
>> Post::$webroot = ...).
>> Because testing it is harder in cli test runner.
>>
>> 2012/1/2 Laerte M. Rodrigues :
>> > use Helper::url('/')
>> >
>> >
>> > 2012/1/2 byqsri 
>> >>
>> >> Hi
>> >> I would ask how can I access to "$this->webroot" controller's variable
>> >> from a model?
>> >> Many Thanks
>> >> Marco
>> >>
>> >> --
>> >> 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
>> >
>> >
>> >
>> >
>> > --
>> > Grato,
>> >
>> > Laerte Mateus Rodrigues
>> > Mestrando em informática (PUC Minas)
>> >
>> >
>> > --
>> > 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
>>
>
>
>
> --
> Grato,
>
> Laerte Mateus Rodrigues
> Mestrando em informática (PUC Minas)
>
>  --
> 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 access to $this->webroot controller's variable from a model?

2012-01-02 Thread Laerte M. Rodrigues
I use Cakephp 2.0 and the static method Helper::url('/') return the URL
from WebRoot

2012/1/2 清水紘己 

> >Laerte M. Rodrigues
> You meant Router::url(), right?
>
> It will return proper value through web, but not in cli at edge cases.
> Recommended way is manually to use Model::set() method or receive
> value via property, like $Post->webroot = $this->webroot(or
> Post::$webroot = ...).
> Because testing it is harder in cli test runner.
>
> 2012/1/2 Laerte M. Rodrigues :
> > use Helper::url('/')
> >
> >
> > 2012/1/2 byqsri 
> >>
> >> Hi
> >> I would ask how can I access to "$this->webroot" controller's variable
> >> from a model?
> >> Many Thanks
> >> Marco
> >>
> >> --
> >> 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
> >
> >
> >
> >
> > --
> > Grato,
> >
> > Laerte Mateus Rodrigues
> > Mestrando em informática (PUC Minas)
> >
> >
> > --
> > 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
>



-- 
Grato,

Laerte Mateus Rodrigues
Mestrando em informática (PUC Minas)

-- 
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 access to $this->webroot controller's variable from a model?

2012-01-02 Thread 清水紘己
>Laerte M. Rodrigues
You meant Router::url(), right?

It will return proper value through web, but not in cli at edge cases.
Recommended way is manually to use Model::set() method or receive
value via property, like $Post->webroot = $this->webroot(or
Post::$webroot = ...).
Because testing it is harder in cli test runner.

2012/1/2 Laerte M. Rodrigues :
> use Helper::url('/')
>
>
> 2012/1/2 byqsri 
>>
>> Hi
>> I would ask how can I access to "$this->webroot" controller's variable
>> from a model?
>> Many Thanks
>> Marco
>>
>> --
>> 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
>
>
>
>
> --
> Grato,
>
> Laerte Mateus Rodrigues
> Mestrando em informática (PUC Minas)
>
>
> --
> 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 access to $this->webroot controller's variable from a model?

2012-01-02 Thread Laerte M. Rodrigues
use Helper::url('/')

2012/1/2 byqsri 

> Hi
> I would ask how can I access to "$this->webroot" controller's variable
> from a model?
> Many Thanks
> Marco
>
> --
> 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
>



-- 
Grato,

Laerte Mateus Rodrigues
Mestrando em informática (PUC Minas)

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


How access to $this->webroot controller's variable from a model?

2012-01-02 Thread byqsri
Hi
I would ask how can I access to "$this->webroot" controller's variable
from a model?
Many Thanks
Marco

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


Question about posts index and auth issue

2012-01-02 Thread heohni
Hi,

I have a page, where I want to display my blog posts by calling a
requestAction to a function called frontindex() function.
public function frontindex() {
$all = $this->Post->find('all', array('order' => 'created
DESC'));
$this->set('posts', $all);
return $all;
}
I am only displaying the headline and the body, nothing else.

To add new posts and to edit I want the admin to login.
After login, the admin should see the index(), with add(), edit() and
delete() function.

I wonder now, how to do this best.

In my posts controller I have this:
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow(array('frontindex'));
}

BUT!

After submitting the login form, I can never reach the index() I just
keep seeing the login form.
In my AppController I have:
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array('controller' => 'posts', 'action'
=> 'index'),
'logoutRedirect' => array('controller' => 'pages',
'action' => 'display', 'home'),
'authorize' => array('Controller'),
'authError' => 'Bitte loggen Sie sich ein!'
)
);


It  only works, when I do this:
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow(array('index', 'frontindex'));
}
Adding the index.
BUT then my index is open to the public.

I am totally lost in this, how the hell can I make it right?
Please give me some advice!

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


Question about logic

2012-01-02 Thread heohni
Hi,

I have a page, where I want to display my blog posts by calling a
requestAction to a function called frontindex() function.
public function frontindex() {
$all = $this->Post->find('all', array('order' => 'created
DESC'));
$this->set('posts', $all);
return $all;
}
I am only displaying the headline and the body, nothing else.

To add new posts and to edit I want the admin to login.
After login, the admin should see the index(), with add(), edit() and
delete() function.

I wonder now, how to do this best.

In my posts controller I have this:
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow(array('frontindex'));
}

BUT!

After submitting the login form, I can never reach the index() I just
keep seeing the login form.
In my AppController I have:
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array('controller' => 'posts', 'action'
=> 'index'),
'logoutRedirect' => array('controller' => 'pages',
'action' => 'display', 'home'),
'authorize' => array('Controller'),
'authError' => 'Bitte loggen Sie sich ein!'
)
);


It  only works, when I do this:
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow(array('index', 'frontindex'));
}
Adding the index.
BUT then my index is open to the public.

I am totally lost in this, how the hell can I make it right?
Please give me some advice!

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