Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to create this structure
  • Hi all,
    I've created a full blog with FuelPHP and it has some features, like:
    - Static page
    - Categories
    - Contents
    - Comments
    - Tag
    - Albums
    - Images I want to try to create a package to distribuite it, but I don't know how. The problem is that I know how to create a simple package (that has only some basic functionality), but I do not know how to create a complete package that can be inserted within a site already in production. I would like to use this topic like a "live tutorial" to implement my idea. So for now some question:
    - Should be better to insert a prefix in my classes name (models/views/controllers) to avoid that the classes of the package have the same names of the existing application class name? Or I can use simply namespace to avoid that?
    - Which structure do you suggest for the view's files (in my structure I've created a "content" div in which all the blog sections resides)? May it be a good solution to rename it to my blogs package so everyone can create a css to modify it? Thanks to all!
  • You can not do that in a package, as a package can't have controllers and is not routable. You can do that in a module though, which has it's own namespace, and is specifically designed for the purpose of re-use. For views and assets I would look at the theme class. It supports an active and fallback theme. Provide a default theme, and define it as active and fallback. When someone wants to alter the look and feel, all they have to do is create a new theme folder, make that theme active, and only add what they want changed. The theme class will load the view from the fallback theme if not present in the active theme.
  • Thank you very much! You were so useful!
    With your answer I'v understand two things:
    - The existance of the theme class: I went from the 1.0 version were it didn't exists
    - The difference between module (reusable part of the application that can be routed) and packages (new functionality for application). Thanks, I'll try to create a module to share it with the community!
  • the Theme class was introduced in 1.1, and more functionality was added in 1.2. A module can be seen as a reusable application component, a package can be seen as a reusable core/framework component. The first provides frontend functionality, the second backend.
  • Thanks very much Harro. EDIT: I modified the post because I did it :)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion