For example:
<?= $this->headLink()->appendStylesheet('css/styles.css') ?>
Results in:
<link href="css/default.css" media="screen" rel="stylesheet" type="text/css" />
When I'm on the homepage of my site at http://www.example.com/~hvirgen/myzfapp, the CSS file can be read because the relative path maps to its physical location.
But when I start navigating into the site it throws off my relative paths:
css relative path: css/style.css
translated path: http://www.example.com/myzfapp/somecontroller/someaction/css/style.css <-- doesn't work
If my ZF application was in the webroot, then it would be perfectly fine to prepend all the paths with a forward-slash (/css/style.css), but my project is going to be deployed in a subdirectory that is different than my development directory (as in, it won't be /~hvirgen/myzfapp when we go live).
One suggestion I was given a while back was to create a baseUrl view helper, but it is becoming tedious and repetitive to wrap all of my relative urls in that helper.
-Hector
没有评论:
发表评论