Inline Editing and IE conditional statement error

edited January 2011 in Bug Reports
Hi

I'm running the 0.91 branch.
I'm not too sure what is going wrong and giving me this problem.
First off I have this code in my layout file:
</head> <!--[if lt IE 7 ]><body class="ie6 <?php echo fuel_var('body_class', ''); ?>"><![endif]--> <!--[if IE 7 ]><body class="ie7 <?php echo fuel_var('body_class', ''); ?>"><![endif]--> <!--[if IE 8 ]><body class="ie8 <?php echo fuel_var('body_class', ''); ?>"><![endif]--> <!--[if IE 9 ]><body class="ie9 <?php echo fuel_var('body_class', ''); ?>"><![endif]--> <!--[if (gt IE 9)|!(IE)]><!--><body class="<?php echo fuel_var('body_class', ''); ?>"><!--<![endif]--> <div id="container"> <header>
I also load in a header block with fuel_model() and a footer block with fuel_model(). Only the portions I intend to be editable are included in these blocks.

Everything works perfectly for me when I am not logged into the admin section of Fuel. The page renders as I am expecting it to and everything is working ok but then catastrophe hits when I log into the Fuel admin and refresh the page.
Everything renders correctly up to:
</head> <!--[if lt IE 7 ]><body
Which is my first IE conditional statement. After that it repeats all the html that has been previously rendered from the doctype declaration to the code above 4 times and then adds the code for the inline editing after the <body as seen after the conditional statement above so everything is then commented out including the html code for the page until I get to another IE conditional statement which appears before the javascript for the inline editing. So the only thing that shows on the page now is the inline editing buttons because everything out is commented out due to the inline editing messing up the IE conditional statements attached to the body classes.

If I remove the conditional statements on the body and replace them with <body class="<?php echo fuel_var('body_class', ''); ?>"> everything works perfectly but I would prefer to not have to do this.

Any help would be greatly appreicated as I am stumped at the moment.
Ian

Comments

  • edited 1:06PM
    I think the problem is due to the multiple body tags. The regular expression I had in fuel/modules/fuel/libraries/Fuel_page.php class originally didn't check for multiple occurrences. I just posted a fix so that it will just limit it one if more then one are in the page. Try it out and let me know if it fixes your issue.
  • edited 1:06PM
    The issue of everything being commented out is fixed but the code now looks like
    <!--[if lt IE 7 ]><body class="ie6 home "> <span class="__fuel_marker__" data-href="http://localhost/dcuengsoc/fuel/pages/inline_edit/" data-rel="page_title" title="Page Title" data-module="pages"></span> <span class="__fuel_marker__" data-href="http://localhost/dcuengsoc/fuel/pages/inline_edit/" data-rel="meta_keywords" title="Meta Keywords" data-module="pages"></span> <span class="__fuel_marker__" data-href="http://localhost/dcuengsoc/fuel/pages/inline_edit/" data-rel="meta_description" title="Meta Description" data-module="pages"></span> <span class="__fuel_marker__" data-href="http://localhost/dcuengsoc/fuel/pages/inline_edit/" data-rel="body_class" title="Body Class" data-module="pages"></span><![endif]--> <!--[if IE 7 ]><span class="__fuel_marker__" data-href="http://localhost/dcuengsoc/fuel/pages/inline_edit/" data-rel="body_class" title="Body Class" data-module="pages"></span><body class="ie7 home "><![endif]--> <!--[if IE 8 ]><span class="__fuel_marker__" data-href="http://localhost/dcuengsoc/fuel/pages/inline_edit/" data-rel="body_class" title="Body Class" data-module="pages"></span><body class="ie8 home "><![endif]--> <!--[if IE 9 ]><span class="__fuel_marker__" data-href="http://localhost/dcuengsoc/fuel/pages/inline_edit/" data-rel="body_class" title="Body Class" data-module="pages"></span><body class="ie9 home "><![endif]--> <!--[if (gt IE 9)|!(IE)]><!--><span class="__fuel_marker__" data-href="http://localhost/dcuengsoc/fuel/pages/inline_edit/" data-rel="body_class" title="Body Class" data-module="pages"></span><body class="home "><!--<![endif]--> <div id="container">
  • edited 1:06PM
    The span fields should be OK because they are markers for the inline editing and shouldn't appear in the rendered page. The last one for gt IE 9 looks like it may have some issues with the comment. What issues on the front end are you seeing?
  • edited 1:06PM
    I'm not seeing an errors at the moment because I haven't made any content that is editable in the CMS yet. In the next few days I will be so I'll be able to check then if everything is as it should be.
  • edited 1:06PM
    Ok I made a static view file page. Nothing fancy just some html and text which will be loaded into via <?php echo fuel_var('body', ''); ?> everything works fine.

    Then in the CMS I create a page at this location and it asks me to load in the view file for it so I do that and the files contents get loaded in the body textarea. I then refresh the page and am met with loads of errors and the page not rendering correctly. First off Fuel is adding a <!--__FUEL_MARKER__1--> to everywhere that seems to be editable, I'm guessing because the page is not being rendered fully by fuel and being stopped halfway through.

    I see two errors formatted by fuel correctly they are
    "Message: Undefined variable: CI

    Filename: fuel/Loader.php(298) : eval()'d code"
    and
    "Message: Trying to get property of non-object

    Filename: fuel/Loader.php(298) : eval()'d code"

    I then see another error from xdebug which is followed by a call stack and the very last call in this is to eval() which contains a big portion of the remaining code for my page with php not parsed.

    I'm aware this problem could be something wrong I did and could be entirely unrelated to the previous.
  • edited 1:06PM
    I think that error may be unrelated. What happens if you add $vars['CI'] =& get_instance(); to the fuel/applications/views/_variables/global.php file so that variable is set (if it isn't already). That error likes to appear in layouts when the CI variable isn't set. By default that variable gets set for pages not rendered by the CMS, but not for those rendered by the CMS (for security).
  • edited January 2011
    The $vars['CI'] fix works, thank you very much.

    The inline editing code is now being rendered correctly and everything seems to be working on that end for the moment but I do still have a problem.
    The parser or fuel seems to be converting " and ' to htmlentities for pages in the CMS which means class names are showing up as <div class=&quot;box&quot;> instead of <div class="box">. Do you know how I can fix this so they are rendered as " or ' instead of their entity counterpart?
  • edited 1:06PM
    That is a bug that krept in a couple commits ago when trying to fix the safe_htmlentities() function for older versions of PHP. I've fixed that function on both branches now.
  • edited 1:06PM
    Thanks
Sign In or Register to comment.