Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 10-29-2007, 06:49 PM
reddyink reddyink is offline
 
Join Date: Aug 2007
Posts: 236
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Expand/Collapse button not working for rows

I have put expand/collapse code for table by following direction from vbulletin manual.

Code is working for only first row title link. when I click on second row link same first row is collapsing and expanding. Can anybody please help me on how to write code for expand/collapse for each individual row. I also want first row to be expanded by default and all other rows user can click on it to expand/collapse. Here is my code i wrote working for only first row.
-----------------------------------------------------------------------------------------
<tr><td class="thead">
<a href="#top" style="float:$stylevar[right]"
onclick="return toggle_collapse('categ')"><img
id="collapseimg_categ"
src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_categ].gif"
alt="" border="0" /></a>
<a href="$cat[caturl]">$cat[title]</a></td></tr>
<tbody id="collapseobj_categ" style="$vbcollapse[collapseobj_categ]">
<tr><td>$cat[description]</td></tr>
</tbody>
------------------------------------------------------------------------------------------
Please help me where am i missing to expand/collapse properly. I wasted 2 days already figuring out. If anybody can help me, I will really appreciate.
Thanks in advance
Reply With Quote
  #2  
Old 10-29-2007, 09:40 PM
Analogpoint's Avatar
Analogpoint Analogpoint is offline
 
Join Date: Feb 2007
Posts: 656
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Your IDs have to be different for each individual row.

Row 1 categ1
Row 2 categ2
Row 3 categ3

etc.
Reply With Quote
  #3  
Old 10-29-2007, 11:45 PM
reddyink reddyink is offline
 
Join Date: Aug 2007
Posts: 236
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your reply. The same code (title) will display all of rows from database with different $cat[title]. Then where should I change the ID. The below code is in my (module-template) in style manager and I have 1 php page calling that template I guess in the module. Can you please guide me through where I should add different ID's.

Right now with below code . Even when I click on 2nd title first title is expanding/collapsing. Do I need to create a new page for object-collapse
<tr><td class="thead">
<a href="#top" style="float:$stylevar[right]"
onclick="return toggle_collapse('categ')"><img
id="collapseimg_categ"
src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_categ].gif"
alt="" border="0" /></a>
<a href="$cat[caturl]">$cat[title]</a></td></tr>
<tbody id="collapseobj_categ" style="$vbcollapse[collapseobj_categ]">
<tr><td>$cat[description]</td></tr>
</tbody>
Please provide some suggestions.
Thanks in advance

--------------- Added [DATE]1193723154[/DATE] at [TIME]1193723154[/TIME] ---------------

I searched in forums for expand/collapse, I am understanding that we have to use array's.
since it is in same loop to get different id's on fly. I figured we have to use array element.
Can any one please provide me some example code for array collapsing to get different id's for each title when it loops through the code.
FYI- with below code only first row(title) is expanding/collapsing when we click on any 6 rows(titles)

-----------------------------------------------------------------------------------------
<thead>
<tr><td class="thead">
<a href="#top" style="float:$stylevar[right]"
onclick="return toggle_collapse('categ')"><img
id="collapseimg_categ"
src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_categ].gif"
alt="" border="0" /></a>
<a href="$cat[caturl]">$cat[title]</a></td></tr>
</thead>
<tbody id="collapseobj_categ" style="$vbcollapse[collapseobj_categ]">
<tr><td>$cat[description]..date etc..</td></tr>
</tbody>
------------------------------------------------------------------------------------------

I really appreciate any kind of help on this
Thanks
Reply With Quote
  #4  
Old 10-30-2007, 05:40 AM
Analogpoint's Avatar
Analogpoint Analogpoint is offline
 
Join Date: Feb 2007
Posts: 656
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this. It assumes you have an id column in the category table. If the field is called something else, substitute it.

Code:
<tr><td class="thead">
<a href="#top" style="float:$stylevar[right]"
onclick="return toggle_collapse('categ$cat[id]')"><img
id="collapseimg_categ$cat[id]"
src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_categ$cat[id]].gif"
alt="" border="0" /></a>
<a href="$cat[caturl]">$cat[title]</a></td></tr>
<tbody id="collapseobj_categ$cat[id]" style="$vbcollapse[collapseobj_categ$cat[id]]">
<tr><td>$cat[description]</td></tr>
</tbody>
Reply With Quote
  #5  
Old 10-30-2007, 02:03 PM
reddyink reddyink is offline
 
Join Date: Aug 2007
Posts: 236
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for reply. When I used with catid. I am getting following error Parse error: parse error,

unexpected T_VARIABLE, expecting ']' in C:\Program Files\EasyPHP 2.0b1\www\upload\includes\adminfunctions_template. php(3596) : eval()'d code on line 9

I think it is not liking 'categ$cat[id]. inside[] brackets. Do you know anything that we can fix this error.

I appreciate your help.

--------------- Added [DATE]1193761815[/DATE] at [TIME]1193761815[/TIME] ---------------

Thanks a lot for your help. Expand/collapse working now.
I took out [] for image and object section it came out with no errors.

Only thing now is all are in exapand mode. I wanted only first link to be expanded all others to be collapsed.User can select to expand. Is there a way to set like that for first row to be always expanded?


I really appreciate your help.You saved my time.
Reply With Quote
  #6  
Old 01-10-2008, 07:39 PM
siliconfinance siliconfinance is offline
 
Join Date: Mar 2007
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How did you set something to be collapsed by default?
Reply With Quote
Reply

Thread Tools
Display Modes

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:20 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.07597 seconds
  • Memory Usage 2,209KB
  • 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
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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