• I have ported the live preview hack from MT to WP.
    Basically this hack allows your users to see a live preview of what they are writing below the comment entry box.
    Currently it uses onkeyup, but you could easily change it to onblur if you don’t want the realtime updating.
    This is pretty easy all things considered, and could pretty painlessly be implemented on the wp-admin/post.php page as a stop gap until the preview function is back.
    Here it is:
    Find it over on my blog, there was something screwy going on here, so I took down the code I had pasted here. You can find it at this link: https://chrisjdavis.org/index/2004/03/15/live-preview-for-comments/463/
    That is about it. I have this hack running on my site currently, so you can go on over there and see it in action. Just leave a comment!
    https://chrisjdavis.org

Viewing 10 replies - 16 through 25 (of 25 total)
  • Oh.. I only installed the portions of this plugin that pertained to comments (I don’t really care about previewing during “write”). Could this be the reason?

    Right. Just in case anyone has the same problem that I did. I was once again beaten by whitespace.. This time in liveupdate.php

    Quick question. I have the plugin working, but there is not border around the preview. Have I overlooked something?

    Live preview (specifically the preview section) has its own built in division ( #textdisplay) so if you add this division to your CSS then you can make it look like whatever you want.
    I made mine look identical to what the posted comment looks like.
    This is mine:
    #TextDisplay{
    border-left: solid 1px #666666;
    border-right: solid 1px #000000;
    border-top: solid 1px #666666;
    border-bottom: solid 1px #000000;
    background:#ffffff url(/comment-background.jpg) repeat;
    margin:10px 30px 10px 30px;
    padding:3px;
    font-size: 11px;
    font-family:verdana;
    }

    Thanks a million Anon.

    In case someone else like me had the same problem as davidprince did above and didn’t understand his solution (which mentioned whitespace in the livepreview.php file), remove all the trailing whitespace after the final ?> in the file.
    If any PHP folks are still reading this old thread, could you tell me what the issue is? The PHP manuals talk about how you don’t have to worry about whitespace.

    For: “Then I get a whole bunch of Warning: Cannot modify header information – headers already sent by (output started at …./liveupdate.php:43)” this problem I got the solution from my buddy. Apparently in the livepreview plugin file there is one space at the end of the file after the ending ?> PHP tag. I deleted the space after the tag and it fixed everything.

    Anonymous

    holy crap, great plugin!

    does it validate?

    Short answer: Yes it does. However, it is valid HTML 4.01 and nothing more.

    Sure you can simply change your doctype to “XHTML 1.0/1.1/whatever”, but the reality is that your browser will not render your pages any different than if it were to have a DOCTYPE of HTML 4.01. For true XHTML to be parsed, a browser must be delivered a Content-Type of application/xhtml+xml. (And no, simply putting content=”application/xhtml+xml; in your meta does not do that.)

    https://www.mozilla.org/docs/web-developer/faq.html#xhtmldiff

    The problem (well it is not really a problem a such – at least outside of XML) with this plugin is that .innerHTML is not a valid DOM attribute in XML documents. Try delivering your pages as ‘true’ XHTML and I guarantee the comment preview will not work. By ‘True XHTML’, I mean pages with not only the correct DOCTYPE, but also the correct Content-Type as delivered by the web server. (This of course only applies to browsers that actually utilise valid XML parsers – i.e. Gecko-based browsers such as mozilla/firefox/galeon/epiphany etc. Otherwise the page will be rendered as ‘tag soup’ anyway.)

    This, of course, should not take anything away from this plugin whatsoever. It is just that I see so many people aiming for XHTML complaince, when in essence all they are really delivering is ‘pretty’ HTML which doesn’t alter the actual parsing of the document in any way.

    Well, live preview still doesn’t work for me. I’m using the McStars theme. It worked for me with the Boxy-but-Gold theme. Perhaps, this live preview is not compatible with McStars?

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘Comments: Live Preview’ is closed to new replies.