Issue
Migrating from 2.3.x to 3.8 and I can't figure out how I may access the public path to webroot in my views. Previously I could do something like this:
<link rel="stylesheet" type="text/css" href="<?php echo $this->webroot ?>wp-dist/acd76cde.css" />
But when I try this on 3.8 it says:
Error: webrootHelper could not be found.
I tried html helper, but can't find a helper method which gives just the public path to webroot. For example image()
is relative to webroot/img
, css()
is relative to webroot/css
and so on.
Am I missing something?
Solution
Update:
As @ndm said in the comments above, the following works for me as well.
echo $this->Html->css('lightweight_lpbbd374e3', ['pathPrefix' => 'wp-dist/']);
Original my solution, which works too
$this->Url->webroot
finally worked for me. So I'm including my css as follows:
<link rel="stylesheet" type="text/css" href="<?php echo $this->Url->webroot('wp-dist/lightweight_lpbbd374e3.css'); ?>" />
Until someone else suggests a better way, I'll continue using this.
Answered By - Souvik Ghosh
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.