code design question

edited October 2011 in Modules

i'm new to FUEL/CodeIgniter, and so i'm still struggling to get a idea what fits best where. What i have in mind is a travel website, with some content managed by real people, and some generated stuff. To give you a idea:

"/flights" for instance should be a overview page with
* a form as entrypoint for a external booking engine: simple static block
* some editable text areas: fuel_var()?
* some special offers: a module that pulls stuff from the database, also straight forward
i probably wont even need a controller, so far so good.

now i want something like "/flights/lax" that would give you some info about Los Angeles (editable text areas) and a compent that pulls some stuff from external resources, like for instance "from Frankfurt, Munich, Berlin .... starting at 199€" which would come from a xmlrpc server, and "/flights/lax/fra" which would use the same component to retrieve cheapest fares for FRA-LAX and so on, you get the idea.
"/flights/lax/fra" is mapped via routing.php to some fetch() method in the controller, but where do i place the other code? My first idea was to have a Class CheapFares in the library dir that does all the xmlrpc communication, this lib is loaded from the controller, gets the arguments from the URL passed and spits out some fares. this data is stuffed into a dwoo template (btw, where is the correct place to store dwoo templates?) which returns some html that is passed on to the view ... is that the right way(tm)? or should i render the html within the CheapFares class instead? Or something completely different?

please enlighten me :-)


  • edited 2:12AM
    I think you are on the right track by creating a CheapFares class to do all the heavy lifting and then passing that off to the view file in your controller. Dwoo templating syntax is used if the view is managed in the admin through input fields. It can be used in views as well if you want and you can use the "parse_template_syntax()" function found in the MY_string_helper.php to parse the templates, however, we normally don't do that just because it's quicker to just use raw PHP in the views.
Sign In or Register to comment.