GithubHelp home page GithubHelp logo

Comments (4)

mludewig avatar mludewig commented on June 20, 2024

Hey del42rus,
but this don't fix the problem, because after adding controller and route to module.config.php, the view stops with an Exception during loading the view phtml script.
The strtolower($name) is not the complete working way i think, because the path looking for phtml script is $path/module/$name/view/name-of-the-module (comes here from NameOfTheModule).

best regards
mludewig

from zftool.

ne2da1 avatar ne2da1 commented on June 20, 2024

Hi mludewig,
thanks for answer, you are right, the strtolower($name) is not enough to fix problem.

So now I've used CamelCaseToDash filter for building properly path to phtml script. For that it was necessary to change moduleAction and controllerAction in ZFTool\Controller\CreateController class.

In moduleAction I've added following code after all other mkdir functions:

$filter = new CamelCaseToDashFilter(); // include Zend\Filter\Word\CamelCaseToDash class in use section
$inflectedModuleName = strtolower($filter->filter($name));
mkdir("$path/module/$name/view/" . $inflectedModuleNameName);

In controllerAction I've changed
$dir = $path . "/module/$module/view/" . strtolower($module) . "/" . strtolower($name);

to
$filter = new CamelCaseToDashFilter();
$inflectedModuleName = strtolower($filter->filter($module));
$dir = $path . "/module/$module/view/" . strtolower($inflectedModuleName) . "/" . strtolower($name);

It seems to work fine:)

best regards
del42rus

from zftool.

weierophinney avatar weierophinney commented on June 20, 2024

@del42rus Would you be willing to create a pull request with these changes?

from zftool.

ne2da1 avatar ne2da1 commented on June 20, 2024

@weierophinney As I can see you have already added recursive flag in mkdir calls. And I've noticed that $viewfolder = strtolower($name).

As @mludewig mentioned above the strtolower($name) is not the complete working way, because the path looking for phtml script is $path/module/$name/view/name-of-the-module (comes here from NameOfTheModule).
So we'll have exception during loading the view phtml script.

I've changed code a little bit by adding CamelCaseToDash filter and using it for building properly path to phtml script. Also I've created pull request with these changes

from zftool.

Related Issues (20)

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.