![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/private_html/includes/ |
<?php
/**
* Page Container Helper - Standardizes page structure for AJAX navigation
* Ensures consistent container IDs and structure across all pages
*/
/**
* Start the main page container with consistent structure
* @param string $page_id Unique identifier for the page
* @param string $container_class Additional CSS classes for the container
* @param bool $is_ajax Whether this page is being loaded via AJAX
*/
function startPageContainer($page_id = '', $container_class = '', $is_ajax = false) {
$classes = 'container';
if ($container_class) {
$classes .= ' ' . $container_class;
}
echo '<div class="' . $classes . '" id="pageContainer" data-page-id="' . htmlspecialchars($page_id) . '">';
// Add page-specific data attributes for AJAX navigation
if ($is_ajax) {
echo '<div class="ajax-loaded-content" data-loaded="' . time() . '">';
}
}
/**
* End the main page container
* @param bool $is_ajax Whether this page is being loaded via AJAX
*/
function endPageContainer($is_ajax = false) {
if ($is_ajax) {
echo '</div>'; // Close ajax-loaded-content
}
echo '</div>'; // Close pageContainer
}
/**
* Check if the current request is an AJAX request
* @return bool True if AJAX request
*/
function isAjaxRequest() {
return isset($_GET['ajax']) && $_GET['ajax'] == '1';
}
/**
* Get the appropriate page title based on AJAX status
* @param string $default_title Default page title
* @return string Formatted page title
*/
function getPageTitle($default_title) {
if (isAjaxRequest()) {
return $default_title;
} else {
return $default_title . ' - SoundStudioPro';
}
}
/**
* Conditionally include header/footer based on AJAX status
* @param string $include_file File to include
* @param bool $force_include Force include regardless of AJAX status
*/
function conditionalInclude($include_file, $force_include = false) {
if ($force_include || !isAjaxRequest()) {
include $include_file;
}
}
/**
* Output page-specific CSS that should be included in AJAX responses
* @param string $css CSS content to output
*/
function outputPageCSS($css) {
if (isAjaxRequest()) {
echo '<style>' . $css . '</style>';
}
}
/**
* Output page-specific JavaScript that should be included in AJAX responses
* @param string $js JavaScript content to output
*/
function outputPageJS($js) {
if (isAjaxRequest()) {
echo '<script>' . $js . '</script>';
}
}
/**
* Create a standardized page structure
* @param string $page_title Page title
* @param string $page_id Unique page identifier
* @param bool $include_header Whether to include header
* @param bool $include_footer Whether to include footer
*/
function createStandardPage($page_title, $page_id, $include_header = true, $include_footer = true) {
$is_ajax = isAjaxRequest();
if ($include_header && !$is_ajax) {
include 'header.php';
}
startPageContainer($page_id, '', $is_ajax);
// Page content will go here
endPageContainer($is_ajax);
if ($include_footer && !$is_ajax) {
include 'footer.php';
}
}
?>