Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-05-2010, 10:03 PM
slobra slobra is offline
 
Join Date: Jul 2008
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Use jQuery to reload vBCMPS featured photos

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:

Code:
<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').fadeIn("slow");
}, 20000);
</script>

<div id="loaddiv"> 
</div>

And this code in /forums/reload.php:

Code:
<?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. Thanks for any help!
Reply With Quote
  #2  
Old 12-05-2010, 10:33 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know if this is the problem or not, but it looks like you've used template conditionals in your html in reload.php (unless maybe you've just included the template code to simplify the example).
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:33 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05245 seconds
  • Memory Usage 2,171KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete