Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: dougiefresh on June 02, 2018, 07:17:58 PM

Title: Tabs In Posts
Post by: dougiefresh on June 02, 2018, 07:17:58 PM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=4182)


TABS IN POSTS v1.2
By Dougiefresh (http://www.simplemachines.org/community/index.php?action=profile;u=253913) -> Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=4182)


Introduction
Ever had too much information and wished you could put it in tabs to organize it?  Well, now you can with this mod using the tabarea and tab bbcodes like this:
Code: (Example) [Select]
[tabarea]
[tab=Tab 1]This is a test![/tab]
[tab=Tab 2]This is a test as well![/tab]
[taburl=URL]http://www.xptsp.com[/taburl]
[/tabarea]
Note that anything between [tabarea] and [tab], between closing and opening [tab] tags, and between the last [tab] and the closing [tabarea] tag is discarded.  The example below:
Code: (Excluded Example) [Select]
[tabarea]Excluded # 1
[tab=Tab 1]This is a test![/tab]Excluded # 2
[tab=Tab 2]This is a test as well![/tab]Excluded # 3
[taburl=URL]http://www.xptsp.com[/taburl]
[/tabarea]
is the same as the first code block shown.  You can also use the [taburl] bbcode to go to a different page/site by clicking that link.

Version 1.2 allows the user to use some smileys in the title, however, anything with brackets should be avoided.  BBcodes in general cannot be used as any part of the title, but this may be change in later versions....

Using the new [wholepost bbcode changes the format of the post so that the poster information is omitted from the message display.

There is no restriction of tab areas per post or topic, as each tab area is independent of the others.

Admin Settings
There are no admin settings for this mod.  To disable the bbcode, you may go to Admin => Forum => Posts and Topics => Bulletin Board Code and uncheck the tagarea and/or tag bbcodes.

Compatibility Notes
This mod was tested on SMF 2.0.15 and SMF 2.1 Beta 3, but should work on SMF 2.0 and up.  SMF 1.x is not and will not be supported.

Changelog
The changelog can be viewed at XPtsp.com (http://www.xptsp.com/board/free-modifications/tabs-in-post/).

License
Copyright (c) 2018, Douglas Orend
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Title: Re: Tabs In Posts
Post by: Rock Lee on June 02, 2018, 09:52:06 PM
Oh, it seems very good, then what it is, to see how, Very good :D


Regards!
Title: Re: Tabs In Posts
Post by: GigaWatt on June 02, 2018, 10:34:39 PM
https://www.simplemachines.org/community/index.php?topic=560091.0

;)
Title: Re: Tabs In Posts
Post by: Shambles on June 03, 2018, 11:35:21 AM
Seems to work well in 2.0.15

Getting a couple of undefined indexes in Subs.php since installation:

(https://i.imgur.com/7VSLRKY.jpg)

Code: [Select]
<?php
// This has parsed content, and a csv value which is unparsed.
elseif ($tag['type'] == 'unparsed_commas')
{
$pos2 strpos($message']'$pos1);
if ($pos2 === false)
continue;

$data explode(','substr($message$pos1$pos2 $pos1));

if (isset($tag['validate']))
$tag['validate']($tag$data$disabled);

// Fix after, for disabled code mainly.
foreach ($data as $k => $d)
=>
$tag['after'] = strtr($tag['after'], array('$' . ($k 1) => trim($d)));

$open_tags[] = $tag;

// Replace them out, $1, $2, $3, $4, etc.
=> $code $tag['before'];
foreach ($data as $k => $d)
$code strtr($code, array('$' . ($k 1) => trim($d)));
$message substr($message0$pos) . "\n" $code "\n" substr($message$pos2 1);
$pos += strlen($code) - 2;
}
?>


The tab code in the post is as follows:

Code: [Select]
[tabarea]
[tab=Profile][img]https://i.imgur.com/uMAaO4z.jpg[/img][/tab]
[tab=On Display][img]https://i.imgur.com/QAKS0dj.jpg[/img][/tab]
[/tabarea]
Title: Re: Tabs In Posts
Post by: dougiefresh on June 03, 2018, 12:02:10 PM
Uploaded v1.1 - June 3rd, 2018
o Added support for SMF 2.1 Beta 3.
o Fixed a couple of undefined indexes in Sources/Subs.php.



@Shambles:  Thank you for reporting these bugs!  Those bugs been fixed for this version!
Title: Re: Tabs In Posts
Post by: Shambles on June 03, 2018, 05:40:12 PM
Good one Herr Dougie.
Title: Re: Tabs In Posts
Post by: 4Kstore on June 03, 2018, 07:58:05 PM
Thanks for this mod, it's awesome
Title: Re: Tabs In Posts
Post by: pocttopus on October 13, 2018, 03:52:20 PM
This is awesome mod but how can I add bbcode for tabs?  ??? :)
Title: Re: Tabs In Posts
Post by: dougiefresh on October 14, 2018, 11:54:28 PM
Uploaded v1.2 - October 14th, 2018
o Added the ability to parse the title, allowing for bbcode in the title.
o Added tab URL parameter to specify default tab in post (inspired by GitHub).
o Added tab_x URL parameter to specify default tab in a specific tabbed area.
o Fixed taburl tag to properly show title instead of URL.
o Fixed unwanted extra line issue with [wholepost] tag.
o Updated documentation to point to new website.


This is awesome mod but how can I add bbcode for tabs?  ??? :)
I assume you mean for the tab titles, right?  I'm going to assume the answer is yes for this question, and the answer for the assumed question is that I'm looking into the issue, cause I would like to know as well.  It should be possible.

Now, if you're asking about bbcodes inside the tab area that are NOT URL links, then you need to use the tab bbcode in order to create a tabbed area for the contents of that tab.  So, it should look like this:
Code: [Select]
[tabarea]
[tab=My first tab]Blah Blah Blah Blah[/tab]
[/tabarea]

If you are asking about URL links as a title for the tab, use the taburl bbcode.  It should look like this:
Code: [Select]
[tabarea]
[taburl=My first tab]http://whereever.you.want/to/go[/taburl]
[/tabarea]

I hope this helps in understanding how this mod works.
Title: Re: Tabs In Posts
Post by: pocttopus on October 15, 2018, 07:38:02 AM
@dougiefresh
Thanks for your response and I apologize if my question was not so clear. :-[
I was wondering is there any way for bbcode button. When we select this button to generate tabArea template, just like other buttons for "Insert unordered list" or "Insert code".

I hope that I am more clear with understanding of my question.  :)
Thanks!
Title: Re: Tabs In Posts
Post by: Yorel on October 15, 2018, 10:07:41 AM
Hi

Does someone could show us how it looks like with a screenshoot please?.

Thanks
Title: Re: Tabs In Posts
Post by: dougiefresh on October 15, 2018, 10:32:30 AM
@pocttopus:  Oh, I didn't think of that.  I'll implement it in a little while....

@Yorel: Here's a link to the Mod in Action (http://www.xptsp.com/board/free-modifications/tabs-in-post/).  I'll post some screenshots later.
Title: Re: Tabs In Posts
Post by: pocttopus on October 16, 2018, 10:35:07 AM
@pocttopus:  Oh, I didn't think of that.  I'll implement it in a little while....
Thanks!  ;) :)
Title: Re: Tabs In Posts
Post by: dougiefresh on October 23, 2018, 01:04:00 PM
I just figured out that printing a page with the tabbed area on it doesn't produce the expected results.  I will fix this when I add the bbcode button stuff to the mod....
Title: Re: Tabs In Posts
Post by: pocttopus on January 17, 2019, 04:48:40 PM
Hello,

Suddenly the mod has stopped to work. Didn't change anything on my forum, yesterday everything was fine, today there is an issue.
Tabs are not working. Only first tab is displayed, others are not working.

Any suggest to solve this issue?
Thanks.
Title: Re: Tabs In Posts
Post by: StarredSkies on January 17, 2019, 11:08:46 PM
Lovely modification! I've been looking for something like this for awhile. <3
I would love to use this with BBCode with Style (http://custom.simplemachines.org/mods/index.php?mod=2505) to create some lovely templates and customize the tabs in the future. If you have any way to do this currently, please share! As for now, this is just a simple suggestion.
Title: Re: Tabs In Posts
Post by: shadav on September 20, 2019, 11:13:52 AM
I'm really liking this idea
I tend to post more article type posts and this will be helpful and also i'm thinking about this for my rules post.....

am I correct though that I can not use other bbc inside of the tabs (not for the titles but the tabs themselves)?