News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Autoriser HTML dans un champs

Started by essential, October 09, 2004, 07:20:38 PM

Previous topic - Next topic

essential

Salut a tous !

Avec le tutorial de Unknown sur comment rajouter des champs sur la page du profil, j'ai donc rajouter un champs "Description" (que j'ai converti en textarea). Mais le truc, c'est que je voudrais que le HTML soit possible dans ce champs (comme la signature).

Est-ce possible ?

Meriadoc

est-ce que tu voudrais d'HTML ou de BBC?


[edit]oui, c'est possible :)[/edit]
If I know the way home and am walking along it drunkenly, is it any less the right way because I am staggering from side to side? : Leo Tolstoy
Everything I know I learned from Calvin and Hobbes.
And patience is about the most useful thing you could ever have.  That and backups. : [Unknown]
If I choose to send thee, Tuor son of Huor, then believe not that thy one sword is not worth the sending. : Ulmo, Lord of the Waters - Unfinished Tales, by J.R.R. Tolkien

essential


Meriadoc

tu voudrais utiliser le function preparsecode()
peut-tu mettre les lignes que tu ajoute dans profile.php? en regarde, je peut t'aider plus :)
If I know the way home and am walking along it drunkenly, is it any less the right way because I am staggering from side to side? : Leo Tolstoy
Everything I know I learned from Calvin and Hobbes.
And patience is about the most useful thing you could ever have.  That and backups. : [Unknown]
If I choose to send thee, Tuor son of Huor, then believe not that thy one sword is not worth the sending. : Ulmo, Lord of the Waters - Unfinished Tales, by J.R.R. Tolkien

essential

Merci beaucoup ! Tiens voila le bout de code:

if (!isset($context['member']['options']['description']))
          $context['member']['options']['description'] = '';
     echo '<textarea ROwS="5" COLS="50" NAME="default_options[description]" wrap="on">' . $context['member']['options']['description']  . '</textarea>
     </td>
</tr>';

Si il te faut plus de code dis-moi  ;)

Meriadoc

euh, oui, désolé, j'ai besoin de la parte où l'information est mit dans la base à donnée.
juste attache la fichier, c'est plus simple.
If I know the way home and am walking along it drunkenly, is it any less the right way because I am staggering from side to side? : Leo Tolstoy
Everything I know I learned from Calvin and Hobbes.
And patience is about the most useful thing you could ever have.  That and backups. : [Unknown]
If I choose to send thee, Tuor son of Huor, then believe not that thy one sword is not worth the sending. : Ulmo, Lord of the Waters - Unfinished Tales, by J.R.R. Tolkien

essential

I can't attach a file. But I hosted the zip file with profile.php and profile.template.php.
here's the link: http://www.stemcellstudies.com/profiles.zip [nofollow]

Meriadoc

#7
je ne sais pas que ce marche. tu as le champs dans la basse a donnee?
essaye ca en profile.php
cherche:
// Make sure the signature isn't too long.
if (isset($_POST['signature']))
{
require_once($sourcedir . '/Subs-Post.php');

$unparsed_signature = strtr(un_htmlspecialchars($_POST['signature']), array("\r" => ''));
if (!empty($modSettings['max_signatureLength']) && strlen($unparsed_signature) > $modSettings['max_signatureLength'])
$_POST['signature'] = htmlspecialchars(substr($unparsed_signature, 0, $modSettings['max_signatureLength']), ENT_QUOTES);
preparsecode($_POST['signature']);
}


ajoute apres

// Parse for BBC tags in added field
if (isset($_POST['default_options']['description']))
{
require_once($sourcedir . '/Subs-Post.php');

$unparsed_description = strtr(un_htmlspecialchars($_POST['default_options']['description']), array("\r" => ''));
$_POST['default_options']['description'] = htmlspecialchars($unparsed_description), ENT_QUOTES);
preparsecode($_POST['default_options']['description']);
}


:-\
If I know the way home and am walking along it drunkenly, is it any less the right way because I am staggering from side to side? : Leo Tolstoy
Everything I know I learned from Calvin and Hobbes.
And patience is about the most useful thing you could ever have.  That and backups. : [Unknown]
If I choose to send thee, Tuor son of Huor, then believe not that thy one sword is not worth the sending. : Ulmo, Lord of the Waters - Unfinished Tales, by J.R.R. Tolkien

essential

nope ca marche pas. J'obtiens un blank screen  :-[

Meriadoc

#9
tu as un champs dans la base à donnée pour le reçois, ce neuveau champs 'description' oui?

éssaye ça: en addition de les ligne en haut, changes les lignes:

$profile_strings = array(
'websiteUrl', 'websiteTitle',
'MSN', 'AIM', 'YIM',
'location', 'birthdate',
'timeFormat',
'im_ignore_list',
'smileySet',
'signature', 'personalText', 'avatar',
);

avec

$profile_strings = array(
'websiteUrl', 'websiteTitle',
'MSN', 'AIM', 'YIM',
'location', 'birthdate',
'timeFormat',
'im_ignore_list',
'smileySet',
                'default_options[description]',
'signature', 'personalText', 'avatar',
);


:-\

je ne suis pas sûr comme l'ajouter des champs marche...
tu parle anglais oui? et tu demande à [Unknown] comment ce fait, si les lignes en haut ne marche pas, lui demande.

-Merry
If I know the way home and am walking along it drunkenly, is it any less the right way because I am staggering from side to side? : Leo Tolstoy
Everything I know I learned from Calvin and Hobbes.
And patience is about the most useful thing you could ever have.  That and backups. : [Unknown]
If I choose to send thee, Tuor son of Huor, then believe not that thy one sword is not worth the sending. : Ulmo, Lord of the Waters - Unfinished Tales, by J.R.R. Tolkien

[Unknown]

No, that's not neccessary.  Instead of:

if (isset($_POST['default_options[description]']))

Use:

if (isset($_POST['default_options']['description']))

And the same change elsewhere.

-[Unknown]

Meriadoc

#11
ah, thanks for catching that array mistake.
are you saying the $profile_strings change is unneccessary?

*edited the previous code blocks | j'ai corrigé les lignes précédent.
If I know the way home and am walking along it drunkenly, is it any less the right way because I am staggering from side to side? : Leo Tolstoy
Everything I know I learned from Calvin and Hobbes.
And patience is about the most useful thing you could ever have.  That and backups. : [Unknown]
If I choose to send thee, Tuor son of Huor, then believe not that thy one sword is not worth the sending. : Ulmo, Lord of the Waters - Unfinished Tales, by J.R.R. Tolkien

[Unknown]

It has what it needs to have in it already... it shouldn't need anything changed or added to it.

-[Unknown]

essential

C'est pas grave. Comme la signature n'est pas des plus utiles sur mon site, j'ai juste remplacer la signature par la description.  ;)

Meriadoc

euh... d'accord, si ça marche, ça marche!
tu removes le champs ou tu le mis à '-1'?
If I know the way home and am walking along it drunkenly, is it any less the right way because I am staggering from side to side? : Leo Tolstoy
Everything I know I learned from Calvin and Hobbes.
And patience is about the most useful thing you could ever have.  That and backups. : [Unknown]
If I choose to send thee, Tuor son of Huor, then believe not that thy one sword is not worth the sending. : Ulmo, Lord of the Waters - Unfinished Tales, by J.R.R. Tolkien

essential

I just rename the signature title by "Description" in the profile.template.php but it actually records it as the signature in the database.
And then I removed the signature area in the profile.php

Désolé pour ceux qui ne comprennent pas l'anglais...

Advertisement: