Funkcje przestają działać, gdy plik jest dołączony do ścieżki głównej (ukośnik wiodący)
Moje pliki PHP w moim katalogu głównym INCLUDE header.php. Header.php INCLUDEs functions.php. Dodaję nowe strony do podkatalogu, więc dodałem ukośniki prowadzące do wszystkich moich linków w header.php: CSS, elementy menu i kolejne INCLUDE do functions.php. CSS i elementy menu działają dobrze na tej stronie w podkatalogu, ale funkcje nie działają. Brak funkcji w funkcjach, które wydają się wymagać ukośników.
Czy połączenieinclude
a wiodące ukośniki wymagają modyfikacji funkcji?
Ze strony w katalogu głównym:
include('header.php');
Ze strony w podkatalogu:
include('/header.php');
Od header.php:
include('/functions.php');
I funkcja, która już nie działa (wywoływana ze stron w katalogu głównym lub podkatalogu):
function show_date($array_name){
if (date("Y F j",strtotime($array_name["exhibit_open"])) == date("Y F j",strtotime($array_name["exhibit_close"]))){
echo date("F j, Y",strtotime($array_name["exhibit_open"]));
}
elseif (date("Y",strtotime($array_name["exhibit_open"])) != date("Y",strtotime($array_name["exhibit_close"]))) {
$first_date_format = "F j, Y";
echo date($first_date_format,strtotime($array_name["exhibit_open"])). " - ". date("F j, Y",strtotime($array_name["exhibit_close"]));
} elseif (date("F",strtotime($array_name["exhibit_open"])) != date("F",strtotime($array_name["exhibit_close"]))){
$first_date_format = "F j";
echo date($first_date_format,strtotime($array_name["exhibit_open"])). " - ". date("F j, Y",strtotime($array_name["exhibit_close"]));
} else {
$first_date_format = "j";
echo date("F j",strtotime($array_name["exhibit_open"])). " - ". date($first_date_format,strtotime($array_name["exhibit_close"])). ", ". date("Y",strtotime($array_name["exhibit_close"]));
}
}