controller and editable pages

edited August 2014 in Modules
if i create editable pages at the backend admin, can i still create a controller and upload through ftp to do extra db queries to target at this page?

Comments

  • edited 12:01AM
    I'm not quite sure I understand the "upload through ftp to do extra db queries to target at this page" however, you can output the contents of the page you create in the backend by simply rendering it as shown here:
    http://docs.getfuelcms.com/general/pages-variables#controller
  • edited 12:01AM
    basically, i want to create an editable page at the backend, but on this page there are parts use data records from other tables in the table such as user information table.

    I am not thinking to directly coding php mysql queries in this editable page. So i am thinking to create a controller to handle the task.

    so for example,

    i create this editable page with route "en/user", can i create a user controller but point to this editable page( which is not the standard mvc way)? if it is doable, how can i do it?
  • edited 12:01AM
    The above link has the example to do this using:
    $vars['my_var'] = 'My Variable'; $this->fuel->pages->render('my_page', $vars);
    However, have you considered using a static "block" to house that logic and then insert the block into the layout or directly in the CMS using the templating syntax:
    // in a layout <?=fuel_block('my_block')?> // in a variable field in the CMS using templating syntax {fuel_block('my_block')}
    This may be simpler then using a controller.
  • edited 12:01AM
    i did also considered block way. However because i do not want to scatter the codes around, thus still prefer to put it in controller. as for the mentioned way such as

    $vars['my_var'] = 'My Variable';
    $this->fuel->pages->render('my_page', $vars);

    my_page refer to static view files right? but in my case it is editable page, how could that possible
  • edited 12:01AM
    It refers to either. A page in the CMS with a location value of "my_page" will be returned. If there is a corresponding view file as well, the one in the CMS will take precedence. To force it to either a static view or the one in the CMS, you can pass the "render_mode" parameter as a property parameter like so:
    $vars['my_var'] = 'My Variable'; $this->fuel->pages->render('my_page', $vars, array('render_mode' => 'cms'));
Sign In or Register to comment.