PDA

View Full Version : Collapsible modules



Richard
05-27-2004, 03:56 AM
I have modified all of the templates/files to allow all current modules to be collapsible using vBulletin's built-in functions.

the attached .zip file includes all of the vba_cmps files already modified, just extract them and replace the existing files with these (unless you have made any modifications to the existing files, in which case, you just need to compare these files with yours and make the necessary changes).

The file modified_templates.txt includes all of the modified templates (just copy and paste over the existing templates, unless you have already modified the existing templates, in which case, you just need to compare these templates with yours and make the necessary changes)

the file changes_to_functions_calendar_php.txt includes the changes made to the functions_calendar.php file.


I also had to modify 2 phrases so that the collapse image would fit better:

latest_ forum_ topics

changed from: Latest Forum Topics
to: Latest Threads

x_stats

changed from: {1} Statistics
to: {1} Stats

I updated the .zip file for VBA CMPS v1.0.0 (Gold)

cLord
05-27-2004, 07:26 AM
This is awesome and in my opinion should be included in the final release!

Richard, I was going to try and create this next week! Can you read minds? LOL :)

Thank you Sir,
cLord :)

*EDIT*
converted my PayPal and Arcade News module...
If interested to see how it works: http://www.whoox.com

Our Sponsors
 

Hialls
05-27-2004, 03:11 PM
How would i add this to other modules? I've tried however the information is not saved after the page has been refreshed

Richard
05-27-2004, 05:45 PM
take a look here:

http://www.vbadvanced.com/forum/showpost.php?p=5059&postcount=8

the part where these variables are added to the .php file just before where the template is fetched:

$collapseobj_custom_1 = $vbcollapse['collapseobj_custom_1'];
$collapseimg_custom_1 = $vbcollapse['collapseimg_custom_1'];

the variable names will probably be different, but this should give you an idea how to do it. What module are you trying to add this to?

Our Sponsors
 

Hialls
05-27-2004, 07:08 PM
Im trying to add a custom module as well as the weather module, cheers though ill try that out

Lurk
05-28-2004, 10:56 AM
WOW
woohoo!!
i'm happy someone posted something like this

Richard
06-04-2004, 09:29 AM
The files in the .zip file have been updated for VBA CMPS v1.0.0 (Gold)

ashly
06-04-2004, 11:35 AM
Here a .zip file with 12 custom modules pre made by my for ppl that want to have those .php files fast.

bitg
06-22-2004, 06:16 PM
Can somebody please tell me how to make the articles cmps module a collapsable one?

58sniper
06-26-2004, 04:15 PM
I don't think tbody and thead are valid in XHTML. Also, there is some redundant/unneeded code.

I started noodling around and came up with this:


<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<tr>
<td class="tcat smallfont" style="font-weight: bold;"><a style="float: $stylevar[right]" href="#" onclick="return toggle_collapse('forumhome_test');"><img src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_forumhome_randomtopic].gif" width="13" height="12" border="0" alt="Collapse/Expand" /></a>$vba_options[portal_blockbullet] <a href="#">Test block</a></td>
</tr>
<tr id="collapseobj_forumhome_test" style="$vbcollapse[collapseobj_forumhome_randomtopic]">
<td class="alt1">
<!-- content goes here -->
</td>
</tr>
</table>
<br />

The items in red need to be changed for each module, and BOTH instances need to be the same. I typically just use the module name.

The dimensions in green are for the particular image that I use at http://www.efhs84.com/ - update to meet your needs.

Change the title and surrounding link accordingly.

I'm still cleaning up some of the style I'm using, but this SHOULD validate properly for XHTML 1.0 Transitional.

HellRazor
07-01-2004, 02:42 AM
Anyone know how to make the above example default to a "collapsed" positon rather than an "expanded" position?

Jason McConnell
07-05-2004, 04:23 AM
I also had to modify 2 phrases so that the collapse image would fit better:

latest_ forum_ topics

changed from: Latest Forum Topics
to: Latest Threads

x_stats

changed from: {1} Statistics
to: {1} Stats




I got everything going except for the x_stats part.. I couldn't find it in the phrase manager. Is this something I have to add?

Richard
07-05-2004, 09:36 AM
This either changed in vbAdvanced CMPS or in vBulletin, but yes, looks like you need to add it now instead of changing the existing one. It doesn't seem to exist anymore.

Richard
07-05-2004, 09:42 AM
I don't think tbody and thead are valid in XHTML.
http://www.w3schools.com/xhtml/attr_thead.asp

Jason McConnell
07-05-2004, 04:58 PM
OK I have the phrase x_stats in the vBCMPS section of my phrase manager... should it be global?

minichip
07-05-2004, 06:15 PM
Hi,

I guess the modules Richard took where a few day old. just replace the "$vbphrase[x_stats]" in the "adv_portal_stats" template with "$vbphrase[x_statistics]" and everything will work again

Cheers,
Holger

Jason McConnell
07-05-2004, 07:54 PM
Thanks!! Works beautifully :)

HellRazor
07-06-2004, 12:14 AM
Anyone know how to make the above example default to a "collapsed" positon rather than an "expanded" position?

*Bump* Anyone?

Polo
07-07-2004, 11:49 AM
*Bump* Anyone?

i have no clue, i hope someone can answer this question since i'm interested...

Richard
07-07-2004, 08:23 PM
here is an example:

http://www.vbulletin.com/forum/showthread.php?t=109210&highlight=collapse+default

So, you'd need to edit the template for the item you want to be collapsed by default and set the style to display:none;

Polo
07-08-2004, 08:57 AM
oh thanks, that was useful...

Polo
07-08-2004, 03:35 PM
are the Collapsible modules cached?

