wysiwyg editors and script placement
July 16th, 2009
In my experience, wysiwyg editors, at least FCKeditor and TinyMCE, won't work if scripts are loaded at the bottom of the page. However, it's great to have the scripts down there for the perceived performance boost.
So, conditional statements in the page.tpl.php to the rescue!
At the top:
<?php
if (arg(2) == 'edit') {print $scripts;}
?>At the bottom:
<?php
if (arg(2) != 'edit') {print $scripts;}
?>Now the scripts load at the top of node edit forms and the bottom of everything else. There are probably fancier ways to handle this, and you'd have to explore them if you were using a wysiwyg editor on, say, comments. But the root of the problem is: wysiwyg scripts need to be loaded at the top of the page.

a better approach
To account for adding nodes too, define this in the theme's hook_preprocess_page:
<?php$vars['scripts_in_header'] = (arg(0) == 'node' && (arg(2) == 'edit' || arg(1) == 'add'));
?>
Then check that value as above.