vinkla / wordplate

A boilerplate for WordPress, built with Composer and designed with sensible defaults.
2.12k stars 155 forks source link

Load Controllers with fiskhandlarn/blade #248

Closed MathieuMenegain closed 4 years ago

MathieuMenegain commented 4 years ago

Hi,

I use ekandreas/bladerunner but now with the 8.0 of wordplate, i have a composer conflit with this package. I see you advise fiskhandlarn/blade in the documentation but he don't autoload my controller as did bladerunner. Did i miss something ? My controller in 'myTheme/App/Controllers/FrontPage.php' :

<?php

namespace App\Controllers;

/**
 * Controller of the home page.
 */
class FrontPage extends BaseController
{
    /**
     * Constructor.
     */
    public function __construct()
    {
        dd('FrontPage');
    }
}

My BaseController extend Fiskhandlarn\BladeController and he is in namespace App\Controllers.

In my composer.json :

"autoload": {
    "psr-4": {"App\\": "public/themes/"}
}

Do i have to create a front-page.php in myTheme folder and call renderController ? It's duplicate file and error source and waste of time i think. One solution ?

Thank you in advance for your answers

vinkla commented 4 years ago

I’m not sure, maybe we could ask @fiskhandlarn about this.

fiskhandlarn commented 4 years ago

@menegain I'm not sure i understand your problem.

  1. Do you mean that the FrontPage class isn't loaded at all? (If so, that is on composer and not me afaik.)
  2. Do you mean that no blade output is made with your controller? If so, yes, you must have a WordPress template file that calls blade_controller.

Regarding 2: I don't remember, but I don't think ekandreas/bladerunner automatically displayed blade templates for it's controllers ..? How would you suggest my package should now which controller to be called/shown for which wordpress post type and so on?

MathieuMenegain commented 4 years ago

Thanks for your response. My FrontPage controller load with renderController or blade_controller but i note ekandreas/bladerunner is install as plugin and contains setup.php file into globals folder who launch a Wordpress action to call a file in controller folder.

With this, for exemple, before, my file front-page.php is not in path theme folder but in the controller folder.