MOD Description: This MOD modifies the posting page, so it allows asynchronous updates of the preview box by using javascript and a hidden IFrame. It also adds the ability to dynamically preview the user signature in the user profile and the manage user in ACP pages.
MOD Version: 1.0.2
I have abandoned further development of this MOD. If you wish to take it over, please me a PM. Thanks
MOD Download: async_dynamic_post_and_signature_preview_v1.0.2.zip
No need to register. If link fails, please use right click and save as.

Demo Board:
Posting preview:
http://www.phpmix.com/phpBB2/posting.ph ... topic&f=37
Please, use the demo only to test the preview button. Please, do not submit the post. This is a hidden forum where no one is allowed to view/read.
Thanks

Signature preview:
http://www.phpmix.com/phpBB2/viewtopic.php?p=2252#2252
No need to register. The demo is in the post itself.
MOD Header:
Code: Select all
##############################################################
## MOD Title: Async & Dynamic Post/Signature Preview
## MOD Author: markus_petrux < nospam@phpmix.com > (Markus) http://www.phpmix.com
## MOD Description: This MOD modifies the posting page, so it allows asynchronous updates of the preview box
## by using javascript and a hidden IFrame. It also adds the ability to dynamically preview
## the user signature in the user profile and the manage user in ACP pages.
## MOD Version: 1.0.2
##
## Installation Level: (Easy)
## Installation Time: 5 Minutes
## Files To Edit: 3
## templates/subSilver/posting_body.tpl
## templates/subSilver/profile_add_body.tpl
## templates/subSilver/admin/user_edit_body.tpl
## Included Files: 2
## dynpreview.php
## templates/dynpreview.js
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## - How does the Post Preview work?
##
## Instead of a whole page refresh, it uses javascript to perform a request to a server-side
## script through a hidden IFrame. BBCodes et all are parsed on the server and the HTML
## representation of the message (note it does not send a whole HTML, but just the required
## HTML code) is sent back to the hidden IFrame. When the onload event of this IFrame is fired,
## the content of the preview box (a DIV element, aka layer) is dynamically updated.
## When no reliable support is detected, it degrades gracefully, so the conventional method of
## sending the post form to update the preview box is used.
##
## - How does the Signature Preview work?
##
## A signature preview layer is dynamically updated whenever a change is detected. To avoid too
## many update requests, the script waits until the signature remains unchanged for more than one
## second, at which time the request to the server-side script is automatically launched (without
## user intervention) and the parsed signature is displayed as soon as the server response comes.
##
## - Known Issues/Caveats:
##
## AFAIK, once an HTML page is completely loaded there is no reliable way to dynamically inject
## javascript to a layer (the preview box). If for whatever reason javascript was present in the
## stream received from the server, it would be executed in the hidden IFrame itself, generating
## errors or (at worst) unexpected results.
## For this reason, if javascript has to be sent as part of the message, the server-side script
## generates a full HTML page (with no menus, using same method used for the phpBB popups such
## as the more emoticons or the search user windows) and the preview box will be directly shown
## using the hidden IFrame (which becomes visible) instead of updating the layer.
## Note javascript might be added to the message by some BBCodes such as the Hide BBCode, the
## Select/Expand BBCodes, the HTML BBCode, etc.
##
## - MOD related comments:
##
## 1) This MOD has been tested with phpBB 2.0.16.
## 2) This MOD is EasyMOD friendly. Highly recommended.
##
##############################################################
## MOD History:
##
## 2005/07/21 - 1.0.2
## - Added the ability to dynamically show signature when editing user profile.
##
## 2005/07/19 - 1.0.0
## - Initial release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
~~~~~~~~~~ Original Post ~~~~~~~~~~
Hi!
I wanted to make an experiment to compare AJAX with DHTML capabilities. It all started here:
http://area51.phpbb.com/phpBB/viewtopic ... 889#122889
The idea here is to compare DHTML with one of the features of wGEric's AJAXed MOD, the "Inline post and subject editing when viewing a topic". If it worths (and this is why I posted this topic in this forum) I might continue working on it to fix bugs and submit to the MODs database.
If anyone wants to try it, here's how to. It only involves 2 steps (modify posting_body.tpl and upload a new script to the phpBB folder).
- OPEN: templates/subSilver/posting_body.tpl
FIND (this is a partial match):BEFORE ADD:Code: Select all
<form
Code: Select all
// // Code removed from this post //
- Create a file named dynpreview.php and upload to the phpBB folder with the following contents:
Code: Select all
// // Code removed from this post //