Friday, November 30, 2012

How to do the dos mode printing in cakephp2.3?

I am doing POS(billing) in cakephp. So I need to do the dos mode printing.Kindly help me.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Re: IIS 7, CakePHP 2.2.3 and the Blog Tutorial

Hi Nutty,

Thanks for your link. I followed it, copy+pasted your web.config file, refreshed, but then the index (root/) isn't working. URL Rewriting is, though, 'cause I could acces '/posts/index' without a problem. 

Thank you anyway! 

Jorick. 

Op zaterdag 1 december 2012 01:20:30 UTC+1 schreef nutty het volgende:
I had my cakephp running in IIS and it works perfectly for me. see http://jquerydate.blogspot.com

On Sat, Dec 1, 2012 at 5:50 AM, Jorick de Lange <jorick...@gmail.com> wrote:
Well, it makes sense to me... So, if I'm not mistaken, the system runs 'as it should be', right? Then I can stop bug-fixing things that aren't bugs... ;-)

Thanks,

Jorick.

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

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





--
Thanks and Best Regards,
Nathaniel N. Sumaya

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

RE: YARQ - Yet Another Routing Question

Thanks.

Will try it out.

Dave

-----Original Message-----
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of lowpass
Sent: Friday, November 30, 2012 3:06 PM
To: cake-php@googlegroups.com
Subject: Re: YARQ - Yet Another Routing Question

Router::connect(
'/link/:one/:two/:three/:four/:five',
array(
'controller' => '...',
'action' => '...'
),
array(
'one' => '[0-9]?',
'two' => '[0-9]?',
'three' => '[0-9]?',
'four' => '[0-9]?',
'five' => '[0-9]?',
'pass' => array('one', 'two', 'three', 'four', 'five')
)
);


public function foo($one = null, $two = null, $three = null, $four = null,
$five = null) {
die(debug(array($one, $two, $three, $four, $five))); }


On Fri, Nov 30, 2012 at 9:17 AM, Advantage+ <movepixels@gmail.com> wrote:
>
>
> When defining a route in routes.php what is the correct way to code a
> link to a function where different variables can be passed?
>
>
>
> For example the link can pass up to 5 args
> www.example.com/link/2/5/0/2/6 or as little as 1
> www.example.com/link/2
>
> Looking at the book it shows basic pass => for the know vars being
> passed but what if the vars passed can vary from 1 var to 5 vars.
>
>
>
> I'm sure you do not to make 5 routes depending on each scenario?
>
>
>
> Any insight would be great.
>
>
>
> Thanks all
>
>
>
> Dave
>
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP Find us on
> Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google
> Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

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

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



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

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

Re: IIS 7, CakePHP 2.2.3 and the Blog Tutorial

I had my cakephp running in IIS and it works perfectly for me. see http://jquerydate.blogspot.com

On Sat, Dec 1, 2012 at 5:50 AM, Jorick de Lange <jorickdelange@gmail.com> wrote:
Well, it makes sense to me... So, if I'm not mistaken, the system runs 'as it should be', right? Then I can stop bug-fixing things that aren't bugs... ;-)

Thanks,

Jorick.

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

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





--
Thanks and Best Regards,
Nathaniel N. Sumaya

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Re: IIS 7, CakePHP 2.2.3 and the Blog Tutorial

Well, it makes sense to me... So, if I'm not mistaken, the system runs 'as it should be', right? Then I can stop bug-fixing things that aren't bugs... ;-)

Thanks,

Jorick.

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

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

Re: YARQ - Yet Another Routing Question

Router::connect(
'/link/:one/:two/:three/:four/:five',
array(
'controller' => '...',
'action' => '...'
),
array(
'one' => '[0-9]?',
'two' => '[0-9]?',
'three' => '[0-9]?',
'four' => '[0-9]?',
'five' => '[0-9]?',
'pass' => array('one', 'two', 'three', 'four', 'five')
)
);


public function foo($one = null, $two = null, $three = null, $four =
null, $five = null)
{
die(debug(array($one, $two, $three, $four, $five)));
}


On Fri, Nov 30, 2012 at 9:17 AM, Advantage+ <movepixels@gmail.com> wrote:
>
>
> When defining a route in routes.php what is the correct way to code a link
> to a function where different variables can be passed?
>
>
>
> For example the link can pass up to 5 args www.example.com/link/2/5/0/2/6 or
> as little as 1 www.example.com/link/2
>
> Looking at the book it shows basic pass => for the know vars being passed
> but what if the vars passed can vary from 1 var to 5 vars.
>
>
>
> I'm sure you do not to make 5 routes depending on each scenario?
>
>
>
> Any insight would be great.
>
>
>
> Thanks all
>
>
>
> Dave
>
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

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

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

Re: IIS 7, CakePHP 2.2.3 and the Blog Tutorial

On Fri, Nov 30, 2012 at 8:51 AM, Jorick de Lange
<jorickdelange@gmail.com> wrote:
> OK... So, what I've got now:
>
> Working
> - dev.ov-ervaringen.nl/
> - dev.ov-ervaringen.nl/posts/index
>
> Not working:
> - dev.ov-ervaringen.nl/index.php

You shouldn't add "index.php" to the URL. The Rewrite Rules work by
passing the arguments in the URL to the index.php file, which in turn
passes them on to the Dispatcher. It first searches for an actual file
under app/webroot, eg. my-static-page.html. If found, it serves it and
that's the end of the request. Otherwise, everything else is already
going to index.php.

Another way of looking at it: index.php and index are two separate
things. The latter is named so because the action is to list all
records of some model. The former is named so because, historically,
web servers would default to listing all of the pages in a given
folder if no filename was given in the URL. Eventually, it was
possible to set a DefaultDocument name, so that the web server would
look for a file with that name and show that instead of listing all
the files. Traditionally, this was called index.html, index.php, etc.
Cake's app/webroot/index.php could actually be named anything else, as
long as the web server was configured for that name as
DefaultDocument.

I hope I didn't just confuse things even more.

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

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

Re: Problem with Elements

On Thu, Nov 29, 2012 at 5:10 PM, Franklin Piercing
<piercing.frank@gmail.com> wrote:
> Hi, this is what i´m trying to do, i have this index.ctp view where i show
> some information about the logged user (such as name, mail, etc).. but in
> the Users table there´s a field called info that the user can update, the
> thing is that, in my index fuction in my Users´s controller i have this
>
> public function index() {
> $this->Person->id = $this->Session->read('Auth.User.id');
> $this->set('people', $this->Person->read());
> }
>
> it shows the info perfect, so, in my index view i have a little section with
> a textfield where the user can update this "info" field, so the thing is
> that i'm trying to create this form in an element and include it into my
> index view, i have my controller's action called update_info with the logic
> to do so.. but it doesn´t works, i don´t know why, anybody canhelp me with
> this or maybe give me ideas about other ways to do it???

What do you mean by "doesn't works"? The form doesn't appear? The form
doesn't submit the data? The data isn't saved?

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

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

Re: Globle varibles

In core.php:

Configure::write('something', 'some value');

read:

Configure::read('something');


On Fri, Nov 30, 2012 at 3:19 AM, raj kumar Pustela <pustelaraj@gmail.com> wrote:
> How to define gloable varibale in cakephp 2.0.3
> and how to access global variable in controller .model and view.
>
>
> Thanks,
> Rajakumar.
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

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

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

RE: Cake Bake on nginx

I just checked php.ini loaded in phpinfo and it was not loaded. Reboot server fixed it.

 

Thanks for the help all the same.

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of jodator
Sent: Friday, November 30, 2012 12:56 PM
To: cake-php@googlegroups.com
Subject: Re: Cake Bake on nginx

 

Do you enabled pdo module for cli? I think that you can have different php.ini for cli / web (fpm).

On Friday, November 30, 2012 4:29:11 PM UTC+1, advantage+ wrote:

I just installed Cake from the command line

 

When I run the cake bake command

Welcome to CakePHP v2.2.3 Console

---------------------------------------------------------------

App : app

Path: /var/www/app/

---------------------------------------------------------------

Interactive Bake Shell

---------------------------------------------------------------

[D]atabase Configuration

[M]odel

[V]iew

[C]ontroller

[P]roject

[F]ixture

[T]est case

[Q]uit

What would you like to Bake? (D/M/V/C/P/F/T/Q)

 

Select M and this is the result.

 

Error: Database connection "Mysql" is missing, or could not be created.

#0 /usr/share/php/Cake/Model/ConnectionManager.php(101): DboSource->__construct(Array)

#1 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(908): ConnectionManager::getDataSource('default')

#2 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(845): ModelTask->getAllTables (NULL)

#3 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(934): ModelTask->listAll(NULL )

#4 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(204): ModelTask->getName()

#5 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(92): ModelTask->_interactive()

#6 /usr/share/php/Cake/Console/Command/BakeShell.php(107): ModelTask->execute()

