TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,946
  • Latest: Sparo
Stats
  • Total Posts: 195,717
  • Total Topics: 21,276
  • Online today: 125
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 54
  • Total: 55
  • @rjen

Article Category URL Generation

Started by [chrisB], March 10, 2025, 04:29:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[chrisB]

I think it would be good if categories had universal URL generation.

index.php?cat=Interviews <-- tree link/breadcrumb
index.php?cat=9

One is shown in the tree link/breadcrumb.
The other in the category block, which shows on the categories page.



Two points:

The treelink/breadcrumb generation does not seem to be picked up by FURL mods.

If the generation of the URLs were consistent and universal, the URLs would be more formal.

@rjen

That may actually be an oversight.
Running Latest TP on SMF2.1 at: www.fjr-club.nl

@rjen

Quote from: [chrisB] on March 10, 2025, 04:29:07 PMTwo points:

The treelink/breadcrumb generation does not seem to be picked up by FURL mods.

If the generation of the URLs were consistent and universal, the URLs would be more formal.

As for point 1: I do not knwo what FURL mods are, but they are outside of the Tinyportal scope, so we cannot hekp that

For point2:
I remember that one: I have tried in the past to adapt the Cat list code to use the short description URL for the categories, but failed due to the way the code is written. This would require a more fundamental rewrite of the function, that is beyond my capabilities.

Perhaps @tino is able to help with that some time...
Running Latest TP on SMF2.1 at: www.fjr-club.nl

tino

Can you raise it on GitHub for me? Assign it to me and GitHub will nag me to do it  ;D

I rarely sit down at a PC anymore, but will do my best to find time.

@rjen

Running Latest TP on SMF2.1 at: www.fjr-club.nl

[chrisB]

Any chance I could be pointed to the part of the code which would generate these buttons and their URLs? Please.


@rjen

Quote from: [chrisB] on March 12, 2025, 07:15:39 PMAny chance I could be pointed to the part of the code which would generate these buttons and their URLs? Please.



This is the code you are looking for:

TPortal.template.php
From line 139...

// Article categories template
function template_category()
{
global $txt, $context, $scripturl;

if (!empty($context['TPortal']['clist'])) {
$buts = [];
foreach ($context['TPortal']['clist'] as $cats) {
$buts[$cats['id']] = [
'text' => 'catlist' . $cats['id'],
'lang' => false,
'url' => $scripturl . '?cat=' . $cats['id'],
'active' => false,
];
if ($cats['selected']) {
$buts[$cats['id']]['active'] = true;
}
}
echo '<div style="overflow: hidden;">' , tp_template_button_strip($buts, 'top'), '</div>';
}
Running Latest TP on SMF2.1 at: www.fjr-club.nl

@rjen

I just fixed it, will be in version 3.0.2
Running Latest TP on SMF2.1 at: www.fjr-club.nl

Replayuk


[chrisB]

rjen;

Should the link, when inside an article, to view the page also be ?page=about instead of ?page=6



If the page has a "Short name", I would have thought for consistency, just like the categories, that the URL would be "about" and not the page's number?

I think for consistency it would make more sense, but it might be as it is intended.

In addition to this, my menu is active if I use the "article" URL, but isn't active with the page's number.

https://poetryartonline.com/?page=about

As a fix to an issue I am experiencing, it was suggested that I uninstall the Pretty URLs Pro mod. Which confirms I can make the tab active, just not with the page's ID.

This website is proudly hosted on Crocweb Cloud Website Hosting.