Daily Journal « Kevin Pajak – Interactive Web Developer/Designer – BLOG

Archive for the ‘Daily Journal’ Category

Customized WordPress theme for DailyWebGeek.com

Friday, February 5th, 2010

Going to begin work soon on an original, fully customized WordPress theme for DailyWebGeek.com. More details to follow.

Live chat client showing list of current users online

Wednesday, February 3rd, 2010

OK, so I’ve nearly got this puppy complete. It’s a live-chat client that will allow logged-on users (and only logged-on users, although I also have a version that guests can use) to make “posts” (just like to a “wall” on Facebook or Twitter), with the chat/comments page automatically refreshing every 500 milliseconds to show latest posts that other users have just made, in real-time. (one tentative name I have for it is a “living wall”). Last night, I added the ability to show a list of all users who are currently logged on, and hope to have this out of beta soon ;)

These are just some of the advantages of this application:

- All posts can be saved into a database (into any table you so choose. You could, for example, insert the posts on tables related to individual topics or categories, current news items, a photo, or basically anything else you can put on an individual web page. [so to use this interactive chat client on a different page, just insert the posts into a different database table]).

- This can provide your web site users with a cross-functional, enhanced web user experience, allowing them to see who else in your online community or company is currently logged on, chat with them, comment on various pages across the site, view/update profile information, other content etc [sounds a little like Facebook, MySpace, or similar online communities doesn’t it, only think of the advantages of having this on your own site ‘).

- Flexibility. If you like, you can either destroy or save records of “chat sessions” (or series of wallposts too, if you’d like to use the app in that way).

More soon! :-) .

Clearing contents of $_POST array values (to avoid re-submitting form data upon page refresh)

Tuesday, February 2nd, 2010

After trying SEVERAL different possible methods & suggestions, I finally was able to achieve this by pointing my form’s PHP processing page to another page, rather than the same page itself (I really wanted to keep everything – form as well as form-handling all on the same page, but I found that I had to do this in order to prevent the user from re-submitting form data [through the contents of the $_POST array] that does not clear upon a user’s hitting the refresh button on the browser). And following that, I had my form’s processing page script then re-direct back to the original page where the form was located:

// redirect to the same page without the POST data
header(“Location: original-page-with-form.php”);
die;

Here are some of the pages I consulted in my research:

http://www.thefutureoftheweb.com/blog/get-redirect-after-post
http://www.issociate.de/board/post/171234/Clear_POST_variables_on_page_refresh.html
http://www.mail-archive.com/php-list@yahoogroups.com/msg04635.html
http://qaix.com/php-web-programming/437-896-clear-post-variables-read.shtml

*NOTE: Of course, keep in mind that any header(“Location: PAGE”); PHP code must be included BEFORE any contents are outputted on the page, otherwise you will get the lovely “Headers already sent” PHP error.

Hope this can help anyone else out there who may be struggling with the same issue :)

jQuery / Ajax live refresh

Saturday, January 30th, 2010

Running live, simultaneous beta tests using three different browsers for my wallpost app, with added jQuery/Ajax page refresh functionality. It is kicking some SERIOUS ass already (think: live chat possibilities, with saved record of all dialogues, that can be added to any page, threaded to any topic, etc) Yeah! ;) .

[Already, I’d like to thank programmer Srinivas Tamada for this rockin’ code!

And additionally, very special thanks to Maruf for helping resolve an annoying IE issue:

After I modified the code, the stupid forced-caching issue of IE (which was delaying or not showing the updated list of all the latest posts) managed to get resolved. Here’s my modified code of the function:

<script>

var refreshId = setInterval(function() {
$("#page_refresh").load(‘show-comments.php?v=’+ Math.random());
}, 500);

</script>

“Twitter emulator” progress

Saturday, January 30th, 2010

OK, so now I’ve got my “Twitter emulator” working (complete post-to-wall, saving all posts into a database), now with post authors listed according to logged-on username [i.e. wall posting for logged on users only]. Almost out of beta, few final tests to go :-) .