Post
Topic
Board Services
Re: CONTEST: design loyce.club home page
by
MMM005
on 04/10/2020, 22:46:45 UTC
Sneak preview: http://loyce.club/archive/oldposts/
How to use:
  • Find the msgID you need. Let's use 28228
  • Remove the last 5 digits from the msgID to get the directory name (if there are less than 5 digits, use 0): 0
  • Replace the last 2 digits of the msgID by xx, and add .html (if there are less than 5 digits, use 0xx): 282xx.html
  • Add "#msg" and the msgID: #msg28228
  • Put everything together and go to http://loyce.club/archive/oldposts/0/282xx.html#msg28228

for oldposts:

Code:
// Get $searchType from the input, where oldmsgID=>oldposts
$searchType = "oldposts"; // by oldmsgID

// Get $ID from the input (should be >= 1)
// $ID = "28228";
$ID = "25000030";

$dirName = (strlen($ID) <= 5 ? "0" : substr($ID, 0, -5));
// $pageName = substr($ID, -2);
$pageName = (strlen($ID) < 5 ? "0xx" : substr($ID, 0, -2) . "xx");
$url = "http://loyce.club/archive/$searchType/$dirName/$pageName.html#msg$ID";
echo $url;

// http://loyce.club/archive/oldposts/0/282xx.html#msg28228
// http://loyce.club/archive/oldposts/250/250000xx.html#msg25000030

And by adding posts, topics and members we get:

Code:
$urlBase = "http://loyce.club/archive";

// Get $searchType from the input, where oldmsgID=>oldposts, msgID=>posts, topicID=>topics and userID=>members
$searchType = "posts"; // by msgID

// Get $ID from the input (should be >= 1)
$ID = "28228";

$countDigits = ($searchType === "oldposts" ? 5 : 4);
$dirName = (strlen($ID) <= $countDigits ? "0" : substr($ID, 0, -$countDigits));
$pageName = (strlen($ID) < $countDigits ? "0xx" : substr($ID, 0, -2) . "xx");
$url = ($searchType === "oldposts" ? "$urlBase/$searchType/$dirName/$pageName.html#msg$ID" : "$urlBase/$searchType/$dirName/$ID.html");

echo $url;



Ideally, this should be included in the same search field: if someone searches for a low post number (say 25000030), it should give this link: https://loyce.club/archive/oldposts/250/250000xx.html#msg25000030.
But if someone searches for a high number (say 5310200), it should give this link: https://loyce.club/archive/posts/5531/55310200.html.

What is the logic of detecting low/high post numbers?