how to use css file from starter_theme in single page controller

Permalink 1 user found helpful
I want to design the single page php file in controller.I create the css file and then placed inside application/theme/starter_theme. I don't know how to call that css file inside controller single page.

1 Attachment

 
manup replied on at Permalink Reply
manup
$html = Core::make('helper/html');
print $html->css('path/to/my.css');
MyoMyo replied on at Permalink Reply
Thanks for a reply.But i got below error when i try.

Class 'Application\Controller\SinglePage\Dashboard\SiteManagement\Core' not found
manup replied on at Permalink Reply
manup
Put a back slash before Core OR use Core in the top of the controller
$html = \Core::make('helper/html');
MyoMyo replied on at Permalink Reply
Thanks again.
Error lost.But css file doesn't work.
mhawke replied on at Permalink Reply
mhawke
Chrome browser REALLY likes to cache CSS files. Make sure you're cache is really clear or try another browser that's never seen that site before to see if the CSS is kicking in.
MyoMyo replied on at Permalink Reply 1 Attachment
Thanks for a reply.
I tried chrome browser cache clear and run in another browser.But doesn't work.
Controller or view where from should i call css file? I try to call from controller php file.
linuxoid replied on at Permalink Reply
linuxoid
'path/to/my.css' means you have to use your real path to the css file, e.g. application/theme/starter_theme/YOUR_CSS_FILE.css

Try this in your controller:
public function registerViewAssets($outputContent = '')
{
    $html = $this->app->make('helper/html');
    $this->addHeaderItem($html->css("application/theme/starter_theme/YOUR_CSS_FILE.css
"));
}

Then clear site cache in Dashboard, reload the page Ctrl-F5 and check if your css loaded in the page source.
MyoMyo replied on at Permalink Reply 1 Attachment
Thanks a lot linuxoid.
I also tried your code too.But doesn't work.
I was wrong.The php file I want to design is view page.I call controller php file from form in view.