2015-04-14 3 views
1

У меня 3 веб-сайта. Я создал специальную php-страницу с заголовком и нижним колонтитулом сайта. Тот же php-файл используется во всех трех сайтах. В двух сайтах он отлично работает, но на третьем сайте название страницы показывает ошибку 404.Prestashop Пользовательская php страница имеет ошибку 404 в заголовке

Я не могу понять, почему это происходит. Я проверил файл .htacccess и попытался их сопоставить, но это тоже кажется ОК. Я искал ответ на форуме Prestashop, но ничего не нашел.

На следующих двух сайтах, если вы посмотрите на вкладку браузера, название будет прекрасным.

http://malverncomputerservices.com.au/payment.php

https://i.net.au/payment.php

В этом 3-сайте однако, название показывает ошибку 404. Страница работает правильно, но всегда имеет ошибку в верхней части страницы. Я не знаю, как это произошло, поскольку файлы php являются только копиями оригинала.

http://toorakcomputerservices.com.au/payment.php

+0

Ваши ссылки неверны. Укажите правильные ссылки. –

+0

Извините за это. Попробуй. – Shrilekha

+0

Ваш сайт находится в режиме обслуживания, поэтому мы не можем видеть, что это 404. Также есть 3 сайта с одинаковыми версиями PrestaShop? – PrestaShopDeveloper

ответ

0

Я нашел решение, и это работает для меня. Создайте php-файл в любом месте в корневой папке или в внутренней папке и вставьте код ниже. Протестировано с версией 1.6.

<?php 
require_once $_SERVER['DOCUMENT_ROOT'].'/config/config.inc.php'; 
$current = getcwd(); 
class ContentPageCutomized extends FrontController 
{ 
    public function initContent() 
    { 

    parent::initContent(); 
    } 

    public function displayHeader() 
    { 

     $hook_header = Hook::exec('displayHeader'); 
     if ((Configuration::get('PS_CSS_THEME_CACHE') || Configuration::get('PS_JS_THEME_CACHE')) && is_writable(_PS_THEME_DIR_.'cache')) 
      { 
       // CSS compressor management 
       if (Configuration::get('PS_CSS_THEME_CACHE')) 
        $this->css_files = Media::cccCSS($this->css_files); 
        //JS compressor management 
       if (Configuration::get('PS_JS_THEME_CACHE')) 
        $this->js_files = Media::cccJs($this->js_files); 
      } 

     $this->context->smarty->assign(array(
           'meta_title' => 'My title' 
         )); 
    // Call hook before assign of css_files and js_files in order to include correctly all css and javascript files 
     $this->context->smarty->assign(array(
      'HOOK_HEADER'  => $hook_header, 
      'HOOK_TOP'   => Hook::exec('displayTop'), 
      'HOOK_LEFT_COLUMN' => ($this->display_column_left ? Hook::exec('displayLeftColumn') : ''), 
      'HOOK_RIGHT_COLUMN' => ($this->display_column_right ? Hook::exec('displayRightColumn', array('cart' => $this->context->cart)) : ''), 
      'HOOK_FOOTER'  => Hook::exec('displayFooter') 
     )); 

     $this->context->smarty->assign(array(
      'css_files' => $this->css_files, 
      'js_files' => ($this->getLayout() && (bool)Configuration::get('PS_JS_DEFER')) ? array() : $this->js_files, 
      'js_defer' => (bool)Configuration::get('PS_JS_DEFER'), 
      'errors'   => $this->errors, 
      'display_header' => $this->display_header, 
      'display_footer' => $this->display_footer, 
     )); 

     $layout = $this->getLayout(); 
     if ($layout) { 
      if ($this->template) { 
       $template = $this->context->smarty->fetch($this->template); 
       echo 'might be'; 
      } else { 
       // For retrocompatibility with 1.4 controller 

       ob_start(); 
       $this->displayContent(); 
       $template = ob_get_contents(); 
       ob_clean(); 
      } 
      $this->context->smarty->assign('template', $template); 
      $this->smartyOutputContent($layout); 
     } else { 
      Tools::displayAsDeprecated('layout.tpl is missing in your theme directory'); 
      if ($this->display_header) { 
       $this->smartyOutputContent(_PS_THEME_DIR_.'header.tpl'); 
      } 

      if ($this->template) { 
       $this->smartyOutputContent($this->template); 
      } else { // For retrocompatibility with 1.4 controller 
       $this->displayContent(); 
      } 

     } 

    } 

    public function init() 
    { 
     parent::init(); 
    } 

    public function displayContent() 
    { 
     ?> 
     //Start your html content here 

     Your content here 

     //End your htmlcontent here 
     <?php 
    } 

} 
$controller=new ContentPageCutomized(); 
$controller->init(); 
$controller->setMedia(); 
$controller->initHeader(); 
$controller->displayHeader(); 
$controller->initContent(); 
?> 
Смежные вопросы