Jump to content

Include app css in plugin


adcantu

Recommended Posts

Posted

Hello I am trying to create a plugin to add a country flag in the hovercard. I am using <span class="ipsFlag ipsFlag-{$country}"></span> but the flag doesn't show up. It seems that the flags.css isn't even loading. How can I have my plugin ensure that css is loaded? Also if I want to pull css from an installed app how could I make my plugin do that as well?

  • 1 month later...
Posted

Thanks! 
I'm still having issues with the css not loading. Not sure where I need to put this. I tried to hook it into includeCSS, that didn't work. I put it under the <ips:template parameters="" /> in my plugin.phtml, not working either. Any direction?

{{\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'flags.css', 'core', 'global' ) );}}


<span class="ipsDataItem_main">
  <span class='ipsFlag ipsFlag-{expression="mb_strtolower($country)"}'></span>	
</span>

 

Posted

You want to put that in a backend PHP file - at the time template files are compiling it may (or may not, depending on order) be too late to define additional CSS files to load in that manner.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...