Skip to main content

I've created a custom component with a dashboard that needs styling with CSS. I've created the CSS file and I'm looking at calling for it in the frontend view. 

Working with J! 3.6.5 and a MVCMVC developed component obviously I'm confident that I need to place the following code in an appropriate place:

JHtml::_('stylesheet', 'com_mycomponent/css/dashboard.css');

My best guess was to put it between the "public function display""public function display" lines in my "view.html.php""view.html.php" file. However, this does not working so I'm doing it wrong.

Please help!

I've created a custom component with a dashboard that needs styling with CSS. I've created the CSS file and I'm looking at calling for it in the frontend view. Working with J! 3.6.5 and a MVC developed component obviously I'm confident that I need to place the following code in an appropriate place:

JHtml::_('stylesheet', 'com_mycomponent/css/dashboard.css');

My best guess was to put it between the "public function display" lines in my "view.html.php" file. However, this does not working so I'm doing it wrong.

Please help!

I've created a custom component with a dashboard that needs styling with CSS. I've created the CSS file and I'm looking at calling for it in the frontend view. 

Working with J! 3.6.5 and a MVC developed component obviously I'm confident that I need to place the following code in an appropriate place:

JHtml::_('stylesheet', 'com_mycomponent/css/dashboard.css');

My best guess was to put it between the "public function display" lines in my "view.html.php" file. However, this does not working so I'm doing it wrong.

Source Link
Badger
  • 113
  • 6

Where to call for CSS/JS in custom component for frontend views

I've created a custom component with a dashboard that needs styling with CSS. I've created the CSS file and I'm looking at calling for it in the frontend view. Working with J! 3.6.5 and a MVC developed component obviously I'm confident that I need to place the following code in an appropriate place:

JHtml::_('stylesheet', 'com_mycomponent/css/dashboard.css');

My best guess was to put it between the "public function display" lines in my "view.html.php" file. However, this does not working so I'm doing it wrong.

Please help!