Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to consolidate circular elements?
  • Hi. Often I have the problem that I have some things in my application (website) that I want to use in several controllers.
    For example I have a bar with bread crumbs on my website. I use it in every sub-site, which means I have to set it in every controller. Or things like a search input field in a right column on the website, tag clouds or something. I don´t want to have in every controller the same method doing the same things. If something changes, I have to add the changes to every controller. In CodeIgniter (I used before) I wrote a Library which I load in every controller and there I stored all my circular methods to consolidate them. How can I do this in Fuel PHP? If I saw it correctly there is no pendant like Libraries or Plugins (as in CodeIgniter). Can I just create a new Class in fuel/app/classes/ or better create a new Module? What is the best way?
    And: I found nothing about Modules in the Docs! Thanks for your ideas and suggestions! :)
    I´m completely new to Fuel and don´t know for some things how to do it at the moment.
  • I wrote a "upper class" which extends my controller I use for my website. But ... the upper class (called "page") is also a controller. So it could called via the web browser (if someone would just write the controllers name in the url). How can I prevent my upper class from being accessed by a user via the web browser??
  • Don't make any action_ methods in your parent controller and so it shouldn't be accessible from web.
  • I think what are your trying achieve, is to extend for example the controller? So later you have Your_controller extending the core one. so later all of your controller would extend the Your_Controller instaed of the core. Try to look some information here:
    http://fuelphp.com/docs/general/controllers/base.html
  • So you just suggest to make normal OO modeling? Good idea ... PHP and good OO modeling are things which are at the moment not working good together in my head. ;)
    But I will try. Thanks!

Howdy, Stranger!

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

In this Discussion