Hi,

One thing that I have come across a few times is wanting to generate  
URLs relative to the base href of a site rather than relative to the  
document root. I have tried setting the 'relative'=>true parameter  
when generating URLs, but this always creates URLs with a leading  
slash, which makes the URLs relative to the document root.

Generally this would make it easier to deal with URL <-> filesystem  
interaction. The base-href is the "pub" directory, and is a physical  
filesystem directory. So URLs generated relative to the base href can  
be easily converted to a filesystem path prepending them with the  
filesystem path of the "pub" directory.

For example, what happens now:

- The base href is 'http://mydomain.com/somevirtualdir/'
- The filesystem path to the public root of the site is '/some/path/ 
pub/' (can be set/found in config.php)
- Routing generates '/somevirtualdir/images/test.jpg'
- The file is actually at '/some/path/pub/images/test.jpg'

This makes it hard to access the file given the generated URL, as  
'somevirtualdir/' has to be removed from the beginning. What I would  
like:

- Routing to generate 'images/test.jpg'

Then to find the filesystem path of the image, this would just be  
concatenated with the filesystem path to the public root of the site.

Uses:

- Saving/accessing files in the 'pub' directory. I like to save user- 
uploaded files in the pub directory so they can be accessed without  
invoking php or redirects etc.. Ideally I would set the location in  
routing.xml, and use routing to generate the filesystem path to save  
the files, but this is not possible right now.

-  I would like to have scripts/css/images all in the 'pub' directory,  
with far-future expires headers to avoid unnecessary http requests. In  
order to make sure that users caches aren't used when the files are  
updated, I would need to add ?m=<modifiedtime> to the urls of the  
files. To do this I would need the filesystem path of the files to get  
their modification time.

Is all this possible, or am I barking up the wrong tree? :-)

Michal.

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to