Hey all. I am trying to make an include script that auto adds a -2.
<?php
$file = substr($_SERVER['PHP_SELF'], 0, -4) . "-2.php";
include($file);
?>
echo would be /includes/file name-2.php
I have tried other strings. They seem to work when I echo them but not when i use it as an Include.
Basic idea was base file is Index-###.php. The include would be Index-001-2.php. Not sure if its possible, I am still new to PHP. If theres a quicker way to make a page to add my top and bottom and auto include the linked file, do tell. Would help from me renaming each file to include index-###-2.php. # is the Index number. ( each Index-###-2.php has a different variable to load like Index-001-2.php has $file = This-File.swf and Index-002-2.php has $file = Another-File.swf ) Basically want the Index.###.php to auto add -2 to the $file include. Not sure if its possible though. If any could help would greatly be appreciated.