Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Variable number of modules for variable page lenght

Variable number of modules for variable page lenght

hello there,

i use the agora forum on my website, just as you do. I was wondering if it was possible to control the number of modules displayed on the right column, so when a topic page is new, only a few essential modules are displayed, and when the topicpage grows, also some modules are added in the right column?

Sandman
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Variable number of modules for variable page lenght

That's an interesting idea. Can you tell me what constitutes "new"? Do you want to do that by age, or simply by the number of replies in the current thread?

When you're paginating, would you also want the number of items to reflect the length of the list down the page? e.g. on 2nd page there might only be 1 item in the thread so you might want less modules.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Variable number of modules for variable page lenght

Best thing is by actual pixels per page... But i am no coder and don't now what is possible and not to difficult to make it work.

Per posting would be nice, as most postings are quite similar in length, so that would not be perfect but it would be a great thing to have smile.

But like you said, what with pagination, I would like it to behave differently on the last page, only fill the right column to the point where the topic is currently stopped.

It's already good to know that you like my idea wink

Sandman
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Variable number of modules for variable page lenght

Hi Sandman,

Finding out the number of pixels available just isn't going to be possible - but the number of posts on a page *should* be in most cases.

Leave it with me. I'll have to find a little time to delve into the insides of Agora Forum.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Variable number of modules for variable page lenght

Ok, this took longer than I had hoped. I also don't know how efficient it is, as it has to re-load some portions of Agora and probably hits the database a few more times than you might want. But it's also reasonably simple!

This recipe gets the number of posts in a topic - that's all. It does not count topics in a list of topics, or number of forums in a list.

Code:

if (JRequest::getVar('task') == 'topic') {

  // $id is the id of the topic we are looking at   
  if ($id > 0) {
    $p = JRequest::getInt("p"); // page
    if ($p == 0) $p = 1;
    $controller = new TaskController();
    $agora_user = $controller->agora_user;
    $topic_model = & Model::getInstance('TopicModel');
    $postcount = $topic_model->getPostCount( $id );
       
    $per_page = intval($agora_user['disp_posts']) > 0 ?
      $agora_user['disp_posts'] :
      intval($controller->agora_config['o_disp_posts_default']);
       
    $on_last_page = ($postcount <= $p * $per_page);
    if (! $on_last_page ) $num_on_this_page = $per_page;
    else $num_on_this_page = (($postcount - 1) % $per_page) + 1;
 
    if ($num_on_this_page == 1) return XXX;
    if ($num_on_this_page == 2) return "XXX,YYY";
    if ($num_on_this_page > 5) return "XXX, YYY, ZZZ, AAA, BBB";

  }
}

I can't guarantee that this is perfect, but it works for me in basic testing.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Variable number of modules for variable page lenght

Ok, thx, I'll try it out this weekend!

Sandman
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1685
Total Polls:
6
Total Posts:
5912
Total Posts Today:
4
User Info:
 
Total Users:
11504
Newest User:
toko solo
Members Online:
0
Guests Online:
120

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked