Need help with code modification.
The code below works and reads the name of the current file.
(ie: file1.php)
It then looks for the header file
(ie: file1header1.php) and reads/displays the info.
*** The problem I need help with modification.
There are many times that the file doesn’t have a number.
(ie: file.php)
and it needs to find the matching header that doesn’t either
(ie: fileheader.php)
I need help modifying the code for it to continue to read
the files as it does now but to also read and compare files
with out numbers in them.
If file has no number look for header with no number.
The name of the header file is created with part of the current file
name included.
Thanks in advance.
[php]
<?php $file = $_SERVER["SCRIPT_NAME"]; $break = explode('/', $file); $pfile = $break[count($break) - 1]; if (preg_match('/(\d+)\.php/', $pfile, $i)) { $number = $i[1]; $newfile = "$pfile"; $info = pathinfo($newfile); // from PHP 5.2.0 : $file_name = $info['filename']; // echo $file_name; include_once "$file_name"."header$number.php"; } ?>[/php]