Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted October 19, 20213 yr 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 October 19, 20213 yr by Sonya*
October 19, 20213 yr 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.
October 19, 20213 yr Author @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?
October 20, 20213 yr Author I've ended up in adding SQL query to the block template that gets template_id from template_title, template_group and template_location.