What are the potential pitfalls of using relative paths in PHP includes for CSS files?
When using relative paths in PHP includes for CSS files, the potential pitfall is that the paths may not resolve correctly depending on the location of the included file. To solve this issue, it is recommended to use absolute paths or define a base URL for your website and use it to construct the paths to your CSS files.
<?php
// Define base URL
$base_url = "http://example.com/";
// Include CSS file using absolute path
echo '<link rel="stylesheet" type="text/css" href="' . $base_url . 'css/style.css">';
?>