Jump to content

Plugin template not loaded

Recommended Posts

Hi community,

I am currently developing my first widget in a plugin. I want to use a phtml template to render the output of the widget.
Unfortunately, it seems as if the phtml template is not loaded.
I also tried to debug it and as I see it it searches for the template in the database, but the template is not in the database.
What can I do, to help the system find my template.

Here are some details about my case.

  • I created the plugin via the ACP.
  • Then I used the developer center to create a new widget with the Key tpArticlesSearchHero
  • I see that all the files are created in the backend
  • When I test the widget with a static output string, everything works fine so far.
  • I add the file tparticles/dev/html/tpArticlesSearchHero.phtml to my plugin structure
  • I add the line
    $this->template( array( \IPS\Theme::i()->getTemplate( 'plugins', 'core', 'global' ), $this->key ) );

    to the init function of tpArticlesSearchHero.php

After I did all this, I run into the exception "template_store_missing"

Am I doing anything wrong here? Is anything missing here?
Should the system add the template file information to the database? If yes how and when is it done?

Hopefully anybody can help me. Thank in advance.


Here are some screenshots of my setup


Link to comment
Share on other sites

I think that you are adding the template in the wrong location. At your widget php file, uncomment the following line inside the init function:

$this->template( array( \IPS\Theme::i()->getTemplate( 'widgets', $this->app, 'front' ), $this->key ) );

Then inside the /dev/html folder, create a new folder called: front and inside that folder create another folder called: widgets and inside that folder create your template file ending in extension phtml. Hope it helps.


Link to comment
Share on other sites


I tested it now several times and the weird thing, that I found out is, that when I create the widget freshly via the developer center, then the template thing won't work.

But if I download the plugin, then delete it and then upload the downloaded xml. Then it works . . .
So for now I found a solution, but it's still weird.

Link to comment
Share on other sites

After I made the phtml template work, I've got now the problem, that changes in the template are not applied.
If I change its content, I see still the content of the old template version.
I see in the database, that there is still the old content in the core_theme_templates table, even if I clear all caches.

So it looks like this update mechanism is kind of broken, at least on development instance.
Again, if I download the plugin, then delete it and upload it again, everything workds and gets updated.
If I change the template file in developer mode, nothing gets updated . . .

Link to comment
Share on other sites

  • Recently Browsing   0 members

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