General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 14th, 2002, 03:48 PM
Frederic Boije Frederic Boije is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Malmö - Sweden
Posts: 19 Frederic Boije User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Post Refresh parts of a page

I'm building an auction site based on PHP, Javascript, MySQL and I have one question: how do you refresh parts of a page as smooth as possible? I don't want to use another frameset apart from the one that I already use.

My situation is this: I want to check in the DB if a new bid is placed by another user, if so - update the page content, but only parts of the page, since the page also contains a large picture.

And ofcourse - only update the page when changes are made (example: another bidder makes a bid...). Do you understand??? I hope you do....

Please give me input - desperatly need it.

Reply With Quote
  #2  
Old September 14th, 2002, 07:32 PM
Lindset Lindset is offline
weirdomoderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Alta, Norway
Posts: 370 Lindset User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 16
Send a message via ICQ to Lindset Send a message via AIM to Lindset
You could use iframes for that.. but since php is parsed each time a page is requested, it would be hard making it refresh only when a bid is made..
__________________
Best Regards,
Håvard Lindset

Reply With Quote
  #3  
Old September 14th, 2002, 08:40 PM
Frederic Boije Frederic Boije is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Malmö - Sweden
Posts: 19 Frederic Boije User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK, that is a start.

The reason I do not want to refresh too often is that I have a pull-down menu with bidlevels.

If it gets refreshed all the time, the user will get irritated.

Any suggestions on a work-around?

Reply With Quote
  #4  
Old September 14th, 2002, 11:31 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
dynamic flash? you could use it to check the database for a set interval, then if it changes, refresh the frameset

Reply With Quote
  #5  
Old September 15th, 2002, 04:13 AM
Frederic Boije Frederic Boije is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Malmö - Sweden
Posts: 19 Frederic Boije User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Flash? Yes, why not? I have little experience of flash though...

Here is a thought: how about using a hidden frame in a frameset that scrolls through the DB for changes, refreshes by interval and posts the new data into the main window if new values occur?

Could that be a soloution?

Reply With Quote
  #6  
Old September 15th, 2002, 01:12 PM
Frederic Boije Frederic Boije is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Malmö - Sweden
Posts: 19 Frederic Boije User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
It worked!!

Thanks for all support. You guys are fast and furious. The use of a hidden frame that contains all the dirty scroll to the MySQL went along smoothly. When i discover a change, I update the target frame with javascript.


Thanks Ben & Lidset - My Heroes

Reply With Quote
  #7  
Old September 15th, 2002, 11:02 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
ahhh shucks thx

Reply With Quote
  #8  
Old September 17th, 2002, 03:03 PM
water water is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 10 water User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally posted by Frederic Boije
The use of a hidden frame that contains all the dirty scroll to the MySQL went along smoothly. When i discover a change, I update the target frame with javascript.


i'm also working on something where i need this kind of functionality, do you mind showing us your code?

:water

Reply With Quote
  #9  
Old September 18th, 2002, 04:46 PM
Frederic Boije Frederic Boije is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Malmö - Sweden
Posts: 19 Frederic Boije User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK. I'll show you how I have done it. Maybe it can be done in a better way. Let me just tip you to read this article, that I am reading right now:

http://developer.apple.com/internet...ipt/iframe.html

It's about remote scripting with iframe. I think it can help alot of people out there. Enough talk, here comes the script:


This is the main file that calls the the hidden frame. It loads the file containing the database scroll, and unloads it when finished.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<LINK REL=StyleSheet HREF="<? echo $styledir ?>stylesheet.css" TYPE="text/css" TITLE="Stylesheet">
<SCRIPT LANGUAGE='JAVASCRIPT'>
function Updatenadaframe() {
parent.nadaright.location.href='<? echo $auctiondir ?>getdetail.php?lang=<?echo $lang ?>&obj=<?echo $obj?>&orgval=<?echo $orgval?>';
}

function Backnadaframe() {
parent.nadaright.location.href='<? echo $framesetdir ?>nada.php';
}
// -->
</SCRIPT>
</HEAD>

<BODY onLoad="Updatenadaframe();" onUnload="Backnadaframe();">



This is the content of the file "getdetail.php" that is loaded into the hidden frame that checks the DB for changes. The page is refreshed every 10 second and is passing parameters to itself.


selectDB();

$query = mysql_query("SELECT BiddingPrice, RegUserID, UNIX_TIMESTAMP(Biddingtime) FROM Bidding WHERE ArtObjectID=".$obj." ORDER BY BiddingTime")

or die("Problems with Query - checkbidchange");

mysql_close();

$newval = mysql_num_rows($query);

if ($newval <> $orgval) { // Is there any change in DB?

$update = 1;

$orgval = $newval;

}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=refresh CONTENT="10;URL=getdetail.php?<? echo "obj=".$obj."&orgval=".$orgval."&lang=".$lang ?>">

<?php

print "\n<SCRIPT LANGUAGE='JAVASCRIPT'>";

print "\n\nfunction updatedetail() {";

print "\nalert('"Changes are made in the database. Reloading page!"')";
print "\nparent.content.location.href='".$framesetdir."detail.php?lang=".$lang."&obj=".$obj."&pageid=".$pageid."';";

print "\n}";

print "\n</SCRIPT>";

?>

</HEAD>

<?php

if ($update == 1) {

print "\n<BODY onLoad=\"updatedetail()\">";

} else {

print "<BODY>";

}

print "</BODY>";

print "</HTML>";

I hope it makes some sense to you!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Refresh parts of a page


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap