Hi All

I`m trying to convert my website, some 300 pages and a few thousand photos into drupal.
I was hoping to just copy & paste from the firefox browser my existing pages into drupal. Basically to save some time. I`m using FCKeditor and WSYIWG modules. When I paste into these it looks ok but then when I preview or save the formatting and fonts are coming out wrong. ie instead of centered text its over to the left, or fonts are italic instead of normal. I`ve tried full html but that still produces lots of problems.
Now i`m guessing it to do with some pretty messy html on my part (i`m a noob), which contains elements of css and old commands in there. It looks ok in the browsers but drupal doesnt like it.

Does anyone have any suggestions what to do, either some way of automatically cleaning up the html or another way of converting my pages. I`ve tried various cleanup tools in ms expression but without much success. I`ve a hell of a lot of webpages to convert so the simplier the better.

Thanks alot

Paul

Comments

tdimg’s picture

Now i`m guessing it to do with some pretty messy html on my part (i`m a noob), which contains elements of css and old commands in there.

it doesn't necessarily have to be your fault, but we don't know and we can't help you without seeing your code, both the html and css code of the site you want to transfer and the site you're going to.

However, the best thing really is to copy&paste the raw text and not the html/css that goes with it, FCK should've this option (paste as text or something similar), and then apply all the formatting in the editor. You might have to add some additional css styles to get everything you had before.

dman’s picture

Though it requires some intellectual overhead if your input is really flaky,
import_html is designed to to all of this for you - including as much code-clean-up as is possible.
may not work on awful input.
But at 300 pages and a thousand photos, it may pay off to try.

But yeah, Copy & Paste from browser to WYSIWYG is nowadays really messy. In the old days the wacky layout got left behind ... and you actually got something still usable. Now browsers and clipboards are too clever and try to transfer all sorts of stuff.
Old-school solution:

  • Copy from web page.
  • Paste into really basic text editor.
  • Copy from text editor.
  • Paste into destination.
  • Re-apply actual needed formatting
prdrup70’s picture

Thanks for the comments.

I did have a look at the import_html, I got so far and then became dizzy when it started talking of having understanding XSL. So I left it alone. I`ll check again.

The suggestions of copying text and redoing formatting is something I dont have time to do unforuntately. It would take me months of work which I dont have.
I was just hopeful that there was someway of just transferring the final look of a page into drupal, it almost works. Here`s one page i`m testing it with.

http://www.cambags.com/canon/300d_10_20d/shoulder/canon_10eg_desc.htm

And another I tried to clean up a bit
http://www.cambags.com/nikon/d70/backpacks/Lowepro_Computrekker_AWdescri...

Thanks

dman’s picture

That really is horrible input, and it may be a case of GIGO but it is at least standard (old-style) HTML, and not something truly stupid like MSWord 'HTML'

In theory, import_html should take a guess at it and give your the body content as-is. You don't really have to understand XSL (you are forgiven) unless you really want to improve it on the fly.
Stick with the default settings and you should get a result. It may not be pretty, but it won't be worse.

prdrup70’s picture

ok i`ve given import_html another go and all I can say is Aarrrggh!
I`ve installed it import_html, setup XSL then I have to install htmltidy which i`ve done. But then I get an error . so I check the install and it says go to htmlTidy settings. But there is no settings. So I check on drupal and it seems that the developer forgot to add some fix so there is a patch to correct this. So I look to find out how to patch a module. There seems to be lots of different ways to patch a module and all of them seem to as clear as mud to use. Anyway, get cygwin. patch command doesnt exist. Try tortoisesvn patch command doesnt exist!! Give up.

Any ideas? Nothing is straight forward is it in drupal.

dman’s picture

No idea.

But then I get an error

means I can't help you there.

prdrup70’s picture

Error I get is

Fatal error: Cannot redeclare htmltidy_test() (previously declared in C:\wamp\www\drupal-6.15\sites\all\modules\htmltidy\htmltidy.module:479) in C:\wamp\www\drupal-6.15\sites\all\modules\import_html\coders_php_library\install-htmltidy.inc on line 102

dman’s picture

golly. you are using the old htmltidy module?
just turn it off

prdrup70’s picture

ok got a bit further thanks. yes I turned it off and i`m getting an error

* HTMLTidy executable is not available. Couldn't find tidy binary anywhere!
* warning: Invalid argument supplied for foreach() in C:\wamp\www\drupal-6.15\includes\form.inc on line 763.
* HTMLTidy executable is not available. Couldn't find tidy binary anywhere!

Its looking in /usr/local/bin/tidy

I have the tidy.exe . but just not sure where to put it in a windows environment.

dman’s picture

depending on the version ...
If you are running the current 'stable' release, there should be a collapsed setting where you can enter the path to wherever you want to put it. It's convenient straight in c:\Program Files\ but anywhere you like is cool.
Can you not see the 'HTML Tidy' config in your settings page?

prdrup70’s picture

In Import_Html settings you mean?? yes I get this. But the path /usr/local/bin/tidy doesnt mean anything to me.

Import HTML Settings

* HTMLTidy executable is not available. Couldn't find tidy binary anywhere!
* warning: Invalid argument supplied for foreach() in C:\wamp\www\drupal-6.15\includes\form.inc on line 763.
* HTMLTidy executable is not available. Couldn't find tidy binary anywhere!

Install HTMLTidy
Path to HTMLTidy executable:
/usr/local/bin/tidy
If the distributed php tidy extension is not enabled, we require the HTML Binary to be available on the server. Please download and install it wherever you can, then tell me where to find it.

If you are unable to install the htmltidy binary yourself, try this button to download and unpack it on the server (Linux only so far) .

There is a small chance it will work for you, but configurations are different everywhere. This will work only on Linux, Windows users can just get the exe and drop it in this directory.

dman’s picture

But the path /usr/local/bin/tidy doesnt mean anything to me.

It's a path.
On your computer disk.
Where you store files.
A folder.
labelled 'usr'
contains another folder.
labelled 'local'.
etc.

NOW, if you don't have exactly those folders - which you probably won't on a Windows box (but you could) then you use a different path.
Of your choice.
On your disk.
Called something else.
Like 'Program files'
or 'Apps'
or something.

So if you were able to open up the "folder" called "Program Files" on your "C Drive" and make a new folder called "htmltidy" in there and put the "tidy.exe" file in there, then the "path" to the "executable" program would be "C:\Program Files\htmltidy\tidy.exe" and not "/usr/local/bin/tidy"
So where it asks for the "Path to HTMLTidy Executable" ...
... That's where you should enter the path to the HTMLTidy executable.

And that's the question. And the answer.

prdrup70’s picture

yes thanks, when I say it doesnt mean anything to me. It didnt exist anywhere!
anything I put in the /usr/local/bin/tidy it always goes back to that same directory.
I tried creating those same directories in the server and put tidy.exe in there but still doesnt find it.

DrunkMunki’s picture

your in windows so /usr/local/bin/tidy doesnt matter to you, its a hard coded default location when converted from the linux version to the windows binary.

in regards to putting the file into the programs files folder, i suggest you dont, any folder name with a space will most likely cause errors, its always a safe bet to use c:\web or c:\tidy\tidy.exe

sjtout’s picture

Even after entering the correct path in Windows, it kept replacing it with the old path.

I changed the old path to my windows path in these files:

install-htmltidy.inc
tidy-functions.inc

Saved the files, refreshed, and tidy was found.

My windows path was c:\tidy\tidy.exe