It looks like you're new here. If you want to get involved, click one of these buttons!
$page_init = array('location' = 'contact');
$this->load->module_library(FUEL_FOLDER, 'fuel_page', $page_init);
$fuel_page->add_variables($vars);
$fuel_page->render();
$vars['layout'] = 'my_layout';
$this->fuel->pages->render('contact/contact',$vars);
<?=fuel_var('body')?>
<?=fuel_edit(6,'body','pages')?>
work fine, but I was hoping to be able to display the content and allow it to be edited. This should be very easy, I feel I'm really missing something, or I can't find the correct and updated documentation for this with examples.
Comments
$this->fuel->pages->render('contact/contact', $vars, array('render_mode' => 'cms'))
The different render modes are "views" and "cms".
<?php echo fuel_var('body','no body present'); ?>
still outputs "no body present" instead of the content from the CMS Contact page.
CMS has Pages = Contact with text in body box.
Controller collects data required, and processes form and outputs variables to view file.
View file is very plain and only displays the form (more logic to come later) and then displays the above code to show the text from the CMS.
1. The location value in the CMS of the page variables that you saved is "contact/contact"? 2. That page in the CMS uses the "my_layout" and that layout has a variable of "body" where you can input text?
3. "my_layout" has a
<?php echo fuel_var('body','no body present'); ?>
OR is there a view that is being used that has that code in it. If a view, has is that view included into the page rendering?The controller $vars['layout'] variable points to the proper layout file.
'contact/contact' is the view file I'm using for the controller.
The layout is using
<?php echo fuel_var('body','no body present'); ?>
to display the controller content.I never thought about the fact that the layout is using that until now.
Is there another way to display the controller content as well as the CMS content on this page?
If I'm going about this all wrong, please let me know. I want to do this the normal way as I'm sure this is something you do quite often (use a controller and allow inline editing of content within the CMS).
$vars['my_var'] = 'My variable'; $this->fuel->pages->render('contact/contact', $vars, array('render_mode' => 'cms'));
As a side note, If you are just wanting the variables saved in the CMS to be past to the view, you could use something like the following to just grab the saved variables then you can pass them to the view just using $this->load->view('contact', $vars);
$vars = $this->fuel->pagevars->retrieve('contact');
The inline editing won't work though unless you use the fuel->pages->render() method.
It works beautifully.
On the view page I added the following 2 lines and I think it will work for what I need:
<?=fuel_edit(6,'body','pages');?> <?=fuel_var('body','')?>
I can now edit the content inline for this page. It brings up the whole CMS pages page, but it works pretty well
Thanks!
Thanks!
#1) non-super admin were still not seeing the pencil where the var_edit content is for the super-admin
#2) I get an error on the some pages of the following:
Fatal error: require_once(): Failed opening required '/home/harkus/dev/vivace/fuel/application/../modules/fuel/libraries/MY_Parser.php' (include_path='.:/usr/local/lib/php') in /home/harkus/dev/vivace/fuel/application/libraries/MY_Parser.php on line 3
I noticed that My_Parser.php is not in the 1.3 fuel/modules/fuel/libraries folder now. When I tried copying my old one over it gave this error:
Fatal error: Cannot redeclare class MY_Security_Policy in /home/harkus/dev/vivace/fuel/modules/fuel/libraries/MY_Parser.php on line 383
Thoughts?
When I upgraded I only replaced the fuel/modules/fuel folder
As for the user, he's not super-admin, but he does have full Pages: Create, edit, delete, publish permissions.
Upgrade Instructions
The vast majority of 1.3 changes to the codebase happened in the fuel/modules/fuel folder. However, there were a few changes that happened in the fuel/application/ folder as well. Our recommended method for upgrading is to use GIT and add the FUEL GitHub repo as a remote. Create a branch from your existing repo, merge FUEL’s master branch into that, resolve any conflicts (there will most likely be some in your fuel/application/config files) and then test before merging back into your own master branch.
I'll have to figure out how to do all this... it's been on my to-do list to learn this stuff
The pencil shows up for fuel_edit for a separate model I created though.
Very strange.
... 'permission' => array( 'create' => 'pages/create', 'edit' => 'pages/edit', 'publish' => 'pages/publish', 'delete' => 'pages/delete' ),
It was originally:
'permission' => array( 'pages', 'create', 'edit', 'pages/upload' => 'pages/create', 'publish', 'delete'