Support » Plugins and Hacks » [Resolved] [Plugin: HTML Import 2] Importing Static HTML Pages

[Resolved] [Plugin: HTML Import 2] Importing Static HTML Pages

  • Hello,

    I installed WordPress in a sub-directory on my site so I could import the pages and install a new theme.

    I’m getting this error message when using the plug-in:

    Warning: scandir(/home/content/06/7327206/html/wp/html-files-to-import) [function.scandir]: failed to open dir: No such file or directory in /home/content/06/7327206/html/wp/wp-content/plugins/import-html-pages/html-importer.php on line 210

    Warning: scandir() [function.scandir]: (errno 2): No such file or directory in /home/content/06/7327206/html/wp/wp-content/plugins/import-html-pages/html-importer.php on line 210

    Warning: Invalid argument supplied for foreach() in /home/content/06/7327206/html/wp/wp-content/plugins/import-html-pages/html-importer.php on line 211

    Warning: Invalid argument supplied for foreach() in /home/content/06/7327206/html/wp/wp-content/plugins/import-html-pages/html-importer.php on line 642

    Help please.



Viewing 15 replies - 1 through 15 (of 22 total)
  • Plugin Author Stephanie Leary


    This almost always happens because you don’t have your beginning directory option set correctly — that’s why it says “no such file or directory.” It should be a complete path from the server root — in this case, it should start with /home/content/06/7327206/html — and it must be a path to files on the same server, not a URL to some other site.

    See the user guide for more details.

    Hello Stephanie,

    My apologies if you get this message twice.

    I configured all tabs in HTML Import 2/Settings. Then I tested the plugin with two clean XHTML files. But the import returned only the title, leaving the content area blank.

    Again, both files pass the local (BBEdit) and external (W3C Validator) test.


    tsbah – if you aren’t seeing any errors, but the content area is blank, look at the “Content” tab under “Settings > HTML Import” – under “Select Content by” you have to enter the HTML tag that contains the content. usually, you also have to specify an attribute value as well. for example, if you want to import everything in

    <div id=’content’> … </div>

    then the tag is ‘div’, the attribute is ‘id’, and the value is ‘content’ (do not enter the single-quotes).

    if the element isn’t present in the HTML file, then you are going to get posts without any content…

    I had this problem too. I don’t do well with exact url’s so I uploaded a file I called t.php to the directory. On the file is:
    echo getcwd();

    Go to the page in your browser and it will give you the exact url! http://www.mysite.com/thefolder/t.php

    I still had the problem. Figured out the copy/paste of the exact url added an “invisible” space at the end of the url. argh! Deleted the extra “invisibles” and taaadaaa! It works!! THANK YOU THANK YOU THANK YOU!

    Nice work Stephanie Leary

    it worked well; without reading user guide.

    my only problem is it create file name with its title;
    is there any way keep old file name intact

    as in main index.html file its calling 1.htm but when i imported it makes “long title name.html”

    Let me know how to keep old names.

    I’m not the plugin author, but a subsequent poster asked a similar question.

    I have manually patched slugs to match filenames by computing the mapping $id->$filename from post id to filename, and then writing a script to essentially

    $post = get_page($id);
    $post['post_name'] = $filename;

    By the way, your request is reasonable, but I’m not certain it is always possible. There seems to be some requirement that slugs are unique (although I’ve gotten away with slugs that are not unique for reasons I can’t explain), so if you have two files with the same name FILENAME you might end up with posts having slugs FILENAME and FILENAME-2.

    Thank you Very much.
    As im importing whole directory, and in same directory its not possible to keep 2 files with same name. (other than with different extention)

    i will try if its works for me.

    Thank you Very much Again.

    Sorry to say;

    i tried to go thru your other post; but i did`t understood.
    can you tell me step by step as im dunno ABCD of php or scripts

    i have to add $my_post[‘post_name’] = $slug;
    in html-importer.php, before the post insertion code.

    then i did not understood this part
    I have manually patched slugs to match filenames by computing the mapping $id->$filename from post id to filename, and then writing a script to essentially
    $post = get_page($id);
    $post[‘post_name’] = $filename;


    If you are not already comfortable with php scripting, and since your target is a single directory of files, it is probably faster and safer to bite the bullet and change the slugs manually one page at a time (dashboard -> pages -> all pages -> edit). A single evening of boring manual labor in front of the television will probably get the job done, and then it will be over.

    Im uploading whole Law manual, as i already did some 11,000 pages.
    here http://mynation.net/laws/ still around 20,000 to go.

    i did it hard way. i imported to local PC developing enviornment then exported to XML and in XML file i updated manually to each file slug as in Index file

    eg : like this ipc.htm [ http://mynation.net/laws/bare-acts/ipc/ipc.htm ] is calling some 511 sub pages. so i changed accordingly in index page [ipc.htm] and chnaged all file names.

    Which took me 3 months to import and change 11,000 pages.

    if its import same file name then its easy, no need to do manual changes, and can be imported in 3 days.

    thats why i asked.

    just found out sillybean had BabY on 22/12/11

    thats why there is no update or modification in this plugin.

    Plugin Author Stephanie Leary


    Yes, the new baby is a big distraction. 🙂 I’m just getting back to WordPress stuff. Thanks for your patience.

    The redirect feature is intended to eliminate the need for matching slugs — that is, it won’t matter that the new slugs don’t match the old ones, because visitors will be redirected to the new address anyway. And that’s there for exactly the reason Mark pointed out: WordPress requires unique slugs, even for children of different parent pages.

    Nevertheless, I get a lot of requests for this feature.

    If you want to try it anyway, try this:

    find line 579 in html-import.php — the blank line after
    $my_post = array();

    Add this:
    $my_post['post_name'] = $val;

    its in html-importer.php not in html-import.php

    no its not working.
    its still creating pages with TITLE not with original SLUGS.

    indrict is ok but on main index file there are links to old SLUG names that make to fail whole import.

    as i told in my earlier post.

    Any hope in getting updated version to keep original SLUGs.

    i have still 56000 pages to go
    so far i imported only 13,000 by changing SLUGs one by one here http://mynation.net/laws/

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘[Resolved] [Plugin: HTML Import 2] Importing Static HTML Pages’ is closed to new replies.