[Catalyst] Link to file

Will Smith willbelair at yahoo.com
Thu May 24 17:29:40 GMT 2007


thank you for all of your help. 
 Yes, I just want to link to a file on local machine. And yes, I added the file:// to the path, but it links to nowhere. When cursor over, it shows file:///var..... just like any other links on a html page outside Cat, but it links to nothing. Just wonder if you ever really put a link like that on your app.
 I thought this is a simple matter, if a simple link could not do that, I think I have to apply the method that Peter has shown.
 Thanks again

Peter Karman <peter at peknet.com> wrote: 

Will Smith wrote on 5/24/07 10:43 AM:
> the error is : File Not Found. Yes, I have apache, and also tried on dev
> machine at localhost. Problem is when adding the file path to template, like:
> listen, and myvar =
> '/var/www/html/myfolder/myfile.wav'; when move the cursor over  "listen" the
> link is : http://localhost:3000/var/www/html/myfolder/myfile.wav  or
> http://www.mydomain.com/var/www/html/myfolder/myfile.wav
> 
> Obviously, this is the wrong path to the file. How can I drop the http://...
> before the real path? Thank you

Your browser is assuming the http:// scheme since href value is relative.

If you want to serve via local fs, then you probably want file:// instead.

if you want to serve the .wav via http, you need the http:// scheme on there,
and you'll want to come up with a structure for serving static content that 
doesn't use your Cat app directly. The way I do it is to have all my static 
content served under a separate apache vhost, and then in my Cat code, set that 
static url base in my config. So my .tt files look like:

  thing

The Static::Simple plugin lets you serve static content from Cat itself, but 
that's intended for devel only since tying up Cat time with static content is 
considered Not a Best Practice. So I just avoid it altogether and run a separate 
apache process on my dev box that serves my static content for me. That way 
moving from dev to production is as simple as changing the config definition for 
[% page.static %].


-- 
Peter Karman  .  http://peknet.com/  .  peter at peknet.com

_______________________________________________
List: Catalyst at lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


       
---------------------------------
Get the free Yahoo! toolbar and rest assured with the added security of spyware protection. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070524/715da62e/attachment.htm


More information about the Catalyst mailing list