Git Product home page Git Product logo

Comments (6)

cewi avatar cewi commented on July 24, 2024

In cakephp, you've to use autoloading. No require_once needed.
Did you load the plugin?
You have to add
Plugin::load('Cewi/Excel', ['bootstrap' => true, 'routes'=>true]);
in your bootstrap.php file.

from excel.

KeidyU avatar KeidyU commented on July 24, 2024

Yes this is my last line in bootstrap.php
Plugin::load('Cewi/Excel', ['bootstrap' => true, 'routes'=>true]);

I dont have problem when i use $this->loadComponent('Cewi/Excel.Import');

the problem is with public $helpers = ['Cewi/Excel.Excel']; when the helper call PHPExcel Helper.

No so much information i had check all the link in a google search. :(

from excel.

KeidyU avatar KeidyU commented on July 24, 2024

Hi Cewi,
I am trying something today. i followed this steps as you described
router.php
Router::extensions(['xlsx']);

ArticlesController:
public $helpers = ['Cewi/Excel.Excel'];

add a Folder 'xlsx' in Template/Articles and create the file 'index.ctp' in this Folder.
$this->Excel->addWorksheet($articles, 'Articles');

create the link to generate the file somewhere in your app:
Html->link(__('Excel'), ['controller' => 'Articles', 'action' => 'index', '_ext'=>'xlsx']); ?>

'_ext' is working as index.xlsx

and of course i am getting the error
Missing Method in ArticlesController public function index.xlsx()

Some advice please

from excel.

KeidyU avatar KeidyU commented on July 24, 2024

Can be something about this:

Deprecated since version 3.1.0: As of 3.1.0 the viewClassMap() method is deprecated. You should use config() to change the viewClassMap at runtime.
???

from excel.

KeidyU avatar KeidyU commented on July 24, 2024

Got it guys,

in router.php the line

Router::extensions(['xlsx']);

must be before the method Router::scope('/', function (RouteBuilder $routes) {}
Something like this:

router.php:

use Cake\Core\Plugin;
use Cake\Routing\RouteBuilder;
use Cake\Routing\Router;
use Cake\Routing\Route\DashedRoute;

Router::extensions(['xlsx']);

Router::defaultRouteClass(DashedRoute::class);
Router::scope('/', function (RouteBuilder $routes)
{
..
..
}

from excel.

cewi avatar cewi commented on July 24, 2024

that's true. If you want to use it inside a scope, you've to write $routes->extensions(['xlsx']); Will clear that in the doku.
Have fun!

from excel.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.