1 (edited by Cactuz 2003-03-31 16:52)

Topic: Live Preview 1.0 by Cactuz

##
##
##        Mod title:  Live Preview
##
##      Mod version:  1.0
##   Works on PunBB:  1.0 RC 1
##     Release date:  2003-03-29
##           Author:  Kristoffer "Cactuz" Jansson (kristoffer_ja@hotmail.com)
##
##      Description:  This mod show a live preview of your post that really
##                    saves your time.
## 
##   Affected files:  post.php
##
##       Affects DB:  No
##
##     Author notes:  I wrote this code for one of my own projects but I
##                    thought it would be nice to have in PunBB.
##
##

Download here: http://punbb.org/contrib/mods/Live_Preview-1.0.zip

Screenshot

2 (edited by Arnaud 2003-10-25 01:53)

Re: Live Preview 1.0 by Cactuz

Works fine smile

Except with the new uploaded smileys (JPEG). They don't appear sad

Re: Live Preview 1.0 by Cactuz

Edit in livepreparser.php:

        string = ReplaceString(string, ':)', '<img src="img/smilies/smile.png" border="0">');
        string = ReplaceString(string, '=)', '<img src="img/smilies/smile.png" border="0">');
        string = ReplaceString(string, ':(', '<img src="img/smilies/sad.png" border="0">');
        string = ReplaceString(string, '=(', '<img src="img/smilies/sad.png" border="0">');
        string = ReplaceString(string, ':D', '<img src="img/smilies/big_smile.png" border="0">');
        string = ReplaceString(string, '=D', '<img src="img/smilies/big_smile.png" border="0">');
        string = ReplaceString(string, ';)', '<img src="img/smilies/wink.png" border="0">');
        string = ReplaceString(string, ':x', '<img src="img/smilies/mad.png" border="0">');
        string = ReplaceString(string, ':roll:', '<img src="img/smilies/roll.png" border="0">');

I think you can figure out what to change

Re: Live Preview 1.0 by Cactuz

Thanks,

Sorry i admit i did not look at the code sad

Still i have a problem of forum freeze (see my post 84 smileys).

Perhaps the script cant handle too many smilies ?

Re: Live Preview 1.0 by Cactuz

That may be the case. I honestly don't know.

Re: Live Preview 1.0 by Cactuz

Somehow the wonderfull "Live Preview" was missing when you edit a post. So here are the instructions how to implement it

#
#---------[ 1. APPLY MOD ]-------------------------------------------------------
#

    apply "Live Preview" Mod as described in the readme.txt
    after the readme.txt, continue here


#
#---------[ 2. OPEN ]---------------------------------------------------------
#

    edit.php


#
#---------[ 3. FIND (line 172) ]----------------------------------------------
#

    require 'header.php';


#
#---------[ 4. AFTER, ADD ]---------------------------------------------------
#

    require 'livepreparser.php';


#
#---------[ 5. FIND (line 200) ]----------------------------------------------
#

            <td class="puncon2"> <textarea name="req_message" rows="20" cols="95"><?php print pun_htmlspecialchars($cur_post['message']) ?></textarea></td>


#
#---------[ 6. REPLACE WITH ]-------------------------------------------------
#

            <td class="puncon2"> <textarea name="req_message" id="req_message" rows="20" cols="95" onkeyup="livepre(this);"><?php print pun_htmlspecialchars($cur_post['message']) ?></textarea></td>

#
#---------[ 7. FIND (line 212) ]----------------------------------------------
#

            <td class="puncon1right" style="width: 140px; white-space: nowrap"><?php print $lang_common['Actions'] ?>  </td>
            <td class="puncon2"><br>  <input type="submit" name="submit" value="<?php print $lang_common['Submit'] ?>" accesskey="s">   <a href="javascript:history.go(-1)"><?php print $lang_common['Go back'] ?></a><br><br></td>
        </tr>

#
#---------[ 8. AFTER, ADD ]---------------------------------------------------
#

        <?php require 'liveprelayer.php'; ?>


#
#---------[ 9. SAVE/UPLOAD ]--------------------------------------------------
#

Cheers, Holger

7 (edited by Cactuz 2003-11-06 15:51)

Re: Live Preview 1.0 by Cactuz

Ah.. Thanks wink

8 (edited by Elijah 2004-01-03 04:02)

Re: Live Preview 1.0 by Cactuz

To make this mod work with PunBB 1.1:

1. Open:  livepreparser.php
2. Find:

} if($permissions['message_bbcode'] == '1'){

3. Replace with:

} if($pun_config['p_message_bbcode'] == '1'){

4. Find:

} if($permissions['message_img_tag'] == '1'){

5. Replace with: 

} if($pun_config['p_message_img_tag'] == '1'){

6. Find:

} if($options['smilies'] == '1'){

7. Replace with

} if($pun_config['o_smilies'] == '1'){

Edit: Oh yeah one more thing:

1. Open: liveprelayer.php
2. Find:

<td colspan="2" class="pun_con2">

3. Replace with

<td colspan="2" class="puncon2">

Upload both livepreparser.php and liveprelayer.php and this nifty Mod should be working again! wink

Elijah

Re: Live Preview 1.0 by Cactuz

Thanks smile