Jump to content

Problème affichage page perso non CMS


Recommended Posts

Bonjour à tous,

 

J'ai besoin au sein de ma boutique de créer une page totalement personnalisée et qui est capable d'interpréter du code PHP. Les pages CMS ne suffisent donc pas et je dois créer une page unique. Pour se faire, j'ai suivi différents tuto et suis parvenu à créer et afficher ma page. J'ai donc créer 3 fichiers : 

  • /mapage.php
  • /theme/montheme/mapage.tpl
  • /controllers/front/MapageController.php

Ces pages contiennent : 

mapage.php :

<?php 

  include(dirname(__FILE__).'/config/config.inc.php');
  Tools::displayFileAsDeprecated();
 
  Controller::getController('MapageController')->run();
  $smarty->display(_PS_THEME_DIR_.'mapage.tpl'); 
  
?>

mapage.tpl 

<img src="/img/cms/ban212.jpg">

<iframe frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="urlmoniframe" width="360" height="260"></iframe>


MapageController.php 

<?php
  /*  Create a custom page in PrestaShop without CMS - CustomPageController class
  /*  Read the detailed tutorial at https://iftakharhasan.wordpress.com/prestashop-create-a-custom-page-without-cms
   */
 
  /*  The classname here will be the name of the controller  */
  class MapageController extends FrontController{
 
    public function init(){
      parent::init();
    }
     
    public function initContent(){
      parent::initContent();
      $this->setTemplate(_PS_THEME_DIR_.'mapage.tpl');
    }
 
  /*  The following code portion is optional.
  /*  Remove the double-slashes to activate the portion
  /*  if you want to use external stylesheet and JavaScript for the page.
  /*  Create the CSS and JS files in the css and js directories of the theme accordingly
   */
   
    public function setMedia(){
      parent::setMedia();
      $this->addCSS(_THEME_CSS_DIR_.'custom-page.css');
      //$this->addJS(_THEME_JS_DIR_.'custom-page.js');
    }
}

Ma page s'affiche donc bien sur /mapage.php en revanche, le contenu est dupliqué sous le footer... C'est à dire qu'il s'affiche bel et bien dans le contenu (entre les balises body) et en plus, une seconde fois, sous footer. 

 

Des idées pour résoudre ce double affichage ? 

 

D'avance merci :)

Nicolas.

Edited by NCMarketing (see edit history)
Link to comment
Share on other sites

Ben normal... vous appelez 2 fois l'affichage :D

 $smarty->display(_PS_THEME_DIR_.'mapage.tpl');

et pour info, Tools::displayFileAsDeprecated(); ne vous sert à rien^^

 

Donc mapage.php se résume à:

<?php 

  include(dirname(__FILE__).'/config/config.inc.php');
  Controller::getController('MapageController')->run();
  
?>

Si vous avez besoin d'un controller ou à

<?php 

  include(dirname(__FILE__).'/config/config.inc.php');
  $smarty->display(_PS_THEME_DIR_.'mapage.tpl'); 
  
?>

Si vous avez juste à afficher une page statique

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...