bachvtuan51506
bachvtuan51506

I have read document and it required to register template function "registerMailTemplates" in my plugin.php file.

The issue is the next time I change content in my template file, I also need go to admin to update manual in list of templates.

Is there anyway to make it automatic refresh from template content ?

Last updated

mjauvin
mjauvin

Not that I know of.

@LukeTowers, care to comment on this?

LukeTowers
LukeTowers

You could have a seeder defined in your plugin updates.yaml that clears the template from the db when you update the code version of it.

bachvtuan51506
bachvtuan51506

@LukeTowers, thank for support.

As far I know after registered new template. I must go to backend and click on list templates url to let OctoberCMS scan all registered templates and insert to DB for new one.

Is there any other way to do that such as by command line ?

bachvtuan51506
bachvtuan51506

Hey, I figured out the issue, Thank for support anyway.

mjauvin
mjauvin

Care to share your solution so others can benefit?

bachvtuan51506
bachvtuan51506

I made the mistake on plugin.php . Below is error code

<?php
namespace Geek\Base;

use System\Classes\PluginBase;

require_once(dirname(__FILE__) . '/helpers/general.php');

class Plugin extends PluginBase
{
    public function registerMailTemplates()
    {
        return [
            'geek.base::mail.signup'
        ];
    }

    public function registerMailLayouts()
    {

        return [
            'Base' => 'geek.base::mail.templates.base',
        ];
    }
}

The mistake is this line :

require_once(dirname(__FILE__) . '/helpers/general.php');

That file contain some common functions and when I tried to send email with template 'geek.base::mail.signup' hence I get below errror

InvalidArgumentException: No hint path defined for [geek.base].

If I remove above line code it should just run fine. so the lesson is don't require any file in plugin.php, May be put it in boot method is fine.

1-7 of 7