Problème création d'un menu
xenox45 Membre non connecté
Booster Fronde
-
Booster Fronde
- Voir le profil du membre xenox45
- Inscrit le : 14/03/2010
- Site internet
J'essai actuellement de créer un menu publicité en php.
Le principe du menu est simple, a chaque image est atribuée une valeur, et une fonction génère un chiffre aléatoirement pour savoir quelle image afficher. Ce que j'ai codé est bon, vu que ça fonctionnait très bien sur mon ancien site, le problème c'est que si je passe par l'administration il ne prend pas le php, et si j'utilise l'astuce fournie ici, le php fonctionne mais le menu est placé au-dessus du header.
Je ne sais plus quoi faire
'Voici mon fichier php :
Code :
<?php
/*##################################################
* publicite.php
* -------------------
* begin : November 16, 2008
* copyright : (C) 2008 Monnier Rémy
* email : kona_stinky70@hotmail.fr
*
*
###################################################
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
###################################################*/
function menu_publicite_publicite($position, $block) // On indique le nom du menu que l'on retrouvera dans l'admin/menu/gestion
{
$tpl = new Template('menus/publicite/publicite.tpl'); // On assigne le tpl
import('core/menu_service');
MenuService::assign_positions_conditions($tpl, $block);
return $tpl->parse(TEMPLATE_STRING_MODE);
}
?>et mon fichier tpl :
Code :
<?php
srand();
$rand = rand(0, 5);
switch ($rand)
{
case '0':
echo '<a href="#"><img src="http://localhost/passion_suite_v2/pub_sporehero.jpg" alt="Spore Hero" /></a>';
break;
case '1':
echo '<a href="#"><img src="http://localhost/passion_suite_v2/pub_libre2.jpg"/></a>';
break;
case '2':
echo '<a href="#"><img src="http://localhost/passion_suite_v2/pub_libre2.jpg"/></a>';
break;
case '3':
echo '<a href="#"><img src="http://localhost/passion_suite_v2/pub_libre2.jpg"/></a>';
break;
case '4':
echo '<a href="#"><img src="http://localhost/passion_suite_v2/pub_libre2.jpg"/></a>';
break;
default:
echo '<a href="#"><img src="http://localhost/passion_suite_v2/pub_libre2.jpg"/></a>';
}
?>Si vous pouviez m'aider ça serait surper sympa =)
Merci d'avance !
ReidLos Membre non connecté
-
Modérateur
- Voir le profil du membre ReidLos
- Inscrit le : 27/02/2009
- Site internet
- Groupes :
-
Equipe Développement
Code PHP :
<?php /*################################################## * publicite.php * ------------------- * begin : November 16, 2008 * copyright : (C) 2008 Monnier Rémy * email : kona_stinky70@hotmail.fr * * ################################################### * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ function menu_publicite_publicite($position, $block) // On indique le nom du menu que l'on retrouvera dans l'admin/menu/gestion { $tpl = new Template('menus/publicite/publicite.tpl'); // On assigne le tpl import('core/menu_service'); MenuService::assign_positions_conditions($tpl, $block); srand(); $rand = rand(0, 5); switch ($rand) { case '0': $return_rang = '<a href="#"><img src="http://localhost/passion_suite_v2/pub_sporehero.jpg" alt="Spore Hero" /></a>'; break; case '1' $return_rang = '<a href="#"><img src="http://localhost/passion_suite_v2/pub_libre2.jpg"/></a>'; break; case '2': $return_rang = '<a href="#"><img src="http://localhost/passion_suite_v2/pub_libre2.jpg"/></a>'; break; case '3': $return_rang = '<a href="#"><img src="http://localhost/passion_suite_v2/pub_libre2.jpg"/></a>'; break; case '4': $return_rang = '<a href="#"><img src="http://localhost/passion_suite_v2/pub_libre2.jpg"/></a>'; break; default: $return_rang = '<a href="#"><img src="http://localhost/passion_suite_v2/pub_libre2.jpg"/></a>'; } $tpl->assign_vars(array( 'IMG' => $return_rang )); return $tpl->parse(TEMPLATE_STRING_MODE); } ?>
et le tpl que tu place dans menus/publicite/templates/publicite.tpl
Code TPL :
{IMG}
KONA Membre non connecté
Booster Fusée
-
Booster Fusée
- Voir le profil du membre KONA
- Inscrit le : 21/05/2006
- Site internet
xenox45 Membre non connecté
Booster Fronde
-
Booster Fronde
- Voir le profil du membre xenox45
- Inscrit le : 14/03/2010
- Site internet
Il affiche plus rien, c'est la page blanche ^^"
Et pour mon footer c'est un autre de mes problèmes, et je sais pas comment le régler :
sur cetains navigateurs, notament mozilla, il afiche le début du commentaire, et en plus il met un espace entre le footer et le bas de la page, alors que sous safari rien n'apparait et il n'y a pas d'espace entre le footer et le bas de la page...
ReidLos Membre non connecté
-
Modérateur
- Voir le profil du membre ReidLos
- Inscrit le : 27/02/2009
- Site internet
- Groupes :
-
Equipe Développement
j'en profite :
Code PHP :
<?php /*################################################## * publicite.php * ------------------- * begin : November 16, 2008 * copyright : (C) 2008 Monnier Rémy * email : kona_stinky70@hotmail.fr * * ################################################### * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ function menu_publicite_publicite($position, $block) // On indique le nom du menu que l'on retrouvera dans l'admin/menu/gestion { $tpl = new Template('menus/publicite/publicite.tpl'); // On assigne le tpl import('core/menu_service'); MenuService::assign_positions_conditions($tpl, $block); srand(); $rand = rand(0, 5); switch ($rand) { case '0': $url = '#'; $picture = 'http://localhost/passion_suite_v2/pub_libre2.jpg'; break; case '1': $url = '#'; $picture = 'http://localhost/passion_suite_v2/pub_libre2.jpg'; break; case '2': $url = '#'; $picture = 'http://localhost/passion_suite_v2/pub_libre2.jpg'; break; case '3': $url = '#'; $picture = 'http://localhost/passion_suite_v2/pub_libre2.jpg'; break; case '4': $url = '#'; $picture = 'http://localhost/passion_suite_v2/pub_libre2.jpg'; break; default: $url = '#'; $picture = 'http://localhost/passion_suite_v2/pub_libre2.jpg'; } $tpl->assign_vars(array( 'URL' => $url, 'PICTURE' => $picture )); return $tpl->parse(TEMPLATE_STRING_MODE); }
et le tpl :
xenox45 Membre non connecté
Booster Fronde
-
Booster Fronde
- Voir le profil du membre xenox45
- Inscrit le : 14/03/2010
- Site internet
Problème réglé !
ReidLos Membre non connecté
-
Modérateur
- Voir le profil du membre ReidLos
- Inscrit le : 27/02/2009
- Site internet
- Groupes :
-
Equipe Développement
xenox45 Membre non connecté
Booster Fronde
-
Booster Fronde
- Voir le profil du membre xenox45
- Inscrit le : 14/03/2010
- Site internet
Si ça peut aider voici mon footer.tpl (une fois les balises commentaire enlevées) :
Code :
</div>
# IF C_MENUS_BOTTOM_CENTRAL_CONTENT #
<div id="bottom_contents">
{MENUS_BOTTOMCENTRAL_CONTENT}
</div>
# ENDIF #
</div>
# IF C_MENUS_TOP_FOOTER_CONTENT #
<div id="top_footer">
{MENUS_TOP_FOOTER_CONTENT}
<div class="spacer"></div>
</div>
# ENDIF #
</div>
<div id="footer">
<span>
Site créé par <a style="font-size:10px" href="http://www.passion-suite.fr/xenox45.php" alt="xenox45">xenox45</a>
</span>
<span>
| <a style="font-size:10px" href="http://www.passion-suite.fr/pages/pages.php?title=mentions-legales" alt="Mentions légales">Mentions légales</a>
</span>
<span>
| {L_POWERED_BY} <a style="font-size:10px" href="http://www.phpboost.com" title="PHPBoost">PHPBoost {PHPBOOST_VERSION}</a> {L_PHPBOOST_RIGHT}
</span>
<span>
| Design by <a style="font-size:10px" href="http://chez-swan.net/" alt="Swan">Swan</a>
</span>
# IF C_DISPLAY_BENCH #
<span>
|
{L_ACHIEVED} {BENCH}{L_UNIT_SECOND} - {REQ} {L_REQ}
</span>
# ENDIF #
# IF C_DISPLAY_AUTHOR_THEME #
<span>
| {L_THEME} {L_THEME_NAME} {L_BY} <a href="{U_THEME_AUTHOR_LINK}" style="font-size:10px;">{L_THEME_AUTHOR}</a>
</span>
# ENDIF #
</div>
</body>
</html>Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie

