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 04-05-2009, 12:02 PM
Powlo Powlo is offline
 
Join Date: Feb 2008
Location: Sunderland UK
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Java Problem

I am trying to create an extra info click point on each thread within the threadbit using javascript.

So under every thread title there will be a clickable 'Extra Info'

ie.

The Title of my Thread
Extra Info

The extra info is called from another template, the code i am using does work but only for the first thread.

How can i get this to work with all threads?

PHP Code:
 <script language="JavaScript">  

     function 
expand(param)  
     {  
         
param.style.display=(param.style.display=="none")?"":"none";  
     }  

 </
script>  

<
a href="javascript:expand(document.getElementById('div1'))">Extra Info</a>  
       <
div class="dottedBorders" id="div1" width="300px" style="display:none">  
                     <
span class="normal">$extrainfo</span

</
div
Any ideas?
Reply With Quote
  #2  
Old 04-05-2009, 02:57 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What does your threadbit code look like? You probably need a unique id for each thread and it doesn't look like you have one in the code posted.

BTW, java is NOT javascript. They are two very different languages. You are posting javascript, not java.
Reply With Quote
  #3  
Old 04-05-2009, 03:11 PM
Powlo Powlo is offline
 
Join Date: Feb 2008
Location: Sunderland UK
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just aswell you knew what i meant

HTML Code:
<script language="JavaScript">  

     function expand(param)  
     {  
         param.style.display=(param.style.display=="none")?"":"none";  
     }  

 </script>  


<tr>
	<td class="$bgclass" id="td_threadstatusicon_$thread[realthreadid]">
		$thread[openclose_editable]
		<img src="$stylevar[imgdir_statusicon]/thread$thread[statusicon].gif" id="thread_statusicon_$thread[realthreadid]" alt="<if condition="$show['threadcount']"><phrase 1="$thread[dot_count]" 2="$thread[dot_lastpost]">$vbphrase[have_x_posts_in_thread_last_y]</phrase></if>" border="" />	</td>

	<td valign="middle" class="$bgclass" id="td_threadtitle_$thread[realthreadid]" title="$thread[preview]">

		$thread[title_editable]
	  <div>
			<h3 style="margin-bottom: 0px; margin-top: 0px;">
					
			
			

			<a href="showthread.php?$session[sessionurl]t=$thread[threadid]$thread[highlight]" id="thread_title_$thread[realthreadid]"<if condition="$show['gotonewpost']"> style="font-weight:bold"</if>
			>$thread[threadtitle]</a>
<!--

            <br /><a href="javascript:expand(document.getElementById('div1'))">Extra Info</a>  
            <div class="dottedBorders" id="div1" width="300px" style="display:none">  
                     <span class="normal">$extrainfo </span> 

</div>  


-->   
            <if condition="$thread['pagenav']">$stylevar[dirmark]<span class="smallfont" style="white-space:nowrap">(<img class="inlineimg" src="$stylevar[imgdir_misc]/multipage.gif" alt="$vbphrase[multipage_thread]" border="0" /> $thread[pagenav]<if condition="$show[pagenavmore]"> ... <a href="showthread.php?$session[sessionurl]t=$thread[threadid]&amp;page=$thread[totalpages]$thread[highlight]">$vbphrase[last_page]</a></if>)</span></if></h3>
	  </div>
		
		
		

		
	<if condition="$show['unsubscribe']">
			<div class="smallfont">
				<a href="newreply.php?$session[sessionurl]do=newreply&amp;t=$thread[threadid]" rel="nofollow">$vbphrase[reply]</a> |
				<a href="subscription.php?$session[sessionurl]do=removesubscription&amp;return=ucp&amp;t=$thread[threadid]" rel="nofollow">$vbphrase[unsubscribe]</a>			</div><br />
	  </if>
    <if condition="$show['inlinemod']">
  <td class="<if condition="$show['forumlink']">alt2<else />alt1</if>">
			<input type="checkbox" name="tlist[$thread[realthreadid]]" id="tlist_$thread[realthreadid]" value="$thread[checkbox_value]" <if condition="$show['disabled']">disabled="disabled"</if> />
		</td>
	</if>
</tr>
Hope that helps.
Reply With Quote
  #4  
Old 04-05-2009, 03:33 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Again, you aren't passing a unique variable. These needs to be unique (ids MUST be unique):
HTML Code:
expand(document.getElementById('div1'))
...
id="div1"
but you have it the same for every thread.

(Someone else should actual help with this as I am no javascript expert at all.)
Reply With Quote
  #5  
Old 04-06-2009, 12:29 PM
Mr-Moo Mr-Moo is offline
 
Join Date: Sep 2007
Location: Chicago, IL.
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You are having the same issue I ran into when I was echoing out mootools dropdown menus for refbacks

Lynne hit the nail on the head, you MUST have unique IDs. So you need to set things up in an array, then to echo out the ID. So you want it to increase by one number or so fourth.

If you Google it you will find tons of documents and whatnot on how to customize your javascript and add the PHP.
Reply With Quote
  #6  
Old 04-06-2009, 01:33 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The thread id is unique. So, if you could incorporate that into the id, then you will have a unique id.
Reply With Quote
  #7  
Old 04-06-2009, 02:53 PM
Powlo Powlo is offline
 
Join Date: Feb 2008
Location: Sunderland UK
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did it earlier today, just by trial and error. i just replaced div1 with $thread[threadid] and guess what,.. it worked!

Dont know if there is a better way of doing what im doing but hey it works.
Reply With Quote
  #8  
Old 04-08-2009, 03:33 PM
Powlo Powlo is offline
 
Join Date: Feb 2008
Location: Sunderland UK
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, now that i have that sorted is there a way of closing one box when another opens?
Reply With Quote
  #9  
Old 04-08-2009, 05:10 PM
Mr-Moo Mr-Moo is offline
 
Join Date: Sep 2007
Location: Chicago, IL.
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try reviewing :
http://www.infoentropy.com/mochikit_...ck_outside_box
Reply With Quote
  #10  
Old 04-08-2009, 08:35 PM
Powlo Powlo is offline
 
Join Date: Feb 2008
Location: Sunderland UK
Posts: 155
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, i'll take a look but i shouldnt have used the word 'box' as it doesnt open a box it just reveals what has been hidden. I still may get some pointers though.
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 01:40 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.04907 seconds
  • Memory Usage 2,270KB
  • 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_html
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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