Menu created via Administrator

edited June 2011 in Installation
Hi all,

im trying to create a menu that was created via Navigation menu in administrator but i cant render in my web pages,
somebody can give me a example to how can i do this.

Regards in advance...


  • edited June 2011
    You will want to use the fuel_nav() function found in the fuel_helper.

    Here are some good resources.
  • edited 11:23PM
    tank you this help me too much
  • edited June 2011
    can someone clarify on why one should use the fuel_block to load 'blocks' instead of the typical $this->load->view('_blocks/ ... ' ) CI method?

    It's a little confusing because the 'main' layout that comes with the default installation uses the load->view method instead of Fuel's fuel_block() ...

    sorry, my bad. fuel_block is meant to be used to load "blocks" that belong to the "block" submodule of FUEL as found in the backend...

    Still, this information is nowhere to be found in the user guide:

    Allows you to load a view and pass data to it. The params parameter can either be string value (in which case it will assume it is the name of the block view file) or an associative array that can have the following values [...]
  • edited 11:23PM
    can someone post an example of how to use fuel_block() please?
  • edited July 2011
    There are 2 main ways to use it:
    Or if you want to pass more then one parameter:
    <?=fuel_block(array('view' =>'my_block', 'parse' => FALSE))?>
    The block view files should be located in your views/_blocks folder OR they can be a block created in the Admin. If your "fuel_mode" FUEL configuration parameter is set to "auto" (in fuel/application/config/MY_fuel.php), then it will first look for a block in the database, and then if not found, will look in the views folder.

    For more info on the parameters, visit the following:
  • edited August 2011
    I can hardly wait to work with fuel cms at his fuel capacity :D. Thanks for your response.
  • edited 11:23PM
    Despite the above, I'm still not clear on what fuel_block() can do for me. I am writing a poll module, and need to display the active poll from the database in a form which might as well be in views/_blocks, since it will be on many pages. Thinking along these lines, I can do a number of things:

    1) Write a self-sufficient view that has all the model methods required to produce the form. May include get_instance()!
    2) Use a controller to access the model, storing the HTML as a key passed to the view
    3) Load the model with fuel_model() and appropriate params, to store an object for use in the view (perhaps with a custom helper, as per the Widgicorp example)
    4) Load a view and at the same time query the model, in the way the fuel_block() method seems to offer?

    What I haven't seen is an effective example of this 4th option. If I had in my main layout file
    fuel_block(array('view' => 'poll_form', 'model' => 'poll_questions_model', 'find' => 'one', 'where' => array('active' => 'yes')));

    presumably I should expect the fuel_block() to render the view 'poll_form'. What the view itself does with any retrieved data I'm not clear about.

    When I do use the code snippet above, I can not get any meaningful output, although if I var_dump() the fuel_block(), I can see it contains a string from the view, although form helper functions inside the view do not seem to have rendered anything. Altering the parse parameter doesn't seem to alter anything (I tried TRUE, FALSE and 'auto').

    At the moment, option 3 seems to be the most suitable, but I don't want to discount fuel_block() if it can achieve what I want it to! I've used it to load CMS 'blocks', and single views, but not with a model query.
  • edited 11:23PM
    Loading a model in your block that way should create a variable named "$poll_questions" that you can access in in your block view file and output data from it:
  • edited 11:23PM
    I just found a couple issues with this function when trying to use a model and have it pass data to the view. You can also use the generic variable "$data" as well as "$poll_questions". I've posted some fixes on the 1.0 beta branch.
Sign In or Register to comment.