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.

Editing Blocks from Admin

pscpsc
edited December 2010 in Bug Reports
So I'm trying to figure out what the deal is with header & footer blocks.

I can edit the header and footer blocks from FTP and thats all fine.

If I create a block called header, I can import from the block file. Sweet.

If I create a block called footer, for some reason that block doesn't want to auto load.

When I deleted the header block, THEN the footer block auto loaded. Weird....

IF I make a change through the admin interface to the header, footer, or any of my pages, the changes say they save.

BUT they do not take effect.

I have to upload the file via FTP.

THEN the change still doesn't take effect.

I need to go back to the block, go to edit it, and it will say it can autoload. I load it, save it, and THEN the change takes effect.

Maybe I'm missing a setting somewhere but I don't think this is supposed to happen...

Comments

  • edited 6:22AM
    Are you using the header and footer blocks within a layout (e.g. views/_layouts/main.php)? If so, if you are wanting to make your header and footer block editable in the admin, make sure your layout uses fuel_block() instead of $this->load->view('_blocks/header');

    The fuel_block() function will first check the database if there are any blocks with the given name, and if not, then will check the views/_blocks/ folder for a block with the specified name. Does that make sense?
  • pscpsc
    edited 6:22AM
    Thanks for the quick response, on a sunday no less!

    So on your recommendation I've changed views/_layouts/main.php to use fuel_block and that looks good. I can now inline edit the blocks which is sweet.

    And when I upload a new view via FTP i'm asked to auto load it and then the changes go through.

    I noticed a different problem earlier but now that we're past my first post we'll move on :D I'm xcited to get this thing going it looks freaking powerful.

    SO I currently have a footer block that is editable through admin cp.

    I just created one for header.

    It does not auto load the views/_blocks/header.php file.

    Earlier when I was starting out, I added and autoloaded the header - then made a footer and the footer didn't auto load. When I deleted the header block from the admin CP, and visited the footer block in the admin CP, *then* the footer block prompted me to autoload.

    Got a quick fix for this?
  • edited 6:22AM
    The importing logic first checks the timestamp of the block (or page) file (e.g. views/blocks/header.php) and compares it to the last updated value of the block that's saved in the database. If the timestamp of the file is more recent (greater), then the value in the DB, it should prompt you to import that file. If the timestamp of the blocks file is less then there should not be a prompt. Does that explain what you are seeing?
  • pscpsc
    edited December 2010
    YES, that explains that.

    BUT now when I have the header block, I get exception 'Dwoo_Security_Exception' with message 'Call to a disallowed php function : css' in application/libraries/dwoo/Dwoo/Compiler.php:2937 ; application/libraries/dwoo/Dwoo/Compiler.php(1715): Dwoo_Compiler->getPluginType('css') #1 ; fuel/application/libraries/dwoo/Dwoo/Compiler.php(1365): Dwoo_Compiler->parseFunction('
  • edited 6:22AM
    There is a bug in the application/config/parser.php file that I will upload shortly. To fix on your end, on line 77 or so where it lists the functions, change 'cs' to 'css'.
  • pscpsc
    edited December 2010
    Aweeeeesome. *you are the man*

    However, now:

    exception 'Dwoo_Compilation_Exception' with message 'Compilation error at line 16 in "string:" : The template has been closed too early, you probably have an extra block-closing tag somewhere' in fuel/application/libraries/dwoo/Dwoo/Compiler.php:957 Stack trace: #0
    fuel/application/libraries/dwoo/Dwoo/Compiler.php(813): Dwoo_Compiler->push('

    I don't have any markup in my header that is foreign to the stock header file.

    FWIW, line 16 in my header file is <?php /* for IE specific ?>
  • edited 6:22AM
    I need to change the header file to use the alternative php syntax so that when it get's imported, it will be translated properly to the corresponding Dwoo templating syntax. I'll post a fix for that as well later but in the meantime, if you change the top conditional statement to the following and reimport, it should work:

    <?php if (!empty($is_blog)) : ?> <title><?=$CI->fuel_blog->page_title($page_title, ' : ', 'right')?></title> <?php else : ?> <title><?=fuel_var('page_title', '')?></title> <?php endif ?>
  • pscpsc
    edited December 2010
    No change. using the code you provided :( - you meant for that to go in the header block, right?

    here is my header, less some HTML. Not a huge problem for the time being I can just not use the block until you post the fix for the syntax.


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> <head> <meta name="robots" content="noindex, nofollow"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="en-us" /> <TITLE><?php echo fuel_var('page_title');?></TITLE> <meta name="keywords" content="<?php echo fuel_var('meta_keywords'); ?>" /> <meta name="description" content="<?php echo fuel_var('meta_description'); ?>" /> <meta http-equiv="imagetoolbar" content="no" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <?php echo css('main'); ?> <?php /* for IE specific ?> <?php echo css('ie6', '', array('ie_conditional' => 'lte IE 6')); ?> <?php echo css('ie7', '', array('ie_conditional' => 'lte IE 7'));?> <?php */ ?> <?php echo js('jquery, main, jquery-cycle'); ?> <?php echo js($js); ?> <script type="text/javascript" charset="utf-8"> //<![CDATA[ var basePath = '<?php echo site_url();?>'; var imgPath = '<?php echo img_path(); ?>'; //]]> </script> </head>
  • edited 6:22AM
    I forgot which version you were using and the above is for the 0.91 branch.

    The PHP code to template code function isn't perfect so my guess is that upon importing, some templating code may get messed up. Try removing that middle part about IE specific code.

    You can use the code and pre tags to do code formatting.
  • pscpsc
    edited 6:22AM
    Great, Thanks!! I will make the switch to 0.91x in the next day or so after you've got those fixes cleared ;)

    Thanks very much for working with me over the last hour or so, great support!! Let's fill this forum up with info to help everyone else!
Sign In or Register to comment.