pb affichage smiley

Répondre
jojopareto
le 02/06/2009 à 06:37
jojopareto
Bonjour, j'essaye de mettre un forum sur mon site et j'ai un problème avec les smileys.
J'ai télécharger csforum car je peux lui donner la même apparence que mon site, par contre quand je fais glisser un smiley dans la zone de texte il m'écrit javascript:actions(":-Q"). Quand je le publie il m'écrit juste javascript:action et me fait apparaitre le smiley entre parenthèses. Pouvez vous m'aider! Attention je suis novice en PHP/Mysql/Java. Voici mon code
<script language="JavaScript" type="text/javascript">
<!--

function actions(text) {
text = ' ' + text + '';
if (document.post.message.createTextRange && document.post.message.caretPos) {
var caretPos = document.post.message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + '' : text;
document.post.message.focus();
} else {
document.post.message.value += text;
document.post.message.focus();
}
}
function url(text) {
var autre = prompt("<?=LG_URL_A_METTRE?> :","http://");
text = ' ' + text + autre + '[/url]';
if (document.post.message.createTextRange && document.post.message.caretPos) {
var caretPos = document.post.message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + '' : text;
document.post.message.focus();
} else {
document.post.message.value += text;
document.post.message.focus();
}
}
function email(text) {
var autre = prompt("<?=LG_EMAIL_A_METTRE?>:","");
text = ' ' + text + autre + '[/email]';
if (document.post.message.createTextRange && document.post.message.caretPos) {
var caretPos = document.post.message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + '' : text;
document.post.message.focus();
} else {
document.post.message.value += text;
document.post.message.focus();
}
}
function gras(text) {
var autre = prompt("<?=LG_TEXTE_GRAS?>:","");
text = ' ' + text + autre + '[/b]';
if (document.post.message.createTextRange && document.post.message.caretPos) {
var caretPos = document.post.message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + '' : text;
document.post.message.focus();
} else {
document.post.message.value += text;
document.post.message.focus();
}
}
function souligne(text) {
var autre = prompt("<?=LG_TEXTE_SOULIGNER?>:","");
text = ' ' + text + autre + '[/u]';
if (document.post.message.createTextRange && document.post.message.caretPos) {
var caretPos = document.post.message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + '' : text;
document.post.message.focus();
} else {
document.post.message.value += text;
document.post.message.focus();
}
}
function italique(text) {
var autre = prompt("<?=LG_TEXTE_ITALIQUE?>:","");
text = ' ' + text + autre + '[/i]';
if (document.post.message.createTextRange && document.post.message.caretPos) {
var caretPos = document.post.message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + '' : text;
document.post.message.focus();
} else {
document.post.message.value += text;
document.post.message.focus();
}
}

//-->
</script>


<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<?
for ($i = 0; $i < count($souriez); $i++) {
$sizeImg = GetImageSize("images/smileys/".$souriez[$i][1]);
echo "<a href='javascript:actions(\"".$souriez[$i][0]."\")'>";
echo "<img src=\"images/smileys/".$souriez[$i][1]."\" ".$sizeImg[3]." border=\"0\" alt=\"".$souriez[$i][2]."\">";
}
?>
</td>
</tr>
</table>
<br>
<b> |
<a class="minilien" href="javascript:url('[url]')"><?=LG_URL?></a> |
<a class="minilien" href="javascript:email('[email]')"><?=LG_MAIL?></a> |
<a class="minilien" href="javascript:gras('[b]')"><?=LG_GRAS?></a> |
<a class="minilien" href="javascript:italique('[i]')"><?=LG_ITALIQUE?></a> |
<a class="minilien" href="javascript:souligne('[u]')"><?=LG_SOULIGNE?></a> |
</b>


Merci d'avance
Jojopareto
vengeur002
le 02/06/2009 à 11:01
vengeur002
Salut

tu ne nous met pas le code d'insertion de smiley dans le champ txt.

on ne peux donc rien faire pour toi
LA GLOBULE
le 02/06/2009 à 11:21
LA GLOBULE
Si il y est :)

Que contient ta variable $souriez[$i][0] ? (car c'est son contenu que le javascript écrit dans la zone de texte).
jojopareto
le 02/06/2009 à 13:37
jojopareto
je pense que c'est ça ma variable souriez
<?
$souriez[] = array("Z:-)", "diable.gif", LG_DIABLOTIN);
$souriez[] = array(":-Q", "fume.gif", LG_FUMEUR);
$souriez[] = array(":-))", "bigsourire.gif", LG_GROS_SOURIRE);
$souriez[] = array(":)", "sourire.gif", LG_SOURIRE);
$souriez[] = array(":(", "decu.gif", LG_DECU);
$souriez[] = array(";-)", "clin.gif", LG_CLIN_OEIL);
$souriez[] = array("X-(", "couteau.gif", LG_COUTEAU_DANS_LA_TETE);
$souriez[] = array(":o)", "debile.gif", LG_DEBILE);
$souriez[] = array(":-((", "grrr.gif", LG_RAIMENT_PAS_CONTENT);
$souriez[] = array("8-)", "hallucine.gif", LG_HALLUCINE);
$souriez[] = array("<img src="https://static.lephpfacile.com/img/smiley/icon_confused.gif" alt="smiley" class="smiley" />", "heu.gif", LG_HESITE);
$souriez[] = array(":-p", "langue.gif", LG_TIRE_LA_LANGUE);
$souriez[] = array(":-o", "oh.gif", LG_OH);
$souriez[] = array(":-@", "perdu.gif", LG_PERDU);
$souriez[] = array(";-(", "pleure.gif", LG_PLEURE);
$souriez[] = array("B-)", "tropcool.gif", LG_TROP_COOL);
$souriez[] = array(":-)", "sourire.gif", LG_SOURIS);
$souriez[] = array(":-(", "decu.gif", LG_DECU);
$souriez[] = array(":fuck:", "fuck.gif", LG_FUCK_IT);
$souriez[] = array("8o)", "clown.gif", LG_LE_CLOWN);
$souriez[] = array(":-D", "bigsourire.gif", LG_GROS_SOURIRE);

/* ============================================================================================ */
/* ================================= NE PAS MODIFIER EN DESSOUS ============================== */
/* ============================================================================================ */

function souriez($chaine_texte) {
global $souriez;
for ($i = 0; $i < count($souriez); $i++) {
$sizeImg = GetImageSize("images/smileys/".$souriez[$i][1]);
$chaineImage = '<img src="images/smileys/'.$souriez[$i][1].'" '.$sizeImg[3].' border="0" alt="'.$souriez[$i][2].'">';
$chaine_texte = str_replace($souriez[$i][0], $chaineImage, $chaine_texte);
}
return $chaine_texte;
}

?>
Jojopareto
LA GLOBULE
le 02/06/2009 à 13:51
LA GLOBULE
Ah mais attend, pourquoi "glisses" tu le smiley dans la zone de texte ? (la, je pense que ton navigateur copie colle le href du lien en faisant cela).

En fait, il faut cliquer sur le smiley pour insérer le code du smiley dans la zone de texte.
jojopareto
le 02/06/2009 à 13:56
jojopareto
Effectivement ça bien comme ça.
Et dis donc j'ai un autre pb. Quand je clique sur poster, je reste sur la page ou j'ai écris mon message. Moi e voudrais revenir à la page index du forum. Comment faire?
Jojopareto
jojopareto
le 02/06/2009 à 14:14
jojopareto
Merci de tes réponses rapides et efficaces. Pour le moment j'ai plus de questions. Merci
Jojopareto
jojopareto
le 02/06/2009 à 16:35
jojopareto
Nouveau pb.
la fonction header me renvoi cette erreur.
Warning: Cannot modify header information - headers already sent by (output started at /home/auplaisirdedecouvrir/html/csforum/index.php:1) in /home/auplaisirdedecouvrir/html/csforum/index.php on line 45
voici le code
<?php
/* ----- Mise à jour du cookie ---- */

if(isset($_GET["readall"])) { /* Marque comme tous lus */
setcookie("CSForum_ReadAll",time(),time()+86400*365,"/",$_SERVER["SERVER_NAME"]); /* expire dans 1AN */
header("Location: $UrlSite/$folderForum");
}

if(isset($_GET["collapse"])) {
if(intval($_GET["collapse"])==1) { /* cookies pour afficher ou non l'arbre */
setcookie("CSForum_collapse",intval($_GET["collapse"]),time()+86400*365,"/",$_SERVER["SERVER_NAME"]);
header("Location: $UrlSite/$folderForum");
} else unset($_COOKIE["CSForum_collapse"]);
}
?>
Jojopareto
Répondre
LoadingChargement en cours