WordPress.org

Ready to get started?Download WordPress

Forums

Multiple content blocks
[resolved] Sorry, can’t edit files with “..” in the name. If you are tr (7 posts)

  1. olalindberg
    Member
    Posted 2 years ago #

    I've just installed Multiple Contents block on one site and suddenly when editing my site I'm getting this error on the page where I used MCB.

    Sorry, can’t edit files with “..” in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.

    Any ideas how I can solve it? Thanks in advance!

    //OL

    http://wordpress.org/extend/plugins/multiple-content-blocks/

  2. peskyneil
    Member
    Posted 2 years ago #

    I've just started getting exactly the same issue, did you work out how to sort this out?

    Thanks.

  3. olalindberg
    Member
    Posted 2 years ago #

    Hi,

    I researched this plugin a bit more and found that I couldn't get the revision history to work so I went with another (more advanced but more standard approach).

    I created a template that only prints all sub-pages to that page. This way I can have as many pages as I want and sort them the way I want (by menu order). My template isn't completely done yet but I think I'll be able to use it and still have revision history and all that good stuff.

    Please write back if you find the solution to this issue though. I have it installed on several other sites.

  4. Grant Prudlow
    Member
    Posted 2 years ago #

    I found a problem with the plugin code itself, specifically the way it reads the template's header, footer, and sidebar. Here's the fix: https://gist.github.com/2721981. Just download it and replace the multiple_content.php file in /wp-content/plugins/multiple-content-blocks.

    If you're interested, here's my explanation of the problem/fix:

    I commented out some code between lines 161 and 172, where the code was attempting to parse the template for the parameter to get_header() (or get_footer(), etc), and replaced it with what's on line 174. If you go through the code, you'll notice a problem with that if statement. For example, if your template has "... <?php get_header(); ?> ..." (where ... is the rest of the template), after line 155, $theTag will be "get_header(); ?> ...", then line 162 will drop the "get_header(", leaving "); ?> ...". Then in the first line of the if statement (line 165), strpos($theTag,' )') WON'T return 0, because it starts with ")", not " )". The code will make an incorrect assumption about the format of your function call, $theTag ends up with all your template HTML, ".php" gets stuck on the end, and it tries to read it as a file. Whoops! I got rid of this format/annotation check and instead decided to get everything before the closing parenthesis (an empty string in the example above, "'parameter'" if it's something like "get_header('parameter')"), and trim off any whitespace (to account for formatting preferences, such as "get_header( 'parameter' )".

    Hope this helps.

  5. jaybuys
    Member
    Posted 2 years ago #

    grantman16 - That makes sense and completely fixed my issue. Thanks so much for posting your solution. Great work.

  6. creativeclicks
    Member
    Posted 1 year ago #

    I would be a little cautious with this fix, it appeared to corrupt something and I lost all my styles and some images from header and footer. Not 100% sure what happened but I eventually backed up and managed to get mostly everything back after 1.5hrs of franticness.

    I am not suggesting this isn't a fix just make sure you back up before trying it :)

  7. Trendwerk
    Member
    Plugin Author

    Posted 1 year ago #

    This problem should be fixed in the new completely rewritten 3.0. Templates and annotations should always work now.

    Any suggestions? Please tell us on Git!
    https://github.com/trendwerk/multiple-content-blocks/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic