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

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

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

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 marco.rizze...@gmail.com 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

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

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 清水紘己 hiromi2...@gmail.com 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()

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 laertemat...@gmail.com I use Cakephp 2.0 and the static method Helper::url('/') return the URL from WebRoot 2012/1/2 清水紘己 hiromi2...@gmail.com

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

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'

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 tilen.maje...@gmail.com he is probably need absolute path for webroot, not browser :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/1/2 Laerte M. Rodrigues laertemat...@gmail.com I use Cakephp 2.0 and

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

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 : ?php if ($this-Session-check('Auth.User.id')) { echo(logged); } ? and replacing the echo by $this-redirect, but this doesn't work

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. contact.mysparet...@gmail.com I want to display

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

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

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

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

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

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

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

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 luca.ca...@gmail.com 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

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. contact.mysparet...@gmail.com wrote: I want to display both feat. and last posts on my home page. So, in my Pages controller, I have this :              

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'

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

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 lin...@gmail.com 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',

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

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

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

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 清水��己 hiromi2...@gmail.com My last guess is pdo mysql is not enabled. 2012/1/1 Renato de Freitas Freire renat...@gmail.com: I had the same

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

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 mario.calli...@gmail.com wrote: Hi all! One question on routing: due to a poor previous configuration I would need all the

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

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

Re: Function preg-match

2012-01-02 Thread Tilen Majerle
English please ! :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/1/2 Munizaga francisco.muniza...@gmail.com 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

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

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 jim.ho...@gmail.com wrote: All, I am looking for

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

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

Re: How to add varied content in posts?

2012-01-02 Thread Daniel
On Jan 2, 4:16 am, Geoff Douglas drdouglas...@gmail.com 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

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 dereurom...@googlemail.com 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

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 buja...@gmail.com

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

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

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

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 nikola.parad...@gmail.com wrote: Undefined property: TwitterAuthComponent::$Session [*APP/Plugin/Twitter/Controller/Component/TwitterAuthComponent.php*, line *133*]

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

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 jim.ho...@gmail.com wrote: Gary, euromark, OK, yes I was able use Configure::write in boostrap.php. If I can just use

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

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

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 ?php $html-link('Pdf', '/files/myfile.pdf'); ? or ?php echo $html-link('pdf', $this-webroot('files'.DS.'test.pdf'); ? or for newer version of cakephp ?php echo $html-link('pdf', $html-webroot('files'.DS.'test.pdf'); ? or a

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 

Re: Tree Helper Cake 2.0

2012-01-02 Thread AD7six
On Dec 30 2011, 9:45 am, Tilen Majerle tilen.maje...@gmail.com 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

Re: Routing to /img a request to /app/img

2012-01-02 Thread AD7six
On Jan 2, 9:37 pm, Mario mario.calli...@gmail.com 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

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

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

Re: Test controllers throwing exceptions

2012-01-02 Thread AD7six
On Dec 28 2011, 4:22 pm, Matteo Landi mat...@matteolandi.net 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

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

Re: Cake optimization

2012-01-02 Thread AD7six
On Jan 3, 6:55 am, Dee Johnson devario...@gmail.com 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.

Re: DebugKit Toolbar - core processing (derived)

2012-01-02 Thread AD7six
On Dec 29 2011, 4:41 pm, Alex Bovey a...@bovey.co.uk 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

Re: Cake optimization

2012-01-02 Thread Miles J
http://milesj.me/blog/read/caching-queries On Jan 2, 10:09 pm, AD7six andydawso...@gmail.com wrote: On Jan 3, 6:55 am, Dee Johnson devario...@gmail.com wrote: I would like to have somewhere ~1 sec load time I actually figured out the problem though.  When using persistModel = true

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: error There was a problem processing your request. /error Anytime something goes wrong when something is accessed via

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