• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dynamic content in HTML Pages

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How the sites are displaying Dynamic content in HTML pages.
Suppose if we take index.html of rediff, each time you refresh the page it shows a different ad.

Please explain the topic in deatil.

Thanks in advance
-Prabhakar
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could be using some simple Javascript.
 
Prabhakar Rao
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for that

But I need the actual process on
-how they put space for the dynamic content.
-how they display dynamic content each time.
Will be thankful if you can provide some code demonstration.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They may not be static HTML pages either.
Most server side technologies provide a way to map url strings to dynamic content. Something like "mypage.html" could actually be pointing to a PHP page or Cold Fusion app.
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Prabhakar Rao:
How the sites are displaying Dynamic content in HTML pages.
Suppose if we take index.html of rediff, each time you refresh the page it shows a different ad.


What does "of rediff" mean?

I agree with Bear and Ben. Displaying a different ad on a page everytime the page is loaded can be accomplished on the client side with simple javascript or it can be accomplished on the server side using a server side language like php or servlets + jsp.

But I need the actual process on
-how they put space for the dynamic content.


It sounds like you might need to learn some html as well. Web browsers render html in the order it appears on the page (although that order can be altered using css). Also, you can use css to make text on a web page flow around any sized image automatically, so the size of the image would be irrelevant.

-how they display dynamic content each time.


You populate an array with different .jpg files that are ads. When the request is received, you program the jsp or servlet to generate a random integer and assign it to a variable. You use that variable as the index value of the array, e.g.

myAds[myRanNum]

and then you assign that specific .jpg file to the src attribute of an <img> tag, e.g.

out.println("<h1>My Web Page</h1>");
out.println("<img src=\"http://mysite.com/someDir/ads/" + myAds[myRanNum] + "\"/>");
out.println("<div>some text here</div>");

[ October 05, 2006: Message edited by: sven studde ]
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another way of creating dynamic html is through XML/XSLT.
You create an dynamic XML and parse it through XSLT toi generate html page.
the page will have dynamic data and its still an html page.
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you mean to change the content and add some functionality after a HTML has been rendered , then you might use javascript.Using AJAX you can even send HTTPXMLRequest to server and manupulate the response data at the client side using javascript.Is that you want ?
 
reply
    Bookmark Topic Watch Topic
  • New Topic