[TYPO3-UG France] Extension pi2 à paramètrer en TS .... pas de recup des param
DUCREUX Thierry
thierry.ducreux at cndp.fr
Fri Jun 10 11:02:47 CEST 2011
Bonjour,
J'ai une extension tx_cndpsolr_pi2 appelée par TS et je voudrais lui passer un paramètre par TS
Visiblement on le récupère dans $conf mais je n'ai rien. Pouvez-vous m'aider svp ?
************************************************************
Ts :
marks.moteur_recherche < plugin.tx_cndpsolr_pi2
plugin.tx_cndpsolr_pi2.id_page_resultat2 = 15
************************************************************
Visiblement il doit être contenu dans $conf mais il n'y a que :
includeLibs : typo3conf/ext/cndp_solr/pi2/class.tx_cndpsolr_pi2.php
userFunc : tx_cndpsolr_pi2->main
************************************************************
Le fichier ext_localconf :
<?php
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
}
t3lib_extMgm::addPItoST43($_EXTKEY, 'pi1/class.tx_cndpsolr_pi1.php', '_pi1', 'list_type', 1);
t3lib_extMgm::addPItoST43($_EXTKEY, 'pi2/class.tx_cndpsolr_pi2.php', '_pi2', 'list_type', 1);
?>
************************************************************
Le fichier class.tx_cndpsolr_pi2 :
class tx_cndpsolr_pi2 extends tslib_pibase {
var $prefixId = 'tx_cndpsolr_pi2'; // Same as class name
var $scriptRelPath = 'pi2/class.tx_cndpsolr_pi2.php'; // Path to this script relative to the extension dir.
var $extKey = 'cndp_solr'; // The extension key.
var $pi_checkCHash = true;
protected $config; // parametre passes par le plugin
protected $template;
private $nbElementsParPage=10;
private $pageCourante=0;
/**
* The main method of the PlugIn
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
* @return The content that is displayed on the website
*/
function main($content, $conf) {
$this->conf = $conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
// Charge le flexform du plugin s'il en existe un
$this->config = T3f_Config::getArrayConfig($this);
// recup id de la page des resultats
$id_page_resultat = $this->conf['id_page_resultat'];
$content.="<br/>Id : ".$id_page_resultat.'<br>';
// Formulaire de Recherche
$content.='<form name="formRechercher" action="'.$this->pi_linkTP_keepPIvars_url(array(),0,0,$id_page_resultat).'" method="POST">';
$content.='<input type="text" name="'.$this->prefixId.'[motsRecherches]" value="'.htmlspecialchars($this->piVars['motsRecherches']).'">';
$content.='<input type="submit" name="'.$this->prefixId.'[submit_recherche]" value="Rechercher">';
$content.='<input type="hidden" id="pageCourante" name="'.$this->prefixId.'[pageCourante]" value="'.$this->pageCourante.'"/>';
$content.='<input type="hidden" id="nbElementsParPage" name="'.$this->prefixId.'[nbElementsParPage]" value="'.$this->nbElementsParPage.'"/>';
$content.='</form><br><br><br><br><br><br>';
foreach ($conf as $key => $ligne) {
$content.= "<br>".$key." : ".$ligne;
}
return $this->pi_wrapInBaseClass($content);
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cndp_solr/pi1/class.tx_cndpsolr_pi1.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cndp_solr/pi1/class.tx_cndpsolr_pi1.php']);
}
More information about the TYPO3-france
mailing list