Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP/TPL Link Opens up As File Not Page Reply To: PHP/TPL Link Opens up As File Not Page

#149977

I am trying to make a template system just modifying some files so I can click on install and it installed db for me

sort of worked it out here sample php code

function write_config_files($options) {
    $output  = '<?php' . "\n";
    $output .= '// HTTP' . "\n";
    $output .= 'define(\'HTTP_SERVER\', \'' . $options['http_server'] . '\');' . "\n";
    $output .= 'define(\'HTTP_IMAGE\', \'' . $options['http_server'] . 'image/\');' . "\n";
    $output .= 'define(\'HTTP_ADMIN\', \'' . $options['http_server'] . 'admin/\');' . "\n\n";

    $output .= '// HTTPS' . "\n";
    $output .= 'define(\'HTTPS_SERVER\', \'' . $options['http_server'] . '\');' . "\n";
    $output .= 'define(\'HTTPS_IMAGE\', \'' . $options['http_server'] . 'image/\');' . "\n\n";

    $output .= '// DIR' . "\n";
    $output .= 'define(\'DIR_APPLICATION\', \'' . DIR_CUSTOMWEB . 'catalog/\');' . "\n";
    $output .= 'define(\'DIR_SYSTEM\', \'' . DIR_CUSTOMWEB. 'system/\');' . "\n";
    $output .= 'define(\'DIR_DATABASE\', \'' . DIR_CUSTOMWEB . 'system/database/\');' . "\n";
    $output .= 'define(\'DIR_LANGUAGE\', \'' . DIR_CUSTOMWEB . 'catalog/language/\');' . "\n";
    $output .= 'define(\'DIR_TEMPLATE\', \'' . DIR_CUSTOMWEB . 'catalog/view/theme/\');' . "\n";
    $output .= 'define(\'DIR_CONFIG\', \'' . DIR_CUSTOMWEB . 'system/config/\');' . "\n";
    $output .= 'define(\'DIR_CACHE\', \'' . DIR_CUSTOMWEB . 'system/cache/\');' . "\n";
    $output .= 'define(\'DIR_LOGS\', \'' . DIR_CUSTOMWEB . 'system/logs/\');' . "\n\n";

    $output .= '// DB' . "\n";
    $output .= 'define(\'DB_DRIVER\', \'mysql\');' . "\n";
    $output .= 'define(\'DB_HOSTNAME\', \'' . addslashes($options['db_host']) . '\');' . "\n";
    $output .= 'define(\'DB_USERNAME\', \'' . addslashes($options['db_user']) . '\');' . "\n";
    $output .= 'define(\'DB_PASSWORD\', \'' . addslashes($options['db_password']) . '\');' . "\n";
    $output .= 'define(\'DB_DATABASE\', \'' . addslashes($options['db_name']) . '\');' . "\n";
    $output .= 'define(\'DB_PREFIX\', \'' . addslashes($options['db_prefix']) . '\');' . "\n";