#7 /usr/share/php/Cake/Console/Shell.php(393): BakeShell->main()

#8 /usr/share/php/Cake/Console/ShellDispatcher.php(201): Shell->runCommand(NULL, Array)

#9 /usr/share/php/Cake/Console/ShellDispatcher.php(69): ShellDispatcher->dispatch()

#10 /usr/bin/cake.php(43): ShellDispatcher::run(Array)

#11 {main}

 

The site is running on the server I just need to bake new models / controllers.

 

I did install php-pdo module but that did nothing.

 

Any nginx users out there who came across same issue?

 

Thanks

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Re: Cake Bake on nginx

Do you enabled pdo module for cli? I think that you can have different php.ini for cli / web (fpm).

On Friday, November 30, 2012 4:29:11 PM UTC+1, advantage+ wrote:

I just installed Cake from the command line

 

When I run the cake bake command

Welcome to CakePHP v2.2.3 Console

---------------------------------------------------------------

App : app

Path: /var/www/app/

---------------------------------------------------------------

Interactive Bake Shell

---------------------------------------------------------------

[D]atabase Configuration

[M]odel

[V]iew

[C]ontroller

[P]roject

[F]ixture

[T]est case

[Q]uit

What would you like to Bake? (D/M/V/C/P/F/T/Q)

 

Select M and this is the result.

 

Error: Database connection "Mysql" is missing, or could not be created.

#0 /usr/share/php/Cake/Model/ConnectionManager.php(101): DboSource->__construct(Array)

#1 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(908): ConnectionManager::getDataSource('default')

#2 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(845): ModelTask->getAllTables (NULL)

#3 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(934): ModelTask->listAll(NULL )

#4 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(204): ModelTask->getName()

#5 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(92): ModelTask->_interactive()

#6 /usr/share/php/Cake/Console/Command/BakeShell.php(107): ModelTask->execute()

#7 /usr/share/php/Cake/Console/Shell.php(393): BakeShell->main()

#8 /usr/share/php/Cake/Console/ShellDispatcher.php(201): Shell->runCommand(NULL, Array)

#9 /usr/share/php/Cake/Console/ShellDispatcher.php(69): ShellDispatcher->dispatch()

#10 /usr/bin/cake.php(43): ShellDispatcher::run(Array)

#11 {main}

 

The site is running on the server I just need to bake new models / controllers.

 

I did install php-pdo module but that did nothing.

 

Any nginx users out there who came across same issue?

 

Thanks

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Cake Bake on nginx

I just installed Cake from the command line

 

When I run the cake bake command

Welcome to CakePHP v2.2.3 Console

---------------------------------------------------------------

App : app

Path: /var/www/app/

---------------------------------------------------------------

Interactive Bake Shell

---------------------------------------------------------------

[D]atabase Configuration

[M]odel

[V]iew

[C]ontroller

[P]roject

[F]ixture

[T]est case

[Q]uit

What would you like to Bake? (D/M/V/C/P/F/T/Q)

 

Select M and this is the result.

 

Error: Database connection "Mysql" is missing, or could not be created.

#0 /usr/share/php/Cake/Model/ConnectionManager.php(101): DboSource->__construct(Array)

#1 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(908): ConnectionManager::getDataSource('default')

#2 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(845): ModelTask->getAllTables (NULL)

#3 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(934): ModelTask->listAll(NULL )

#4 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(204): ModelTask->getName()

#5 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(92): ModelTask->_interactive()

#6 /usr/share/php/Cake/Console/Command/BakeShell.php(107): ModelTask->execute()

#7 /usr/share/php/Cake/Console/Shell.php(393): BakeShell->main()

#8 /usr/share/php/Cake/Console/ShellDispatcher.php(201): Shell->runCommand(NULL, Array)

#9 /usr/share/php/Cake/Console/ShellDispatcher.php(69): ShellDispatcher->dispatch()

#10 /usr/bin/cake.php(43): ShellDispatcher::run(Array)

#11 {main}

 

The site is running on the server I just need to bake new models / controllers.

 

I did install php-pdo module but that did nothing.

 

Any nginx users out there who came across same issue?

 

Thanks

YARQ - Yet Another Routing Question

 

When defining a route in routes.php what is the correct way to code a link to a function where different variables can be passed?

 

For example the link can pass up to 5 args www.example.com/link/2/5/0/2/6 or as little as 1 www.example.com/link/2

Looking at the book it shows basic pass => for the know vars being passed but what if the vars passed can vary from 1 var to 5 vars.

 

I'm sure you do not to make 5 routes depending on each scenario?

 

Any insight would be great.

 

Thanks all

 

Dave

 

Re: IIS 7, CakePHP 2.2.3 and the Blog Tutorial

OK... So, what I've got now:

Working
- dev.ov-ervaringen.nl/ 
- dev.ov-ervaringen.nl/posts/index

Not working:
- dev.ov-ervaringen.nl/index.php

The error (Notice (8): Undefined index: post) in /posts/index was a typo. 

I removed all the web.config files in /app/ and /app/webroot/, and created one web.config in /root/, which contains the following:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <directoryBrowse enabled="false" />
        <defaultDocument>
            <files>
                <clear />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="index.php" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="Default.aspx" />
            </files>
        </defaultDocument>
        <rewrite>
            <rules>
<rule name="Imported Rule 1" stopProcessing="false">
                    <match url="^$" ignoreCase="false" />
                    <action type="Rewrite" url="app/webroot/" />
                </rule>
                <rule name="Imported Rule 2" stopProcessing="false">
                    <match url="(.*)" ignoreCase="false" />
                    <action type="Rewrite" url="app/webroot/{R:1}" />
                </rule>
<rule name="Imported Rule 5" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
</rule>
<rule name="Imported Rule 6" stopProcessing="true">
<match url="^$" ignoreCase="false" />
<action type="Rewrite" url="/" />
</rule>
<rule name="Imported Rule 7" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}" />
</rule>
<rule name="Imported Rule 8" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Don't mind the interrupted names: IIS7 doesn't care about names, it'll work from top to bottom. 

When I had rule 1 and 2 removed, all my CSS markup was gone on every page. 

But now... How to fix the /index.php problem... :-\ 

Ciao,
Jorick.


Op donderdag 29 november 2012 13:44:38 UTC+1 schreef Jorick de Lange het volgende:
Hi everyone,

So, I (we, actually) decided to create a website. Because of the need to extend later on, we decided to use a framework. CakePHP looked very well to fit our needs. Installed it, configured it, and after some .htacces import to web.config files, it was functional! See http://dev.ov-ervaringen.nl/ for the default page of CakePHP. 

Happy as I was, I started to follow the blog tutorial. Created the desired pages and I came to the point where you actualy can see the magic happen: I browsed to http://dev.ov-ervaringen.nl/posts/index/ and... Nothing. OK, back to the tutorial, to make sure I didn't make a typo. Nothing. Everything seems fine. 

Now, I'm stuck. I don't have a clue where to search for the problem. 

Here are the files:

in app/Controller/PostsController.php
class PostsController extends AppController { 
public $helpers = array('Html', 'Form');
    
    public function index() {
$this->set('posts', $this->Post->find('all'));
}
}

in app/Model/Post.php 
class Post extends AppModel {
}

in app/View/Posts/index.ctp 
<!-- File: /app/View/Posts/index.ctp -->
<h1>Blog posts</h1>
<table>
<tr>
    <th>Id</th>
        <th>Title</th>
        <th>Created</th>
    </tr>
    
    <!-- Here is where we loop through our $posts array, printing out post info -->
    
    <?php foreach ($posts as $post): ?>
<tr>
    <td><?php echo $post['Post']['id']; ?>></td>
        <td>
        <?php echo $this->Html->link($post['Post']['title'], array('controller' => 'posts', 'action' => 'view', $post['post']['id'])); ?>
</td>
        <td><?php echo $post['Post']['created']; ?></td>
</tr>
    <?php endforeach; ?>
<?php unset($post); ?>
</table>

And, my web.config files:

in root:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <directoryBrowse enabled="false" />
        <defaultDocument>
            <files>
                <clear />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="index.php" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="Default.aspx" />
            </files>
        </defaultDocument>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^$" ignoreCase="false" />
                    <action type="Rewrite" url="app/webroot/" />
                </rule>
                <rule name="Imported Rule 2" stopProcessing="true">
                    <match url="(.*)" ignoreCase="false" />
                    <action type="Rewrite" url="app/webroot/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

in app/
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <directoryBrowse enabled="false" />
        <rewrite>
            <rules>
<remove name="Imported Rule 1"/>
<remove name="Imported Rule 2"/>
                <rule name="app 1" stopProcessing="true">
                    <match url="^$" ignoreCase="false" />
                    <action type="Rewrite" url="webroot/" />
                </rule>
                <rule name="app 2" stopProcessing="true">
                    <match url="(.*)" ignoreCase="false" />
                    <action type="Rewrite" url="webroot/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

in app/webroot/
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
<remove name="app 1"/>
<remove name="app 2"/>
                <rule name="App Webroot 1" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

---

Is there anyone who is seeing the problem and has the solution to solve it?

Thanks in advance,

Jorick. 


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Re: IIS 7, CakePHP 2.2.3 and the Blog Tutorial

Oh, what I've forgot to mention: in app/Config/core.php debug is set to 2. 

Jorick.

Op vrijdag 30 november 2012 01:04:24 UTC+1 schreef cricket het volgende:
Please define "Nothing" for us.

Also, do you have debug set to 2?

On Thu, Nov 29, 2012 at 7:44 AM, Jorick de Lange
<jorick...@gmail.com> wrote:
> Hi everyone,
>
> So, I (we, actually) decided to create a website. Because of the need to
> extend later on, we decided to use a framework. CakePHP looked very well to
> fit our needs. Installed it, configured it, and after some .htacces import
> to web.config files, it was functional! See http://dev.ov-ervaringen.nl/ for
> the default page of CakePHP.
>
> Happy as I was, I started to follow the blog tutorial. Created the desired
> pages and I came to the point where you actualy can see the magic happen: I
> browsed to http://dev.ov-ervaringen.nl/posts/index/ and... Nothing. OK, back
> to the tutorial, to make sure I didn't make a typo. Nothing. Everything
> seems fine.
>
> Now, I'm stuck. I don't have a clue where to search for the problem.
>
> Here are the files:
>
> in app/Controller/PostsController.php
>>
>> class PostsController extends AppController {
>> public $helpers = array('Html', 'Form');
>>
>>     public function index() {
>> $this->set('posts', $this->Post->find('all'));
>> }
>> }
>
>
> in app/Model/Post.php
>>
>> class Post extends AppModel {
>> }
>
>
> in app/View/Posts/index.ctp
>>
>> <!-- File: /app/View/Posts/index.ctp -->
>> <h1>Blog posts</h1>
>> <table>
>> <tr>
>>     <th>Id</th>
>>         <th>Title</th>
>>         <th>Created</th>
>>     </tr>
>>
>>     <!-- Here is where we loop through our $posts array, printing out post
>> info -->
>>
>>     <?php foreach ($posts as $post): ?>
>> <tr>
>>     <td><?php echo $post['Post']['id']; ?>></td>
>>         <td>
>>         <?php echo $this->Html->link($post['Post']['title'],
>> array('controller' => 'posts', 'action' => 'view', $post['post']['id'])); ?>
>> </td>
>>         <td><?php echo $post['Post']['created']; ?></td>
>> </tr>
>>     <?php endforeach; ?>
>> <?php unset($post); ?>
>> </table>
>
>
> And, my web.config files:
>
> in root:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <configuration>
>>     <system.webServer>
>>         <directoryBrowse enabled="false" />
>>         <defaultDocument>
>>             <files>
>>                 <clear />
>>                 <add value="index.htm" />
>>                 <add value="index.html" />
>>                 <add value="index.php" />
>>                 <add value="Default.htm" />
>>                 <add value="Default.asp" />
>>                 <add value="Default.aspx" />
>>             </files>
>>         </defaultDocument>
>>         <rewrite>
>>             <rules>
>>                 <rule name="Imported Rule 1" stopProcessing="true">
>>                     <match url="^$" ignoreCase="false" />
>>                     <action type="Rewrite" url="app/webroot/" />
>>                 </rule>
>>                 <rule name="Imported Rule 2" stopProcessing="true">
>>                     <match url="(.*)" ignoreCase="false" />
>>                     <action type="Rewrite" url="app/webroot/{R:1}" />
>>                 </rule>
>>             </rules>
>>         </rewrite>
>>     </system.webServer>
>> </configuration>
>
>
> in app/
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <configuration>
>>     <system.webServer>
>>         <directoryBrowse enabled="false" />
>>         <rewrite>
>>             <rules>
>> <remove name="Imported Rule 1"/>
>> <remove name="Imported Rule 2"/>
>>                 <rule name="app 1" stopProcessing="true">
>>                     <match url="^$" ignoreCase="false" />
>>                     <action type="Rewrite" url="webroot/" />
>>                 </rule>
>>                 <rule name="app 2" stopProcessing="true">
>>                     <match url="(.*)" ignoreCase="false" />
>>                     <action type="Rewrite" url="webroot/{R:1}" />
>>                 </rule>
>>             </rules>
>>         </rewrite>
>>     </system.webServer>
>> </configuration>
>
>
> in app/webroot/
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <configuration>
>>     <system.webServer>
>>         <rewrite>
>>             <rules>
>> <remove name="app 1"/>
>> <remove name="app 2"/>
>>                 <rule name="App Webroot 1" stopProcessing="true">
>>                     <match url="^(.*)$" ignoreCase="false" />
>>                     <conditions logicalGrouping="MatchAll">
>>                         <add input="{REQUEST_FILENAME}"
>> matchType="IsDirectory" ignoreCase="false" negate="true" />
>>                         <add input="{REQUEST_FILENAME}" matchType="IsFile"
>> ignoreCase="false" negate="true" />
>>                     </conditions>
>>                     <action type="Rewrite" url="index.php"
>> appendQueryString="true" />
>>                 </rule>
>>             </rules>
>>         </rewrite>
>>     </system.webServer>
>> </configuration>
>
>
> ---
>
> Is there anyone who is seeing the problem and has the solution to solve it?
>
> Thanks in advance,
>
> Jorick.
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake...@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+u...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Re: IIS 7, CakePHP 2.2.3 and the Blog Tutorial

Hi Reuben and Cricket,

At least, something is working. While I've posted this issue here in the groups I started to backtrace the problem. What I've done now, is import the .htacces in /root/ to my web.config in /root/ AND copy the recommended web.config from the CakePHP book into the web.config in /root/. At least I can see the pages, and use the pretty URLS. But, I'm not there yet. 

As you can see, at http://dev-ov-ervaringen.nl/ the webpage is loading. At http://dev-ov-ervaringen.nl/index.php the page is loading as well, BUT with errors. The /index.php is situated in root/app/webroot/, if I'm not mistaken, right? Even http://dev-ov-ervaringen.nl/posts/index/ is working (only, I've got a nasty PHP error there. Have to figure out what that's supposed to mean, 'cause it's a litteral copy from the tutorial). 

What I think, is that I have to add some extra rules to my web.config in /app/ and in app/webroot. But, I don't have a clue yet. I'll keep searching and you informed. 

Jorick.

Op vrijdag 30 november 2012 01:32:47 UTC+1 schreef Reuben het volgende:
My guess is there is a problem with the web.config and URL rewrites.

The web.config files you have, don't quite look like the recommended web.config at http://book.cakephp.org/2.0/en/installation/advanced-installation.html

Unfortunately, I've not played with CakePHP on IIS7 using this method of URL redirect.

Actually, it could be a permissions issue.  Visiting http://dev.ov-ervaringen.nl/index.php yields an error that looks like CakePHP is correctly determining the controller name (but this one doesn't exist).  So if  the PostsController was being found, it might not be executable/readable, due to permissions on that file.

Regards
Reuben Helms

On Thursday, 29 November 2012 22:44:38 UTC+10, Jorick de Lange wrote:
Hi everyone,

So, I (we, actually) decided to create a website. Because of the need to extend later on, we decided to use a framework. CakePHP looked very well to fit our needs. Installed it, configured it, and after some .htacces import to web.config files, it was functional! See http://dev.ov-ervaringen.nl/ for the default page of CakePHP. 

Happy as I was, I started to follow the blog tutorial. Created the desired pages and I came to the point where you actualy can see the magic happen: I browsed to http://dev.ov-ervaringen.nl/posts/index/ and... Nothing. OK, back to the tutorial, to make sure I didn't make a typo. Nothing. Everything seems fine. 

Now, I'm stuck. I don't have a clue where to search for the problem. 

Here are the files:

in app/Controller/PostsController.php
class PostsController extends AppController { 
public $helpers = array('Html', 'Form');
    
    public function index() {
$this->set('posts', $this->Post->find('all'));
}
}

in app/Model/Post.php 
class Post extends AppModel {
}

in app/View/Posts/index.ctp 
<!-- File: /app/View/Posts/index.ctp -->
<h1>Blog posts</h1>
<table>
<tr>
    <th>Id</th>
        <th>Title</th>
        <th>Created</th>
    </tr>
    
    <!-- Here is where we loop through our $posts array, printing out post info -->
    
    <?php foreach ($posts as $post): ?>
<tr>
    <td><?php echo $post['Post']['id']; ?>></td>
        <td>
        <?php echo $this->Html->link($post['Post']['title'], array('controller' => 'posts', 'action' => 'view', $post['post']['id'])); ?>
</td>
        <td><?php echo $post['Post']['created']; ?></td>
</tr>
    <?php endforeach; ?>
<?php unset($post); ?>
</table>

And, my web.config files:

in root:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <directoryBrowse enabled="false" />
        <defaultDocument>
            <files>
                <clear />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="index.php" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="Default.aspx" />
            </files>
        </defaultDocument>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^$" ignoreCase="false" />
                    <action type="Rewrite" url="app/webroot/" />
                </rule>
                <rule name="Imported Rule 2" stopProcessing="true">
                    <match url="(.*)" ignoreCase="false" />
                    <action type="Rewrite" url="app/webroot/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

in app/
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <directoryBrowse enabled="false" />
        <rewrite>
            <rules>
<remove name="Imported Rule 1"/>
<remove name="Imported Rule 2"/>
                <rule name="app 1" stopProcessing="true">
                    <match url="^$" ignoreCase="false" />
                    <action type="Rewrite" url="webroot/" />
                </rule>
                <rule name="app 2" stopProcessing="true">
                    <match url="(.*)" ignoreCase="false" />
                    <action type="Rewrite" url="webroot/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

in app/webroot/
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
<remove name="app 1"/>
<remove name="app 2"/>
                <rule name="App Webroot 1" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

---

Is there anyone who is seeing the problem and has the solution to solve it?

Thanks in advance,

Jorick. 


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Re: Missing View

if it is the "Users" Controller it should be in "Users" folder (not the plural s)
why would your application look in the "User" folder?
thats what you got to figure out


Am Freitag, 30. November 2012 11:19:21 UTC+1 schrieb marco metal:
You should create a ctp file index.ctp inside you folder c:\wamp\www\cakephp\app\view\user\


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Re: Missing View

You should create a ctp file index.ctp inside you folder c:\wamp\www\cakephp\app\view\user\


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Re: Missing View

make sure, that file below exists:
C:\wamp\www\cakephp\app\View\User\index.ctp

--
Lep pozdrav, Tilen Majerle



2012/11/30 the beginner <azimahalias@gmail.com>
hello.

im new here. 
somebody can tell me what should i do to overcome this error :

Error: The view for UsersController::index() was not found.

Error: Confirm you have created the file: C:\wamp\www\cakephp\app\View\User\index.ctp

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Re: Custom login

you might be looking for sth I call qLogins

I use passwords that can be made valid for a single request, log the user in directly (either by link or by form)


Am Freitag, 30. November 2012 01:09:07 UTC+1 schrieb cricket:
I'm not sure that I follow all of that but if you want to manually log
a user in you can do it by passing the User.id:

$this->Auth->login($user_id);

Where $user_id is the User.id, or primary key of the row in the database.

On Thu, Nov 29, 2012 at 8:43 AM, Jorge Guerra <jorg...@gmail.com> wrote:
> Hi, I am a new member in this group and now I am developing a website and
> I've got a trouble and I reckon I need a little of help for one task.
>
> I've got problems for creating a custom login with a temporal password, I
> need to create a new password which it is temporal for accesing once and
> after that this password will be delete.
>
> Now I am working working at the method login for generating the session. The
> original method  it is
> http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in
>
> I added a elseif comparing the data with the temporal password but I do not
> know how I can generating this session when the username and the password
> it's the same according the database.
>
> That's the problem how could I generating the session of a user manually
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake...@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+u...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Re: Problem with Elements

you might be looking for sth I call qLogins
http://www.dereuromark.de/2012/02/08/qlogin-quicklogins-fur-cakephp/

I use passwords that can be made valid for a single request, log the user in directly (either by link or by form)



Am Freitag, 30. November 2012 00:23:29 UTC+1 schrieb Reuben:
Hi Franklin

If the model that you authenticate against is the Person model, then you should be able to get away with

public function index() {
    $this->set('people', $this->Auth->user();
}

Since Auth->user() should return the whole model.  Though you might want to double check with a bit of debug (DebugKit, or CakeLog::debug($this->Auth->user()) or errorLog(print_r($this->Auth->user(), true));

Alternatively, there's:

public function index() {
   $person = $this->Person->read(null, $this->Auth->user('id'));
   $this->set('people', $person);
}

Once small niggle on readability.  Setting 'people' implies that there are might be multiple people in the variable.  If there's only ever going to be the one person, I would set('person') instead (i.e. $this->set(compact('person'));) , or put the $person into an array, so you can have a foreach in your index (i.e. $this->set('people', array($person)); )

Regards
Reuben Helms

On Friday, 30 November 2012 08:10:59 UTC+10, Franklin Piercing wrote:
Hi, this is what i´m trying to do, i have this index.ctp view where i show some information about the logged user (such as name, mail, etc).. but in the Users table there´s a field called info that the user can update, the thing is that, in my index fuction in my Users´s controller i have this
 
public function index() {
        $this->Person->id = $this->Session->read('Auth.User.id');
        $this->set('people', $this->Person->read());
    }

it shows the info perfect, so, in my index view i have a little section with a textfield where the user can update this "info" field, so the thing is that i'm trying to create this form in an element and include it into my index view, i have my controller's action called update_info with the logic to do so.. but it doesn´t works, i don´t know why, anybody canhelp me with this or maybe give me ideas about other ways to do it???

thanx a lot!

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Globle varibles

    How to define gloable varibale in cakephp 2.0.3
  and how to access global variable in controller .model and view.


Thanks,
Rajakumar.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

Re: Throwing a custom 503 exception in CakePHP 2

Thank you very much.
After making this, everything is solved:
require(APP . 'Lib' . DS . 'MyExceptions.php');

On Friday, November 30, 2012 2:05:41 AM UTC+2, Reuben wrote:
The second suggestion calls for using require, instead of App::uses

in your bootstrap.php, something like 

require ROOT . DS . APP . DS . 'Error' . DS . 'exceptions.php';

And just have exceptions.php in app/Error, mimicking/mirroring placement in lib/Cake/Error.

You may need to double check if ROOT . DS . APP is the right combo of definitions to use.

Regards
Reuben Helms

On Friday, 30 November 2012 10:00:18 UTC+10, mercury12 wrote:
I tried your second suggestion. In "app/Lib/Error" I created "exceptions.php" and put the "ServiceUnavailableException" class inside this file.

Then I wrote this into "bootstrap.php":
App::uses('exceptions', 'Lib/Error');

 But I get the same error?

On Friday, November 30, 2012 1:51:36 AM UTC+2, Reuben wrote:
Looking at App::uses(), it expects the first parameter to be a classname, rather than a file name

Perhaps doing App::uses('ServiceUnavailableException', 'Lib'), and renaming the file to ServiceUnavailableException.php might be better, and more in keeping with the convention of one class per file.

When Cake bootstraps its own exceptions (in lib/Cake/bootstrap.php), it does a require CAKE . 'Error' . DS . 'exceptions.php';  You could possibly follow their lead, and bundle all your exceptions in app/Error/exceptions.php, then require that from your bootstrap. Then you wouldn't need to use App::uses() at all.

On Friday, 30 November 2012 09:32:34 UTC+10, mercury12 wrote:
Then I also put "App:uses()" inside bootstrap and inside controller class.
But still I got the same error.


On Friday, November 30, 2012 1:29:20 AM UTC+2, Reuben wrote:
You would probably need to have the App::uses() in your controller, rather than the bootstrap.

I'm not sure what the best method of including the new exception type, from the bootstrap, other than a include_once() statement.. and that doesn't look nice.  I've always been a bit lazy and have just included the class definition for the new exception directly in the bootstrap.php, and that's not particularly nice either.

Regards
Reuben Helms

On Friday, 30 November 2012 09:20:30 UTC+10, mercury12 wrote:

I need to give a 503 Service Unavailable HTTP header.

Normally I use these for 404 and 500 codes

throw new NotFoundException();  throw new InternalErrorException();

But I couldn't find relevant exception for 503 in CakePHP 2.2?

In my "app/lib/AppExceptionHandler.php" file I have this class/function that handles errors.

class AppExceptionHandler {      public static function handle($error) {       }

Edit:

  • Inside "app/Lib" folder I created a file named "MyExceptions.php". I wrote the following code inside this file:

    class ServiceUnavailableException extends CakeException {    protected $_messageTemplate = 'Service is not available now';    }
  • In "bootstrap.php" I wrote this:

    App::uses('MyExceptions', 'Lib');

  • Then inside "MyNewController.php" file I wrote this:

    throw new ServiceUnavailableException("tryout");

But then I get this error when I throw this exception:

Fatal error: Class 'ServiceUnavailableException' not found in   /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php   on line 3560    Warning (2): Cannot modify header information - headers already sent by  (output started at   /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php:3560)  [APP/Lib/AppExceptionHandler.php, line 19]

What do I miss? Thank you

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.