How can different templates be used based on themes in a news system?

To use different templates based on themes in a news system, you can create separate template files for each theme and then dynamically load the appropriate template based on the selected theme. This can be achieved by storing the selected theme in a configuration file or database and then using conditional statements to include the corresponding template file.

// Retrieve the selected theme from configuration or database
$selectedTheme = 'theme1';

// Define the path to the template files
$templatePath = 'templates/';

// Load the appropriate template based on the selected theme
if ($selectedTheme == 'theme1') {
    include $templatePath . 'theme1-template.php';
} elseif ($selectedTheme == 'theme2') {
    include $templatePath . 'theme2-template.php';
} else {
    include $templatePath . 'default-template.php';
}