WordPress.org

Ready to get started?Download WordPress

Forums

HTML Import 2
[resolved] Importing Static HTML Pages (23 posts)

  1. joshkellman
    Member
    Posted 2 years ago #

    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.

    Thanks,
    Josh

    http://wordpress.org/extend/plugins/import-html-pages/

  2. Stephanie Leary
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  3. tsbah
    Member
    Posted 2 years ago #

    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.

    TIA

  4. mrose17
    Member
    Posted 2 years ago #

    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...

  5. kpelham
    Member
    Posted 2 years ago #

    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:
    <html><body><?php
    echo getcwd();
    ?></body></html>

    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!

  6. rudy3107
    Member
    Posted 2 years ago #

    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.

  7. Mark Tuttle
    Member
    Posted 2 years ago #

    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;
    wp_update_post($post);

    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.

  8. rudy3107
    Member
    Posted 2 years ago #

    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.

  9. rudy3107
    Member
    Posted 2 years ago #

    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;
    wp_update_post($post);

    <---

  10. Mark Tuttle
    Member
    Posted 2 years ago #

    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.

  11. rudy3107
    Member
    Posted 2 years ago #

    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.

  12. rudy3107
    Member
    Posted 2 years ago #

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

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

  13. Stephanie Leary
    Member
    Plugin Author

    Posted 2 years ago #

    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;

  14. rudy3107
    Member
    Posted 2 years ago #

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

  15. rudy3107
    Member
    Posted 2 years ago #

    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.

  16. rudy3107
    Member
    Posted 2 years ago #

    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/

  17. brainwise
    Member
    Posted 2 years ago #

    Ok, I've tried this plugin several times with different tags to try and pull my content in from my static content website to my localhost site to test. All it does is pull in the menu and links on each page and no content whatsoever. After each attempt, I then use bulk delete to delete the pages and try again.
    I'm thinking at this point that I'm going to have to copy and paste to get the content unless anyone knows of another plugin or way to do it.
    If someone wants to take a crack at, email me and I can point to a page on the site.

  18. rudy3107
    Member
    Posted 2 years ago #

    may be your settings are wrong;
    you can send your HTML page to me at
    admin AT mynation.net

    i will try to import.

  19. Stephanie Leary
    Member
    Plugin Author

    Posted 2 years ago #

    brainwise, please post a link to one of the pages you're trying to import, and let us know what tag/attribute/value combination you're using for the content settings.

  20. rudy3107
    Member
    Posted 2 years ago #

    i tested;
    it works fine.
    im sending him screen shots of settings.

    //LEARY,
    You still not found solution for my problem....!
    to keep original SLUGS.

  21. brainwise
    Member
    Posted 2 years ago #

    Rudy, as noted it does not work for me and I have the same settings as you. The only difference from your test environment is I'm using XAMPP locally instead of WAMP and pulling the pages from a local copy of the web pages.
    Stephanie, here is a page -- http://www.southpoint.com/states/tx/magnoliahoteldallas.html
    Wanting to pull in content primarily in the middle of the page (except on this page content on the right side as well). Under the Content html fields, I have been putting in div, id, and rightcont in the appropriate tag/attribute/value boxes and Saved. I have also tried body as the value. The results I get each time are the right titles to the pages but no content on each page pulled in. Maybe it's an XAMPP quirk. Going to try WAMP later on to see if it works.
    I also use the bulk delete plugin after each import try to make sure I'm not looking at old import pages.

  22. brainwise
    Member
    Posted 2 years ago #

    Thanks Rudy. I got it to work with Google Chrome where it was not working with Firefox 13.0.1. Works now in Firefox after doing that. I also updated to the latest versions of WP and html import2. Need to work with the settings to pull in video links and images.
    Thanks.

  23. rudy3107
    Member
    Posted 2 years ago #

    Silly bean Please note FIREfox bug and FIX my problem too.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic