Jump to content


Photo

Como O Php Aceitar Códigos Html?


  • Faça o login para participar
10 replies to this topic

#1 Sir Curse

Sir Curse

    Normal

  • Usuários
  • 113 posts
  • Sexo:Não informado
  • Localidade:São Paulo
  • Interesses:Linguagens em geral

Posted 06/11/2003, 14:26

Eu to procurando algum cógido pra adicionar na pagina em PHP que faça aceitar códigos como <B> Negrito </B>, códigos HTML, o que tenho aceita apenas códigos PHP negrito ..

entenderam?

#2 Sir Curse

Sir Curse

    Normal

  • Usuários
  • 113 posts
  • Sexo:Não informado
  • Localidade:São Paulo
  • Interesses:Linguagens em geral

Posted 06/11/2003, 14:28

viu? ele formato tags assim "[b]"

Edição feita por: Sir Curse, 06/11/2003, 14:28.


#3 goiaba2000

goiaba2000

    Tô com sono!

  • Usuários
  • 1118 posts
  • Sexo:Não informado
  • Localidade:Sobradinho-DF

Posted 06/11/2003, 14:29

oxi?!?! :wacko: como assim???

ahh... faz substr() pra trocar [b] por <b>
PHP + UML + OO + Flash + MySQL = IMBATIVEL

http://www.guilardi.com.br
- portifólio
http://www.deusehmais.com.br
- projeto atual

#4 Sir Curse

Sir Curse

    Normal

  • Usuários
  • 113 posts
  • Sexo:Não informado
  • Localidade:São Paulo
  • Interesses:Linguagens em geral

Posted 06/11/2003, 14:31

mas eu num sei fazer issu... :S

#5 goiaba2000

goiaba2000

    Tô com sono!

  • Usuários
  • 1118 posts
  • Sexo:Não informado
  • Localidade:Sobradinho-DF

Posted 06/11/2003, 14:34

melhor que substr():
$mensagem = str_replace("[b]","<b>",$mensagem);

PHP + UML + OO + Flash + MySQL = IMBATIVEL

http://www.guilardi.com.br
- portifólio
http://www.deusehmais.com.br
- projeto atual

#6 Guest

Guest
  • Visitantes

Posted 06/11/2003, 15:32

cara o PHP aceita códigos HTML incorporados no code PHP. Para colocar uma frase em negrito, faça o seguinte:

echo "A palavra <b>PHP</b> está em negrito!";

Pronto, a palavra PHP irá aparecer em negrito no seu browser.
Tem também o <i> para itálico. Qualquer dúvida poste ai brother. Falous.

#7 Guest

Guest
  • Visitantes

Posted 06/11/2003, 15:33

cara o PHP aceita códigos HTML incorporados no code PHP. Para colocar uma frase em negrito, faça o seguinte:

echo "A palavra <b>PHP</b> está em negrito!";

Pronto, a palavra PHP irá aparecer em negrito no seu browser.
Tem também o <i> para itálico. Qualquer dúvida poste ai brother. Falous.

ISSO MESMO CARA, ESSE GOIABA EH BIRUTA... IMAGINA AS APLICAÇÔES DELE, DEVE SER MUITOOOOOOO POLUIDAS> HAHAHHA

#8 Balala

Balala

    What you want for yourself?

  • Ex-Admins
  • 3357 posts
  • Sexo:Não informado
  • Localidade:Jaraguá do Sul - SC
  • Interesses:http://forum.wmonline.com.br/index.php?showtopic=5792

Posted 06/11/2003, 15:37

Voce faz como o goiaba2000 falou, para todos os codigos que deseja alterar:

<?
$mensagem = "[b]OLA[/b]"; //mensagem antes do replace

$mensagem = str_replace("[b]","<b>",$mensagem);
$mensagem = str_replace("[/b]","</b>",$mensagem);

echo $mensagem; //<b>OLA</b>
?>

Balala - Admin Geral Webfórum - Retired
Twitter
Stop Spreading Lies!
Posted Image

#9 Sir Curse

Sir Curse

    Normal

  • Usuários
  • 113 posts
  • Sexo:Não informado
  • Localidade:São Paulo
  • Interesses:Linguagens em geral

Posted 07/11/2003, 01:14

vejam, esse é o código que permite bbCode no meu script:

function bbcode($text) {
	$text = ereg_replace("\n", "<br />", $text);

$text = eregi_replace("\\[color=([^\\[]*)\\]([^\\[]*)\\[/color\\]","<font color=\"\\1\">\\2</font>",$text);
$text = eregi_replace("\\[size=([^\\[]*)\\]([^\\[]*)\\[/size\\]","<font size=\"\\1\">\\2</font>",$text);
$text = eregi_replace("\\[font=([^\\[]*)\\]([^\\[]*)\\[/font\\]","<font face=\"\\1\">\\2</font>",$text);
$text = eregi_replace("\\[img height=([^\\[]*)\\ width=([^\\[]*)\\]([^\\[]*)\\[/img\\]","<img src=\"\\3\" height=\"\\1\" width=\"\\2\">",$text);
$text = eregi_replace("\\[img width=([^\\[]*)\\ height=([^\\[]*)\\]([^\\[]*)\\[/img\\]","<img src=\"\\3\" width=\"\\1\" height=\"\\2\">",$text);
$text = eregi_replace("\\[img]([^\\[]*)\\[/img\\]","<img src=\"\\1\">",$text);
$text = eregi_replace("\\[flash=([^\\[]*)\\,([^\\[]*)\\]([^\\[]*)\\[/flash\\]","<object classid=\"clsid: D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\\1 height=\\2><param name=movie value=\\3><param name=play value=true><param name=loop value=true><param name=quality value=high><embed src=\\3 width=\\1 height=\\2 play=true loop=true quality=high></embed></object>",$text);
$text = eregi_replace("\\[align=([^\\[]*)\\]([^\\[]*)\\[/align\\]","<p align=\"\\1\">\\2</p>",$text);
$text = eregi_replace("\\[shadow=([^\\[]*)\\,([^\\[]*)\\,([^\\[]*)\\]([^\\[]*)\\[/shadow\\]","<font style=\"Filter: Shadow(color=\\1, Direction=\\2); Width=\\3px;\">\\4</font>",$text);
$text = eregi_replace("\\[glow=([^\\[]*)\\,([^\\[]*)\\,([^\\[]*)\\]([^\\[]*)\\[/glow\\]","<font style=\"Filter: Glow(color=\\1, Strength=\\2); Width=\\3px;\">\\4</font>",$text);
$text = str_replace("[move]", "<marquee>", $text);
$text = str_replace("[/move]", "</marquee>", $text);
$text = str_replace("[hr]", "<hr>", $text);
$text = str_replace("[sub]", "<sub>", $text);
$text = str_replace("[/sub]", "</sub>", $text);
$text = str_replace("[tt]", "<tt>", $text);
$text = str_replace("[/tt]", "</tt>", $text);
$text = str_replace("[sup]", "<sup>", $text);
$text = str_replace("[/sup]", "</sup>", $text);
$text = str_replace("[s]", "<s>", $text);
$text = str_replace("[/s]", "</s>", $text);
$text = str_replace("[b]", "<b>", $text);
$text = str_replace("[/b]", "</b>", $text);
$text = str_replace("[i]", "<i>", $text);
$text = str_replace("[/i]", "</i>", $text);
$text = str_replace("[u]", "<u>", $text);
$text = str_replace("[/u]", "</u>", $text);
$text = str_replace("[*]", "<li>", $text);
$text = str_replace("[LIST]", "<ul>", $text);
$text = str_replace("
[/LIST]", "</ul>", $text);
$text = eregi_replace("\\[email\\]([^\\[]*)\\[/email\\]", "<a href=\"mailto:\\1\">\\1</a>",$text);
$text = eregi_replace("\\[email=([^\\[]*)\\]([^\\[]*)\\[/email\\]", "<a href=\"mailto:\\1\">\\2</a>",$text);
$text = str_replace("[QUOTE]", "<blockquote><span class=\"12px\">quote:</span><hr>", $text);
$text = str_replace("[/QUOTE]", "<hr></blockquote>", $text);
$text = str_replace("[CODE]","<blockquote><pre>",$text);
$text = str_replace("/CODE]","</pre></blockquote>",$text);
$text = eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]", "<a href=\"http://www.\\1\" target=_blank>\\1</a>",$text);
$text = eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\1</a>",$text);
$text = eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\2</a>",$text);
$text = eregi_replace("(^|[>[:space:]\n])([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])([<[:space:]\n]|$)","\\1<a href=\"\\2://\\3\\4\" target=\"_blank\">\\2://\\3\\4</a>\\5", $text);
$text = str_replace(":):", "<img src=\"admin/smileys/_feliz.gif\">", $text);
$text = str_replace(":D:", "<img src=\"admin/smileys/_sorrindo.gif\">", $text);
$text = str_replace(":/:", "<img src=\"admin/smileys/_bravo.gif\">", $text);
$text = str_replace(":P:", "<img src=\"admin/smileys/_lingua.gif\">", $text);
$text = str_replace("^^&acute;:", "<img src=\"admin/smileys/_burrada.gif\">", $text);
$text = str_replace("^^:", "<img src=\"admin/smileys/_hehe.gif\">", $text);
$text = str_replace("¬¬&acute;:", "<img src=\"admin/smileys/_acredito.gif\">", $text);
$text = str_replace(":?:", "<img src=\"admin/smileys/_huh.gif\">", $text);
$text = str_replace("°°:", "<img src=\"admin/smileys/_numfoieu.gif\">", $text);
$text = str_replace("&acute;&acute;:", "<img src=\"admin/smileys/_poxa.gif\">", $text);
$text = str_replace(":(:", "<img src=\"admin/smileys/_triste.gif\">", $text);
$text = str_replace(":O:", "<img src=\"admin/smileys/_ohhh.gif\">", $text);
$text = str_replace("^-:", "<img src=\"admin/smileys/_piscando.gif\">", $text);
$text = str_replace(":Z:", "<img src=\"admin/smileys/_sono.gif\">", $text);
$text = str_replace(":A:", "<img src=\"admin/smileys/_apaixonado.gif\">", $text);
$text = str_replace("`&acute;:", "<img src=\"admin/smileys/_nervoso.gif\">", $text);
return $text;
}

function cleanstring($text) {
	$text = ereg_replace("[\x27]","'",trim($text));
	$text = ereg_replace("[\x22]","&quot;",trim($text));
	strip_tags($text);
	$text = ereg_replace(">","&gt;",$text);
	$text = ereg_replace("<","&lt;",$text);
	//$text = ereg_replace("\<b\>|\</b\>|\<i\>|\</i\>|\<u\>|\</u\>|\<img\>|\</img\>|\<quote\>|\</quote\>|\<email\>|\</email\>|\<url\>|\</url\>","", $text);
	$text = preg_replace("[\x5c\]","",$text);
	return $text;
}

eu ja tentei modificar do jeito qu vcs falaram e naum funciono...
o que eu poço fazer?

Edição feita por: Sir Curse, 07/11/2003, 01:16.


#10 Miguceamma

Miguceamma

    MiguPenjisse

  • Usuários
  • 13201 posts

Posted 26/10/2017, 16:31

Zithromax For Gastric Emptying Cephalexin Interactions With Celexa viagra Perret Generic Amoxil Sedanafil For Sale
Avis Cialis 20 viagra Rogaine Men Over 50 Viagra Comparison Levitra Tadalis Sx Quick Ejaculation
Cheap Nexium 40 Mg viagra Online Pharmach Clomid Over The Counter Priligy Da 30 O 60

#11 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 26/10/2017, 22:15

Buy Clozapine No Prescription viagra Cialis Frequenza Assunzione
Amoxicillin Common Side Effects Uses Vardenafil Levitra Gunstigster Preis viagra Order Effexor Xr Viagra Y Cialis Juntos
Precios De Cialis Cialis Paypal France viagra Propecia Topical Purchase Doxycycline Without Rx




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq