Jump to content

affichage liste des cadeaux dans le fichier tpl


Recommended Posts

bonjour,j' créer une table dans la base de données cadeaux et je veux récupérer la liste des attribut de ce table dans le fichier tpl.

fichier contrôleur

<?php

 

class ListeCadeauxControllerCore extends FrontController

{

 

public $auth = true;

public $php_self = 'listecadeaux';

public $authRedirection = 'listecadeaux';

public $ssl = true;

 

 

public function init()

{

parent::init();

$this->cadeaux = $this->context->cadeaux;

}

 

public function initContent()

{

parent::initContent();

$this->context->smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);

$this->setTemplate(_PS_THEME_DIR_.'listecadeaux.tpl');

}

 

public function postProcess()

{

$results = Db::getInstance()->ExecuteS('

SELECT *

FROM `'._DB_PREFIX_.'cadeaux`');

 

foreach ( $results as $r )

{

echo $r ['email'];echo "<br/>";

echo $r ['code'];echo "<br/>";

echo $r ['date'];echo "<br/>";

}

}

 

 

public function setMedia()

{

parent::setMedia();

$this->addCSS(_THEME_CSS_DIR_.'listecadeaux.css');

}

 

 

}

?>

 

fichier tpl

 

 

{capture name=path}<a href="{$link->getPageLink('my-account', true)}">{l s='My account'}</a>

<span class="navigation-pipe">{$navigationPipe}</span>

<a href="{$link->getPageLink('cadeaux', true)}">{l s='Tes Cadeaux'}</a>

<span class="navigation-pipe">{$navigationPipe}</span>{l s='Listes des Cadeaux Offert'}{/capture}

{include file="$tpl_dir./breadcrumb.tpl"}

 

<h1>Listes Cadeaux offert</h1>

{include file="$tpl_dir./errors.tpl"}

 

 

{foreach from=$cadeaux.code item=code name=code}

{$code}

{/foreach}

 

 

merci d avance.

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...