2013-06-11, 06:35 PM
After spending many hours searching for an easy way to include a bbcode break for Announcement postings on the portal, I have found one that works really well.
The utilizes jquery. I have attached the files that I modified for my website. The originals can be found, here. The original version included "..." and cut off 100 characters after the break point. I removed the "..." and set the cut off at 0 characters.
1. Download these files and place them on your server. Mine are at /jscripts.
2. Modify Template -> Portal Templates -> Portal
Add the following code underneath {$headerinclude}
3. Create bbcode
Go to Configuration -> MyCode -> Add New MyCode
Regular Expression:
Replacement Text:
Now anything within the readmore tags will be hidden behind a readmore link on the portal page. Also, by only adding the scripts to the Portal page, your announcement thread will still look like normal.
The utilizes jquery. I have attached the files that I modified for my website. The originals can be found, here. The original version included "..." and cut off 100 characters after the break point. I removed the "..." and set the cut off at 0 characters.
1. Download these files and place them on your server. Mine are at /jscripts.
2. Modify Template -> Portal Templates -> Portal
Add the following code underneath {$headerinclude}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
<script src="jscripts/jquery.expander.js"></script>
<script src="jscripts/jquery.expander.min.js"></script>
<script>
$(document).ready(function() {
var opts = {collapseTimer: 4000};
$.each(['beforeExpand', 'afterExpand', 'onCollapse'], function(i, callback) {
opts[callback] = function(byUser) {
var by, msg = '<div class="success">' + callback;
if (callback == 'onCollapse') {
msg += ' (' + (byUser ? 'user' : 'timer') + ')';
}
msg += '</div>';
$(this).parent().parent().append(msg)
}
});
$('dl.expander dd').eq(0).expander();
$('dl.expander dd').slice(1).expander(opts);
$('ul.expander li').expander({
slicePoint: 0,
widow: 2,
expandSpeed: 0,
userCollapseText: '[^]'
});
$('div.expander').expander();
});
</script>
3. Create bbcode
Go to Configuration -> MyCode -> Add New MyCode
Regular Expression:
\[readmore\](.*?)\[/readmore\]
Replacement Text:
<div class="expander">$1</div>
Now anything within the readmore tags will be hidden behind a readmore link on the portal page. Also, by only adding the scripts to the Portal page, your announcement thread will still look like normal.