slobra
12-05-2010, 10:03 PM
I'm trying to reload the featured photos every X seconds inside my vBCMPS module using jQuery. I'm using this code in my "adv_portal_random_pictures" template:
<script src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
<script>
var auto_refresh = setInterval(
function()
{
$('#loaddiv').fadeOut('slow').load('reload.php').f adeIn("slow");
}, 20000);
</script>
<div id="loaddiv">
</div>
And this code in /forums/reload.php:
<?php
echo "$mods[formcode]
<div id=\"loaddiv\" style=\"padding-bottom:$vba_style[portal_vspace]px\">
<table align=\"center\" border=\"0\" cellpadding=\"$stylevar[cellpadding]\" cellspacing=\"$stylevar[cellspacing]\" class=\"tborder\" width=\"100%\">
<thead>
<tr>
<td class=\"tcat\" colspan=\"$mods[colspan]\">
<if condition=\"'$vba_style[portal_collapsemods]'\">
<a href=\"#top\" onclick=\"'return toggle_collapse(module_$mods[collapse])'\" style=\"float:$stylevar[right]\"><img alt=\"\" border=\"0\" id=\"collapseimg_module_$mods[collapse]\" src=\"$stylevar[imgdir_button]/collapse_tcat$modimgcollapse.gif\" /></a>
</if>
<span class=\"tcat\"><strong>$vba_style[portal_blockbullet] <if condition=\"'$mods[link]'\"><a href=\"$mods[link]\">$mods[title]</a><else />$mods[title]</if>:</strong> <span class=\"smallfont\"><a href=\"/forums/all_albums.php\">View More</a> | <a href=\"/forums/album.php?do=addalbum\">Create New Album</a></span></span></td>
</tr>
</thead>
<tbody id=\"collapseobj_module_$mods[collapse]\" style=\"$modcollapse\">
<if condition=\"'$show[tablerow]'\">
<tr>
<td class=\"$bgclass\">
$modulehtml
</td>
</tr>
<else />
$modulehtml
</if>
</tbody>
</table>
</div>
<if condition=\"'$mods[formcode]'\"></form></if>";
?>
I did something right because it does load the module and refreshes it every 20 seconds but it doesn't show any content in the module and when it reloads, it reloads the entire module instead of just the content inside it. Any suggestions on what I'm missing? Not much of a programmer but I enjoy trying. :D Thanks for any help!
<script src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
<script>
var auto_refresh = setInterval(
function()
{
$('#loaddiv').fadeOut('slow').load('reload.php').f adeIn("slow");
}, 20000);
</script>
<div id="loaddiv">
</div>
And this code in /forums/reload.php:
<?php
echo "$mods[formcode]
<div id=\"loaddiv\" style=\"padding-bottom:$vba_style[portal_vspace]px\">
<table align=\"center\" border=\"0\" cellpadding=\"$stylevar[cellpadding]\" cellspacing=\"$stylevar[cellspacing]\" class=\"tborder\" width=\"100%\">
<thead>
<tr>
<td class=\"tcat\" colspan=\"$mods[colspan]\">
<if condition=\"'$vba_style[portal_collapsemods]'\">
<a href=\"#top\" onclick=\"'return toggle_collapse(module_$mods[collapse])'\" style=\"float:$stylevar[right]\"><img alt=\"\" border=\"0\" id=\"collapseimg_module_$mods[collapse]\" src=\"$stylevar[imgdir_button]/collapse_tcat$modimgcollapse.gif\" /></a>
</if>
<span class=\"tcat\"><strong>$vba_style[portal_blockbullet] <if condition=\"'$mods[link]'\"><a href=\"$mods[link]\">$mods[title]</a><else />$mods[title]</if>:</strong> <span class=\"smallfont\"><a href=\"/forums/all_albums.php\">View More</a> | <a href=\"/forums/album.php?do=addalbum\">Create New Album</a></span></span></td>
</tr>
</thead>
<tbody id=\"collapseobj_module_$mods[collapse]\" style=\"$modcollapse\">
<if condition=\"'$show[tablerow]'\">
<tr>
<td class=\"$bgclass\">
$modulehtml
</td>
</tr>
<else />
$modulehtml
</if>
</tbody>
</table>
</div>
<if condition=\"'$mods[formcode]'\"></form></if>";
?>
I did something right because it does load the module and refreshes it every 20 seconds but it doesn't show any content in the module and when it reloads, it reloads the entire module instead of just the content inside it. Any suggestions on what I'm missing? Not much of a programmer but I enjoy trying. :D Thanks for any help!