WordPress.org

Ready to get started?Download WordPress

Forums

Comments: Live Preview (25 posts)

  1. Stevarino
    Member
    Posted 10 years ago #

    Pretty cool. I never knew about the innerHTML method in javascript before...

  2. TechGnome
    Moderator
    Posted 10 years ago #

    Before everyone jumps all over this, I just tried it at Jesuit's site, and it didn't seem to work. Running FF 0.8 here. As I was reading this, I was wondering about if innerHTML was an IE thing....looks like it is...
    TG

  3. Chris J. Davis
    Member
    Posted 10 years ago #

    No, its not. I wrote it using FF 0.8 as a test browser and I wrote a response to you (TechGnome) on my site using Safari and it worked just fine. Not sure what your issue is.
    And I responded again using FF 0.8 for Panther and it was fine as well. Don't know what to tell you.
    Anyone else who would like to try this, go to this post:
    http://chrisjdavis.org/index/2004/03/15/live-preview-for-comments/463/
    and test it out, and then leave me a comment there or here to let me know if there is something screwy going on.
    Thanks.
    Jesuit

  4. chuckg
    Member
    Posted 10 years ago #

    Works great in Opera 7.22 --- good work!

  5. OperaManiac
    Member
    Posted 10 years ago #

    oooh.. opera!!! i would have to try it now...
    does it validate?

  6. Chris J. Davis
    Member
    Posted 10 years ago #

    It does now, I had forgotten that XHTML didn't have the language attribute. If you are already running this just delete the language="javascript" and it will validate.
    And thanks everyone for checking it out and letting me know if it worked or not.
    Jesuit

  7. TechGnome
    Moderator
    Posted 10 years ago #

    Honest! I swear! It wasn't working, but now it is. The only thing I can think of was that I had the first comment.... ?????
    I sit corrected. Looks greast too!
    TG

  8. Chris J. Davis
    Member
    Posted 10 years ago #

    TechGnome: not a problem brother, I was starting to freak out before other people reported that they could use it!
    I just hope people can get some use out of it. I certainly love it.

  9. dariottolo
    Member
    Posted 10 years ago #

    Hi Jesuit,
    I tried to use your plugin in WordPress 1.2, but could not make it work properly.
    I saved the file in the plugin directory, and activated it.
    But what should I change in wp-comments.php, in order to have the preview?
    Plus, the wp-preview.phps available in http://chrisjdavis.org/hacks/wp-preview.phps does not end in ?>. Is it ok anyway?
    Any help would be greatly appreciated.

  10. tontamoo
    Member
    Posted 10 years ago #

    Are there any plans to update hack for WP 1.2?

  11. seriocomic
    Member
    Posted 10 years ago #

    I found that this version .65 RC1 doesn't work as a plugin for 1.2, but does work if you cut and paste the functions into your my-hacks file and call the functions as instructed.
    I look forward to this being developed as a plugin, but because it doesn't rely on any hook or action I dunno how it will.

  12. khaled
    Member
    Posted 10 years ago #

    Sorry seriocomic could you elaborate a bit on your post. I'm trying to get this to work but I think my serious lack of php skills at the moment might be the cause, does this hack work with 1.2 or not? Is my-hacks another plugin that you can put all the functions into and then call them from there?
    Also is it possible to elaborate on one thing specifically that has eluded me completely. I don't understand where I should be putting the onkeyup function. The documentation says that it should be included in the two following files, but
    a) I'm not sure which ones
    b) more importantly I don't know where and how.
    Any elaboration would be brilliant.

  13. Anonymous
    Unregistered
    Posted 10 years ago #

    It's not working for me. What am I doing wrong? I activated the plugin. Then I made these 3 changes to the wp-comments.php file (with their following lines included for reference):
    1.

    <?php commentScript() ?>
    <form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

    2.

    <h2 id="comments" onkeyup="ReloadTextDiv();" ><?php comments_number(__("Comments"), __("1 Comment"), __("% Comments")); ?>
    <?php if ('open' == $post->comment_status) { ?>

    3.

    <?php comments_Div() ?>
    <?php } else { // comments are closed ?>

  14. pezastic
    Member
    Posted 10 years ago #

    Great! I got it working. I changed number 2 to:

    <textarea name="comment" id="comment" onkeyup="ReloadTextDiv();" cols="35" rows="4" tabindex="4"></textarea>


    Thanks for the help.

  15. davidprince
    Member
    Posted 10 years ago #

    I am having huge problems with this. Everything seems to work (ie the previewing) until I try to submit a comment or even login to wp-login.php. Then I get a whole bunch of Warning: Cannot modify header information - headers already sent by (output started at ..../liveupdate.php:43) in ......
    I really have no idea what is going but I have disabled the plugin by changing its name back to .phps and everything is back to normal.. Except I really like this plugin and want to use it.
    Any suggestions?

  16. davidprince
    Member
    Posted 10 years ago #

    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?

  17. davidprince
    Member
    Posted 10 years ago #

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

  18. tgrisier
    Member
    Posted 10 years ago #

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

  19. Anonymous
    Unregistered
    Posted 10 years ago #

    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;
    }

  20. tgrisier
    Member
    Posted 10 years ago #

    Thanks a million Anon.

  21. andystreich
    Member
    Posted 10 years ago #

    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.

  22. Anonymous
    Unregistered
    Posted 10 years ago #

    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.

  23. Anonymous
    Unregistered
    Posted 9 years ago #

    holy crap, great plugin!

  24. Movabletripe
    Member
    Posted 9 years ago #

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

    http://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.

  25. renjer
    Member
    Posted 8 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic