Jump to content

Recommended Posts

Posted (edited)

I have created Page CSS. It works on the page with database. Now I would like to include it into custom block (Plugin) based on this database. This does not work:

{{\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'myfolder/general.css', 'cms', 'front' ) );}}

And using a template plugin, I get 'ErrorException: template_store_missing (0)':

{template="includeCSS" app="cms" group="myfolder/general" location="front" params=""}

Is there any other idea of how to include Page CSS in the block or other templates?

Note: I do not have any app or plugin. This is just a simple Pages database.

Edited by Sonya*
Posted

Custom Pages related js & css templates aren't stored in the default IPS template storage, so \IPS\Theme and the template output helper won't work here.

Instead you'll have to use the \IPS\cms\Templates class where the load method accepts either the ID or the key as first param.

Posted

@Daniel F this means I have to know the ID of the Pages CSS. No way to get it just by name? I often export and import database and block templates. Do I have to edit the block template on every installation to enter the id/key of the template? 

  • Recently Browsing   0 members

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