Re: Files folder?

2008-06-04 Thread Janoma

Hi everyone,

I'm new to CakePHP, and I've been trying to figure out how to do these
links in a proper way. Explicit links are not so useful to me, since
I'm developing in my own computer, but as soon as the host and domain
for the website are ready I'll have to upload it, and of course the
links to 'localhost' won't work (and I'm sure I'm not the only one).

For now the only thing I can think of is defining a constant
WEBROOT_URI pointing to http://localhost/my-website/app/webroot/,
which I'll have to change when I upload the website. However, it is
not clear to me whether this is a good solution. I suppose there is a
straightforward way of doing this, but I just don't know it.

Any comments? What am I not seeing?

PS: I'm not using .htaccess

On Apr 9, 8:38 am, G Kramer <[EMAIL PROTECTED]> wrote:
> I think I can answer my own question now (which was pretty easy, once
> I "got it").    You have to construct the links to thefiles
> explicitly:  ie, html->link("click 
> here","http://www.mydomain.com/files/example.pdf";).   Or, on a system without 
> mod_rewrite, thelink
> would be to:  http://mydomain.com/app/webroot/files/example.pdf";
>
> I had been trying to build thelinklike this:
> html->link("click here","/files/example.pdf")
>
> bit thelinkCake constructs does notlinkto the file ... it tries tolinkto a 
> "files" controller", leading to the error I was getting (and
> on my system without mod_write it includes index.php in the url, which
> again leads to a problem).
>
> That's my theory at least.  Linkto thefilesdirectly, and you're OK.
>
> -Greg Kramer
>
> On Apr 8, 10:50 pm, G Kramer <[EMAIL PROTECTED]> wrote:
>
>
>
> > Perfect.  I got it now.  It works as you indicated with no missing
> > controller error.
>
> > Side question, how would you get this to work if you weren't using
> > mod_rewrite (anything in the routes.php that you could configure for
> > that?).   Mostly just curious...
>
> > Thanks,
> > G Kramer
>
> > On Apr 7, 5:24 am, "Steven M. Parker" <[EMAIL PROTECTED]> wrote:
>
> > > The answer to this is that the mod_rewrite (.htaccess)filesare
> > > already setup to handle this. If you access a file hosted in /app/
> > > webroot/files/example.pdf from the URLwww.example.com/files/example.pdf,
> > > it will redirect you to example.com/app/webroot/files/example.pdf. If
> > > however the file doesn't exist, then cake will try to parse it as a
> > > request for a controller.
>
> > > Notice the couple of lines in app/webroot/.htaccess saying "!-f" and
> > > "!-d"? That's a test to see if the request is already a file, or a
> > > directory...and if so, just let the request pass through. Otherwise,
> > > redirect to cake's controller processing.
>
> > > Steven
>
> > > On Apr 5, 10:08 am, G Kramer <[EMAIL PROTECTED]> wrote:
>
> > > > I'm sorry, I have a similar issue and don't quite follow this
> > > > response.   This says I don't need to change the routes/rewrite rules
> > > > but yet I still will get an error ... aren't we talking about how to
> > > > get rid of the error?
>
> > > > Thanks,
> > > > Greg K
>
> > > > On Mar 28, 11:51 am, Sliv <[EMAIL PROTECTED]> wrote:
>
> > > > >filesis a specialfolderthat should work for direct links tofiles
> > > > > within it, without needing to modify routes/rewrite from a default
> > > > > install, but you will get a filescontroller error for a badlink

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Files folder?

2008-04-09 Thread G Kramer

I think I can answer my own question now (which was pretty easy, once
I "got it").You have to construct the links to the files
explicitly:  ie, html->link("click here","http://www.mydomain.com/
files/example.pdf").   Or, on a system without mod_rewrite, the link
would be to:  http://mydomain.com/app/webroot/files/example.pdf";

I had been trying to build the link like this:
html->link("click here","/files/example.pdf")

bit the link Cake constructs does not link to the file ... it tries to
link to a "files" controller", leading to the error I was getting (and
on my system without mod_write it includes index.php in the url, which
again leads to a problem).

That's my theory at least.  Link to the files directly, and you're OK.

-Greg Kramer



On Apr 8, 10:50 pm, G Kramer <[EMAIL PROTECTED]> wrote:
> Perfect.  I got it now.  It works as you indicated with no missing
> controller error.
>
> Side question, how would you get this to work if you weren't using
> mod_rewrite (anything in the routes.php that you could configure for
> that?).   Mostly just curious...
>
> Thanks,
> G Kramer
>
> On Apr 7, 5:24 am, "Steven M. Parker" <[EMAIL PROTECTED]> wrote:
>
> > The answer to this is that the mod_rewrite (.htaccess) files are
> > already setup to handle this. If you access a file hosted in /app/
> > webroot/files/example.pdf from the URLwww.example.com/files/example.pdf,
> > it will redirect you to example.com/app/webroot/files/example.pdf. If
> > however the file doesn't exist, then cake will try to parse it as a
> > request for a controller.
>
> > Notice the couple of lines in app/webroot/.htaccess saying "!-f" and
> > "!-d"? That's a test to see if the request is already a file, or a
> > directory...and if so, just let the request pass through. Otherwise,
> > redirect to cake's controller processing.
>
> > Steven
>
> > On Apr 5, 10:08 am, G Kramer <[EMAIL PROTECTED]> wrote:
>
> > > I'm sorry, I have a similar issue and don't quite follow this
> > > response.   This says I don't need to change the routes/rewrite rules
> > > but yet I still will get an error ... aren't we talking about how to
> > > get rid of the error?
>
> > > Thanks,
> > > Greg K
>
> > > On Mar 28, 11:51 am, Sliv <[EMAIL PROTECTED]> wrote:
>
> > > > files is a special folder that should work for direct links to files
> > > > within it, without needing to modify routes/rewrite from a default
> > > > install, but you will get a filescontroller error for a bad link

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



Re: Files folder?

2008-04-08 Thread G Kramer

Perfect.  I got it now.  It works as you indicated with no missing
controller error.

Side question, how would you get this to work if you weren't using
mod_rewrite (anything in the routes.php that you could configure for
that?).   Mostly just curious...

Thanks,
G Kramer


On Apr 7, 5:24 am, "Steven M. Parker" <[EMAIL PROTECTED]> wrote:
> The answer to this is that the mod_rewrite (.htaccess) files are
> already setup to handle this. If you access a file hosted in /app/
> webroot/files/example.pdf from the URLwww.example.com/files/example.pdf,
> it will redirect you to example.com/app/webroot/files/example.pdf. If
> however the file doesn't exist, then cake will try to parse it as a
> request for a controller.
>
> Notice the couple of lines in app/webroot/.htaccess saying "!-f" and
> "!-d"? That's a test to see if the request is already a file, or a
> directory...and if so, just let the request pass through. Otherwise,
> redirect to cake's controller processing.
>
> Steven
>
> On Apr 5, 10:08 am, G Kramer <[EMAIL PROTECTED]> wrote:
>
> > I'm sorry, I have a similar issue and don't quite follow this
> > response.   This says I don't need to change the routes/rewrite rules
> > but yet I still will get an error ... aren't we talking about how to
> > get rid of the error?
>
> > Thanks,
> > Greg K
>
> > On Mar 28, 11:51 am, Sliv <[EMAIL PROTECTED]> wrote:
>
> > > files is a special folder that should work for direct links to files
> > > within it, without needing to modify routes/rewrite from a default
> > > install, but you will get a filescontroller error for a bad link

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



Re: Files folder?

2008-04-07 Thread Steven M. Parker

The answer to this is that the mod_rewrite (.htaccess) files are
already setup to handle this. If you access a file hosted in /app/
webroot/files/example.pdf from the URL www.example.com/files/example.pdf,
it will redirect you to example.com/app/webroot/files/example.pdf. If
however the file doesn't exist, then cake will try to parse it as a
request for a controller.

Notice the couple of lines in app/webroot/.htaccess saying "!-f" and
"!-d"? That's a test to see if the request is already a file, or a
directory...and if so, just let the request pass through. Otherwise,
redirect to cake's controller processing.

Steven

On Apr 5, 10:08 am, G Kramer <[EMAIL PROTECTED]> wrote:
> I'm sorry, I have a similar issue and don't quite follow this
> response.   This says I don't need to change the routes/rewrite rules
> but yet I still will get an error ... aren't we talking about how to
> get rid of the error?
>
> Thanks,
> Greg K
>
> On Mar 28, 11:51 am, Sliv <[EMAIL PROTECTED]> wrote:
>
> > files is a special folder that should work for direct links to files
> > within it, without needing to modify routes/rewrite from a default
> > install, but you will get a filescontroller error for a bad link

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



