SimplePortal

Customization => Custom Coding => Topic started by: fdr77 on December 08, 2010, 05:55:24 PM

Title: How can I increase the limit on the number of topics?
Post by: fdr77 on December 08, 2010, 05:55:24 PM
In this code...How can I increase the limit on the number of topics- posts at 10 or more?

Code: [Select]
global $txt;

$txt['recent_topics'] = 'Recent Topics';
$txt['recent_posts'] = 'Recent Posts';

$buttons = array(
   'recent_topics' => array(
      'text' => 'recent_topics',
      'image' => '',
      'lang' => true,
      'url' => '#recent_topics" id="b_rt" onclick="change_display(\'rp\'); return false;',
      'active' => true,
   ),
   'recent_posts' => array(
      'text' => 'recent_posts',
      'image' => '',
      'lang' => true,
      'url' => '#recent_posts" id="b_rp" onclick="change_display(\'rt\'); return false;',
   ),
);

echo '
<div style="overflow: auto;">
   ', template_button_strip($buttons), '
</div>
<div id="recent_topics">
   ', sp_recent(array('type' => 1, 'display' => 1), 0), '
</div>
<div id="recent_posts" style="display: none;">
   ', sp_recent(array('display' => 1), 0), '
</div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
   function change_display(block)
   {
      var current = block == \'rt\' ? 1 : 0;

      document.getElementById(\'recent_topics\').style.display = current ? \'none\' : \'\';
      document.getElementById(\'recent_posts\').style.display = current ? \'\' : \'none\';
      document.getElementById(\'b_rt\').className = current ? \'button_strip_recent_topics\' : \'button_strip_recent_topics active\';
      document.getElementById(\'b_rp\').className = current ? \'button_strip_recent_posts active\' : \'button_strip_recent_posts\';
   }
// ]]></script>';

Thank you
Title: Re: How can I increase the limit on the number of topics?
Post by: AngelinaBelle on December 09, 2010, 10:25:16 AM
To learn about this, have a look at the code for the sp_recent function
 
You can see, when you look at it, that the parameters it uses are 'boards', 'limit', 'type', and 'display'.
If it is confusing what that all means, have a look at the block editor for a recent posts or topics block, to see which parameters you can put in there, and what they mean.
 
If you put the two sets of hints together -- you suddenly realize that limit is the only choice that makes sense for how many messages to display.
 
So, to change that limit for sp_recent, put 'limit' => 10, inside the parameter array that is used in the function call.
 
 
-------
A code snippet from PortalBlocks.php
 
Code: [Select]
function sp_recent($parameters, $id, $return_parameters = false)
{
 global $txt, $scripturl, $settings, $context, $color_profile;
 $block_parameters = array(
  'boards' => 'boards',
  'limit' => 'int',
  'type' => 'select',
  'display' => 'select',
 );
 if ($return_parameters)
  return $block_parameters;
 $boards = !empty($parameters['boards']) ? explode('|', $parameters['boards']) : null;
 $limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5;
 $type = 'ssi_recent' . (empty($parameters['type']) ? 'Posts' : 'Topics');
 $display = empty($parameters['display']) ? 'compact' : 'full';
Title: Re: How can I increase the limit on the number of topics?
Post by: fdr77 on December 09, 2010, 12:36:35 PM
Thank you Angelina.....i've solved but....
to turn this block, in compact view   as I do?(is in the right column)

I tried so but it does not work....changed
Code: [Select]
echo '
<div style="overflow: auto;">
   ', template_button_strip($buttons), '
</div>
<div id="recent_topics">
   ', sp_recent(array('type' => 1, 'display' => 0), 0), '
</div>
<div id="recent_posts" style="display: none;">
   ', sp_recent(array('display' => 0), 0), '
</div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
   function change_display(block)
   {
      var current = block == \'rt\' ? 1 : 0;

      document.getElementById(\'recent_topics\').style.display = current ? \'none\' : \'\';
      document.getElementById(\'recent_posts\').style.display = current ? \'\' : \'none\';
      document.getElementById(\'b_rt\').className = current ? \'button_strip_recent_topics\' : \'button_strip_recent_topics active\';
      document.getElementById(\'b_rp\').className = current ? \'button_strip_recent_posts active\' : \'button_strip_recent_posts\';
   }
// ]]></script>';

Thanks
Title: Re: How can I increase the limit on the number of topics?
Post by: AngelinaBelle on December 09, 2010, 01:06:10 PM
I am not sure I understand this new question.
The "Recent Topics" looks OK, but "Recent Posts" looks too wide for the right column.
You need to use 'display' => 0 for both I think, which is what you posted, but it does not look like that on your site.
 
You can change the width of your right column, of course...
----
 
Also, you have a CSS problem.
Copy themes/default/css/portal.css to the css directory of your current theme
 
The reason is -- the use of these definitions in /default/css/portal.css seems to be causing the images for the left side of titlebars to be pulled from the default theme's images directory.
 
Title: Re: How can I increase the limit on the number of topics?
Post by: fdr77 on December 09, 2010, 03:41:51 PM
sorry for my english ....I will explain with pictures
Nathiel has given this code
Code: [Select]
global $txt;

$txt['recent_topics'] = 'Recent Topics';
$txt['recent_posts'] = 'Recent Posts';

$buttons = array(
   'recent_topics' => array(
      'text' => 'recent_topics',
      'image' => '',
      'lang' => true,
      'url' => '#recent_topics" id="b_rt" onclick="change_display(\'rp\'); return false;',
      'active' => true,
   ),
   'recent_posts' => array(
      'text' => 'recent_posts',
      'image' => '',
      'lang' => true,
      'url' => '#recent_posts" id="b_rp" onclick="change_display(\'rt\'); return false;',
   ),
);

echo '
<div style="overflow: auto;">
   ', template_button_strip($buttons), '
</div>
<div id="recent_topics">
   ', sp_recent(array('type' => 1, 'display' => 1), 0), '
</div>
<div id="recent_posts" style="display: none;">
   ', sp_recent(array('display' => 1), 0), '
</div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
   function change_display(block)
   {
      var current = block == \'rt\' ? 1 : 0;

      document.getElementById(\'recent_topics\').style.display = current ? \'none\' : \'\';
      document.getElementById(\'recent_posts\').style.display = current ? \'\' : \'none\';
      document.getElementById(\'b_rt\').className = current ? \'button_strip_recent_topics\' : \'button_strip_recent_topics active\';
      document.getElementById(\'b_rp\').className = current ? \'button_strip_recent_posts active\' : \'button_strip_recent_posts\';
   }
// ]]></script>';

 the result of this code is (when you choose 'block recent post topic', you can choose show compact or complete)
Title: Re: How can I increase the limit on the number of topics?
Post by: fdr77 on December 09, 2010, 03:47:24 PM
if I change the code so
Code: [Select]
global $txt;

$txt['recent_topics'] = 'Recent Topics';
$txt['recent_posts'] = 'Recent Posts';

$buttons = array(
   'recent_topics' => array(
      'text' => 'recent_topics',
      'image' => '',
      'lang' => true,
      'url' => '#recent_topics" id="b_rt" onclick="change_display(\'rp\'); return false;',
      'active' => true,
   ),
   'recent_posts' => array(
      'text' => 'recent_posts',
      'image' => '',
      'lang' => true,
      'url' => '#recent_posts" id="b_rp" onclick="change_display(\'rt\'); return false;',
   ),
);

echo '
<div style="overflow: auto;">
   ', template_button_strip($buttons), '
</div>
<div id="recent_topics">
   ', sp_recent(array('type' => 1, 'display' => 0), 0), '
</div>
<div id="recent_posts" style="display: none;">
   ', sp_recent(array('display' => 1), 0), '
</div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
   function change_display(block)
   {
      var current = block == \'rt\' ? 1 : 0;

      document.getElementById(\'recent_topics\').style.display = current ? \'none\' : \'\';
      document.getElementById(\'recent_posts\').style.display = current ? \'\' : \'none\';
      document.getElementById(\'b_rt\').className = current ? \'button_strip_recent_topics\' : \'button_strip_recent_topics active\';
      document.getElementById(\'b_rp\').className = current ? \'button_strip_recent_posts active\' : \'button_strip_recent_posts\';
   }
// ]]></script>';

I have this result in recent topics but not in recent posts






Title: Re: How can I increase the limit on the number of topics?
Post by: fdr77 on December 09, 2010, 03:56:03 PM
I think this is because it says to choose show compact or complete...in this part of code
Code: [Select]
echo '
<div style="overflow: auto;">
   ', template_button_strip($buttons), '
</div>
<div id="recent_topics">
   ', sp_recent(array('type' => 1, 'display' => 1), 0), '
</div>
<div id="recent_posts" style="display: none;">
   ', sp_recent(array('display' => 1), 0), '
</div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
   function change_display(block)
   {
      var current = block == \'rt\' ? 1 : 0;

P.S here my code
Title: Re: How can I increase the limit on the number of topics?
Post by: fdr77 on December 09, 2010, 04:00:54 PM
I would look like in this picture(both)

At the end of the code I added
Code: [Select]
echo "<br> <a href=\"recent\"><b>Post precedenti...</b></a><hr>";
Title: Re: How can I increase the limit on the number of topics?
Post by: fdr77 on December 09, 2010, 04:36:20 PM
Changed sò
Code: [Select]
global $txt;

$txt['recent_topics'] = 'Recent Topics';
$txt['recent_posts'] = 'Recent Posts';

$buttons = array(
   'recent_topics' => array(
      'text' => 'recent_topics',
      'image' => '',
      'lang' => true,
      'url' => '#recent_topics" id="b_rt" onclick="change_display(\'rp\'); return false;',
      'active' => true,
   ),
   'recent_posts' => array(
      'text' => 'recent_posts',
      'image' => '',
      'lang' => true,
      'url' => '#recent_posts" id="b_rp" onclick="change_display(\'rt\'); return false;',
   ),
);

echo '
<div style="overflow: auto;">
   ', template_button_strip($buttons), '
</div>
<div id="recent_topics">
   ', sp_recent(array('type' => 1, 'display' => 0), 0), '
</div>
<div id="recent_posts" style="display: none;">
   ', sp_recent(array('display' => 0), 0), '
</div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
   function change_display(block)
   {
      var current = block == \'rt\' ? 1 : 0;

      document.getElementById(\'recent_topics\').style.display = current ? \'none\' : \'\';
      document.getElementById(\'recent_posts\').style.display = current ? \'\' : \'none\';
      document.getElementById(\'b_rt\').className = current ? \'button_strip_recent_topics\' : \'button_strip_recent_topics active\';
      document.getElementById(\'b_rp\').className = current ? \'button_strip_recent_posts active\' : \'button_strip_recent_posts\';
   }
// ]]></script>';

and works as I want but....
only in the main page of the forum and portal....in the topic, the recent post button don't work.
instead with the original code ,it's ok
Title: Re: How can I increase the limit on the number of topics?
Post by: fdr77 on December 09, 2010, 05:26:23 PM
look this link
http://www.discusrewind.net/foto-e-video-gallery/ed-alla-fine-e-arrivato/
right column.... code modified
in the bottom.... code original
Title: Re: How can I increase the limit on the number of topics?
Post by: AngelinaBelle on December 09, 2010, 07:18:14 PM
You have two blocks which include a div with id=recent_topics (same for id=recent_posts).
This can certainly cause a problem for the javascript.
 
There should never be two things on the same page with the same id.
See what happens if you try with only one of those  blocks enabled at a time.
Title: Re: How can I increase the limit on the number of topics?
Post by: fdr77 on December 09, 2010, 09:31:26 PM
Thank you ,
everything is fine now :)
regarding the portal css is all ok?
You are so patient and kind
Thanks
Title: Re: How can I increase the limit on the number of topics?
Post by: AngelinaBelle on December 09, 2010, 10:01:10 PM
Did you copy portal.css into dsv4_20rc3/css/  It looks like you should also remove
H3.titlebg SPAN.left from dsv4_20rc3/css/portal.css
 
 
Title: Re: How can I increase the limit on the number of topics?
Post by: fdr77 on December 10, 2010, 07:02:15 AM
I had not copied portal.css, now be inserted.
I hope now, everything is ok.
Other files to be imported in the personalize  theme.
thanks
SimplePortal 2.3.8 © 2008-2024, SimplePortal