Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Does FuelCMS have a function to embed a Fuel Page (saved in the DB) into a CI view file?

edited July 2011 in Share
Hello,

I was wondering if in the FuelCMS API, there is a way to load the contents of a FuelCMS page (one that is stored in the DB) into a view file, similar to how you can load view files or blocks using the fuel_block() function. Here is my example:

Inside a view file (signup_view.php):

<?php $this->load->view('user-agreement'); ?>


This would load the view file called "user-agreement.php". What I would like the ability to do is change this code to something like this:


<?=fuel_page('user-agreement'); ?>


My vision is to have an online-editable page for this piece of content, but also be able to embed it within a scrollable window on my signup page. Right now I'm just loading in the static view file, so when a web editor goes in and changes the content of the page in the CMS, the view file won't get updated, so they would be out of sync. I'm looking for a way to reference the content of that page in the CMS from the "signup_view.php" view file.

Any way to do this?

Erik

Comments

  • edited 3:00PM
    What if you tried something like this:
    $page_init = array('location' => 'user-agreement'); $this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init); $this->fuel_page->render();
    I like the idea of a fuel_page function.
  • edited 3:00PM
    I did a direct copy and paste of that code into my view file, but it didn't work. I have some other things to tend to, but I do want to revisit this, as this would be a handy feature to have in my toolbox.
  • edited 3:00PM
    Errr... yeah... that doesn't work in a view does it... it recursively calls itself. That needs to be in a controller. What if you just create it as a block... theoretically, you could have an entire page be a block and you can embed it in a page.
  • edited 3:00PM
    I used to have it that way, actually. I had the entire contents stored as a block and then included it within another view file with the fuel_block() function. The drawback to this, though is that the content cannot be accessed via a URL, like a page can, and there is a requirement that the content be a standalone page in the site map as well as embedded within the signup page. The other benefit to the page storage method is that CMS users can edit the content and it will update in every place it is referenced.

    Would be AWESOME to see a fuel_page() function. I suppose I could load the page in manually via SQL though...
  • edited 3:00PM
    Hmm... couldn't a block do the same thing? Blocks were built for that sort of re-useable parts of a site. The only main difference being that a page is attached to a URI and a block isn't. To solve that issue though you could create a standalone page in the CMS that loads {fuel_block('user-agreement')} and just manage the block in the admin "Blocks" module.

    I suppose you could also create a page in the admin and use AJAX to load it in too. The page could use a layout that doesn't include the header/footer info.
  • edited 3:00PM
    Wow, I didn't realize there was an admin area for the blocks. That is perfect! I can now give the content managers access to modify blocks and those blocks can be referenced in multiple places. Thanks for walking me through that, sometimes I don't realize the most obvious way to do things.
  • edited 3:00PM
    No problem.
Sign In or Register to comment.