Re: Files folder?

2008-04-06 Thread G Kramer

I'm sorry, I have a similar issue and don't quite follow this
response.   This says I don't need to change the routes/rewrite rules
but yet I still will get an error ... aren't we talking about how to
get rid of the error?

Thanks,
Greg K


On Mar 28, 11:51 am, Sliv <[EMAIL PROTECTED]> wrote:
> files is a special folder that should work for direct links to files
> within it, without needing to modify routes/rewrite from a default
> install, but you will get a filescontroller error for a bad link

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



Re: Files folder?

2008-03-28 Thread Галкин Николай

try

/pdf/example.pdf
or 
www.example.com/pdf/example.pdf



> I am building a website for a client and they have a large amount of
> PDF's so I decided I would put them in: app/webroot/files/pdf but when
> I navigate to: www.example.com/files/pdf/example.pdf i get:
>
> Error: FilesController could not be found.
>
> How can I make it allow me access to this folder. Or if this is not an
> option, where should I store the PDF's instead ?

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



Re: Files folder?

2008-03-28 Thread Sliv

files is a special folder that should work for direct links to files
within it, without needing to modify routes/rewrite from a default
install, but you will get a filescontroller error for a bad link


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



Re: Files folder?

2008-03-28 Thread Sam Sherlock

RewriteEngine on
RewriteRule   (_taste|files|phpmyadmin)/(.*)   -   [L]
RewriteRule^$webroot/[L]
RewriteRule(.*) webroot/$1[L]
 

On 28/03/2008, Chris Hartjes <[EMAIL PROTECTED]> wrote:
>
>
> On Fri, Mar 28, 2008 at 10:49 AM, Kyle Decot <[EMAIL PROTECTED]> wrote:
> >
> >  I am building a website for a client and they have a large amount of
> >  PDF's so I decided I would put them in: app/webroot/files/pdf but when
> >  I navigate to: www.example.com/files/pdf/example.pdf i get:
> >
> >  Error: FilesController could not be found.
> >
>
>
> That's because Cake thinks you're trying to access a controller named
> 'Files'.  You might have to do something like altering  your .htaccess
> file to tell it to not process requests for stuff in /files as if it
> were a regular controller/action pair.
>
> If you look at the .htaccess file, I'm sure you can figure it out.
>
>
> --
> Chris Hartjes
> Internet Loudmouth
> Motto for 2008: "Moving from herding elephants to handling snakes..."
> @TheKeyBoard: http://www.littlehart.net/atthekeyboard
>
>
> >
>

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



Re: Files folder?

2008-03-28 Thread Chris Hartjes

On Fri, Mar 28, 2008 at 10:49 AM, Kyle Decot <[EMAIL PROTECTED]> wrote:
>
>  I am building a website for a client and they have a large amount of
>  PDF's so I decided I would put them in: app/webroot/files/pdf but when
>  I navigate to: www.example.com/files/pdf/example.pdf i get:
>
>  Error: FilesController could not be found.
>

That's because Cake thinks you're trying to access a controller named
'Files'.  You might have to do something like altering  your .htaccess
file to tell it to not process requests for stuff in /files as if it
were a regular controller/action pair.

If you look at the .htaccess file, I'm sure you can figure it out.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

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



Re: Files folder?

2008-03-28 Thread Sliv

double check the url is accurate - you'll get this error if the target
is unreachable/doesn't exist - if the file is there and the url is
accurate it should work.  try with a simple test.txt file in the root
of files

On Mar 28, 10:49 am, Kyle Decot <[EMAIL PROTECTED]> wrote:
> I am building a website for a client and they have a large amount of
> PDF's so I decided I would put them in: app/webroot/files/pdf but when
> I navigate to:www.example.com/files/pdf/example.pdfi get:
>
> Error: FilesController could not be found.
>
> How can I make it allow me access to this folder. Or if this is not an
> option, where should I store the PDF's instead ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Files folder?

2008-03-28 Thread Kyle Decot

I am building a website for a client and they have a large amount of
PDF's so I decided I would put them in: app/webroot/files/pdf but when
I navigate to: www.example.com/files/pdf/example.pdf i get:

Error: FilesController could not be found.

How can I make it allow me access to this folder. Or if this is not an
option, where should I store the PDF's instead ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---