Views in advanced module

edited October 2012 in Modules
Hi, here is my case:
I wanna build a tiny site including a blog page and few other pages,
and I found that the official Blog module is perfect to use.
However, it has its own views, the default theme with many blocks and layout,
while I wanna use one layout design applied to all pages of my site,
and I've finished it in application/views/_layout and blocks like header footer.
Is it possible to use this layout instead of module own views?
Sorry for my poor eng, thx.

Comments

  • edited 7:30PM
    One way to do that would be in the blog modules views/themes/default/_layouts/blog.php to remove what is in that file and use the following:
    $this->load->module_view('app', '_layouts/main.php'); Where the "main.php" is the layout found in fuel/application/views/_layouts/main.php.
  • edited October 2012
    Thx, this works.
    Would u let me know how it works? I search the module_view and no any result.

    Also, is it workable to modify $config['blog']['theme_path'] inside config\blog.php or something similar to achieve same purpose?

    Blog is a module which can be accessed it as a page, but other modules can't, e.g. if i go localhost/fuel/validate, i'll be redirected to admin page, what's the difference between Blog and other?
  • edited 7:30PM
    And moreover, I wanna load the blog detail page using AJAX, may be appending the detail content to description without refresh, would you give me some suggestion?
    Thx again.
  • edited 7:30PM
    The module_view method is something that FUEL has added to the HMVC Module library we are using. There is also a load->module_library, load->module_config, load->module_helper, load->module_model. The difference being that the first parameter is the name of the module to load it from ("app" can be used for the "application" folder).

    There is a "theme_module" parameter you can set in that file to have it pull from a different module (e.g. "app" for the app folder).

    With regards to using ajax to load the content, I suppose you could use the jQuery load ajax function and load it as a page fragment (this page talks about it http://api.jquery.com/load/).
  • edited October 2012
    I got it, now it's success to use ajax, and I just added these lines in Blog_base_controller to prevent loading any layout if page is called by ajax:

    $this->load->helper('ajax');
    if (!is_ajax()) $output = $this->load->module_view($this->fuel_blog->settings('theme_module'), $view, $vars, TRUE);
    else $output = $vars['body'];

    Is this a bad way to work? Any better approach? Thx.
  • edited 7:30PM
    I think that's as good a way as any.
Sign In or Register to comment.