58sniper
07-08-2004, 05:56 PM
Caching likely wouldn't be any different than for the non-collapsed modules. Server side processing (if any) would still occur. Only the browsers behavior is different. And, depending on the browser, that info may/may not be downloaded until the module is 'expanded'.

Polo
07-08-2004, 06:18 PM
oh ok, i understand.

07-15-2004, 09:56 AM
Nice mod. Thanks

thejaxx
10-28-2004, 12:30 AM
Nice. Thanks.

Only one question here.

I did figure out how to do other custom modules, but what about modules that only call on a template?

If I understood correctly, there were modifications in both the php and the template to get them to collapse.

So how would I do one that doesn't call on a file?

hani
10-30-2004, 02:09 AM
Hi People
Thanx a lot for all this info, but I have a question related to this:

Can I have the block title as the collapsible/expandable starter rather than an image? so when you click the title, it will go to the other state (if collapsed it wil expand and vica versa)

Regards

Hani

stitch
11-01-2004, 06:10 PM
Nice. Thanks.

Only one question here.

I did figure out how to do other custom modules, but what about modules that only call on a template?

If I understood correctly, there were modifications in both the php and the template to get them to collapse.

So how would I do one that doesn't call on a file?


Thejaxx,

The collapsible is based on template. I don't think it is depended on the php files

Nautiqeman
11-30-2004, 10:42 PM
The only problem I have had is for the Stats module. I made the change from {1} Statistics to {1} stats.... yet nothing shows there.

http://ucwaterski.cheaphack.com

I reverted back until I can figure out the problem. Could it be that the title is too long?

Thanks

RsX
12-14-2004, 07:33 PM
Nice. Thanks.

Only one question here.

I did figure out how to do other custom modules, but what about modules that only call on a template?

If I understood correctly, there were modifications in both the php and the template to get them to collapse.

So how would I do one that doesn't call on a file?

Exactly. I have that problem too. The buddy list doesnt cach because it doesnt have a php file. What should be changed in the template for it to be cached?


<!-- Buddy List -->
<if condition="$bbuserinfo['userid'] AND $bbuserinfo['buddylist']">
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<thead>
<tr>
<td class="tcat">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('buddy')"><img id="collapseimg_buddy" src="$stylevar[imgdir_button]/collapse_tcat$collapseimg_buddy.gif" alt="" border="0" /></a>
<span class="smallfont"><strong>$vba_options[portal_blockbullet] <a href="$vboptions[bburl]/profile.php?$session[sessionurl]do=editlist">$vbphrase[online_buddies]</a></strong></span>
</td>
</tr>
</thead>
<tbody id="collapseobj_buddy" style="$collapseobj_buddy">
<tr>
<td class="$getbgrow" width="100%">
$onlineusers
</td>
</tr>
</tbody>
</table>
<br />
</if>
<!-- End Buddy List -->

RsX
12-14-2004, 07:58 PM
Oh and another question - Is there a way to add "Expand All" & "Collapse All" links? like in the admincp?

Richard
12-14-2004, 08:49 PM
Nice. Thanks.

Only one question here.

I did figure out how to do other custom modules, but what about modules that only call on a template?

If I understood correctly, there were modifications in both the php and the template to get them to collapse.

So how would I do one that doesn't call on a file?
You should be able to just create a file for the module that uses a template only, and include just the code necessary to save the state. I think I have done this before, I'll have to check.

Richard
12-14-2004, 08:51 PM
The only problem I have had is for the Stats module. I made the change from {1} Statistics to {1} stats.... yet nothing shows there.

http://ucwaterski.cheaphack.com

I reverted back until I can figure out the problem. Could it be that the title is too long?

Thanks
It could be a change that might have happened between vbulletin versions, I'll take a look at it.

Richard
12-14-2004, 08:52 PM
Oh and another question - Is there a way to add "Expand All" & "Collapse All" links? like in the admincp?
This just uses the builtin function from vBulletin, so you might check to see if that functionality is availabe to Expand/Collapse All Categories on the main page. If it is, just use the same method used for that.

Richard
12-14-2004, 08:55 PM
Exactly. I have that problem too. The buddy list doesnt cach because it doesnt have a php file. What should be changed in the template for it to be cached?

I'm pretty sure that the Buddylist code is included within the onlineusers.php file:

yep, right here:

if ($showbuddies)
{
if (!$numberbuddy)
{
$onlineusers = construct_phrase($vbphrase['no_x_online'], $vbphrase['buddies']);
}
$collapseobj_buddy = $vbcollapse['collapseobj_buddy'];
$collapseimg_buddy = $vbcollapse['collapseimg_buddy'];

eval('$home[$buddyid][\'content\'] = "' . fetch_template('adv_portal_buddylist') . '";');
}

RsX
12-14-2004, 09:39 PM
thanks a bunch :D
And regarding the collabse all expand all links, it is only included in the admincp and in a different code. Do you think you know how to do it from scratch maybe?

Zorobz
12-14-2004, 09:39 PM
there is no Collapse all button on vb... only at the admin panel, but its built diffrently..

RsX
12-15-2004, 01:37 PM
does anyone know the code that is used to do this? :/

SoulForge
11-15-2005, 01:40 PM
Ive got a countdown module on my portal and it has the button to collapse and uncollapse but when u press them it doesnt work, it calls for a template but not a php file can anyone tell me how i can fix it so when i press the collapse button it works and doesnt just change the + for the - on the button


<?php

$collapseobj_countdown = $vbcollapse['collapseobj_countdown'];
$collapseimg_countdown = $vbcollapse['collapseimg_countdown'];

eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_countdown') . '";');

?>

I tried this in a php file in my modules folder and linked the file to my module but it didnt work can anyone help me cause im doing something wrong here and i dont really understand php and scripting thanks in advance