I have some ad code in a smarty .tpl file that I want to refresh every 10 seconds so it will load a new ad. My ads are getting plenty of views but I want people to multilple ads in one page view instead of when the whole page is refreshed.

<div id="ads_refresh">
{if $ads->ad_top != ""}
</div>

All the code I have browsed on the web want to load an external file into a div instead of just refreshing the div with the content already in it. This is an urgent matter and would like some help ASAP. As always I appreciate the knowledge I receive. Thanks.

That will not work in my case. The SMARTY template loads the ads in at run time through a database query and then the core of the application that I am not to familiar with, then keeps track of what ads to display and tracks clicks. The ad is changed everytime the page is refreshed.

I thought there was a way AJAX could refresh a single element on a page without having to actually load physical data in such as file.

an Ajax refesh is exactly NOT what you described
Ajax polls the server and relads the returned data file into the the same position, but it is a file transfer, there is no magic appearing data, it has to come from somewhere

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.