Advertisement:

Author Topic: Pages 1,2 ... formatting  (Read 523 times)

Offline Arj3090

  • Newbie
  • *
  • Posts: 5
Pages 1,2 ... formatting
« on: January 31, 2019, 05:02:19 PM »
I am trying to make the "Pages [1] 2" formatted the same on the main list and on the unread post lists. The difference seems to be in the generated link.

On the main list:
Code: [Select]
<a class="navPages" href="https ..... ?topic=2300.0" color:="" #ffffff="">1</a>
On the recent list:
Code: [Select]
<a href="https ..... topic=2129.0;topicseen">1</a>
I think I want to add class="navPages" so it will format the page numbers.


I have found this code in script.js that generates the html for the main list:
Code: [Select]
// Calculate the new pages.
for (i = firstPage; i < lastPage; i += perPage)
replacement += '<a class="navPages" href="' + baseURL.replace(/%1\$d/, i).replace(/%%/g, '%') + '" color: #ffffff>' + (1 + i / perPage) + '</a> ';

But I do not know where the same HTML is generated for the unread posts list in order to add the class="navPages". Can someone point me in the right direction?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,621
    • StoryBB/StoryBB on GitHub
Re: Pages 1,2 ... formatting
« Reply #1 on: January 31, 2019, 05:06:11 PM »
It's in Subs.php in the function constructPageIndex.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Arj3090

  • Newbie
  • *
  • Posts: 5
Re: Pages 1,2 ... formatting
« Reply #2 on: January 31, 2019, 06:15:45 PM »
I checked in Subs.php and this is the code I see that generates the links for the pages:
Code: [Select]
$base_link = '<a class="navPages" href="' . ($flexible_start ? $base_url : strtr($base_url, array('%' => '%%')) . ';start=%1$d') . '" color: #ffffff>%2$s</a> ';
It unconditionally adds the class="navPages", so the Recent Posts list page links must be generated some place else or I am missing something.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,621
    • StoryBB/StoryBB on GitHub
Re: Pages 1,2 ... formatting
« Reply #3 on: January 31, 2019, 06:29:58 PM »
Recent Posts, action=recent, is built in RecentPosts() in Sources/Recent.php, and it's each of the places that $context['page_index'] is built and then output into the template in Recent.template.php.

When I look at that page on this site, I see that class in the a tags, so... I don't know how you're not seeing it.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Arj3090

  • Newbie
  • *
  • Posts: 5
Re: Pages 1,2 ... formatting
« Reply #4 on: January 31, 2019, 06:54:35 PM »
I found it in Recent.php at line 1200
Code: [Select]
{
$tmppages[] = '<a class="navPages" href="' . $scripturl . '?topic=' . $row['id_topic'] . '.' . $tmpb . ';topicseen">' . $tmpa . '</a>';
$tmpa++;
}
I added in the class="navPages" and now my recent posts page links format the same as the normal posts.

Thanks for the help and quick response!

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,621
    • StoryBB/StoryBB on GitHub
Re: Pages 1,2 ... formatting
« Reply #5 on: January 31, 2019, 06:57:29 PM »
Ah, so you weren't actually looking at the recent posts list, good to know.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Arj3090

  • Newbie
  • *
  • Posts: 5
Re: Pages 1,2 ... formatting
« Reply #6 on: January 31, 2019, 07:27:13 PM »
I was calling it the wrong thing. It was the New Posts and Replies list.