What are the potential drawbacks of using traditional linking methods for subpages in PHP websites?

Using traditional linking methods for subpages in PHP websites can lead to hardcoded URLs, making the website less flexible and harder to maintain. To solve this issue, it's recommended to use PHP functions like `dirname()` and `basename()` to dynamically generate URLs for subpages based on the current file location.

<?php
$current_page = basename($_SERVER['PHP_SELF']);
$root_path = dirname($_SERVER['PHP_SELF']);

echo "<a href='$root_path/subpage.php'>Subpage</a>";
?>