News:

Wondering if this will always be free?  See why free is better.

Main Menu

Pages 1,2 ... formatting

Started by Arj3090, January 31, 2019, 05:02:19 PM

Previous topic - Next topic

Arj3090

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:

<a class="navPages" href="https ..... ?topic=2300.0" color:="" #ffffff="">1</a>

On the recent list:

<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:

// 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?

Arantor

It's in Subs.php in the function constructPageIndex.

Arj3090

I checked in Subs.php and this is the code I see that generates the links for the pages:

$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.

Arantor

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.

Arj3090

I found it in Recent.php at line 1200

{
$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!

Arantor

Ah, so you weren't actually looking at the recent posts list, good to know.

Arj3090

I was calling it the wrong thing. It was the New Posts and Replies list.

Advertisement: