Abdullah 37 Posted May 17, 2013 Share Posted May 17, 2013 Merhaba arkadaşlar. PHP ile BBCODE yapımının nasıl yapıldığını merak ediyorum. Bir video izledim ve yapılanları uyguladım. Ancak merak ettiğim bir şey var Alıntı etiketi yani quote forumlarda gördüğümü kadarıyla bir blok şeklinde gözüküyor div içinde. Ben quote etiketini yaptım ama çıktı halinde öyle bir görsellik göremedim. Bunun için nerede düzenleme yapmam lazım yardımcı olur musunuz? Kodlarımı paylaşıyorum. <?php Function BBcode($yazi){ // Kullanmak istediğimiz bbcode leri listeleyelim. $bbcode = array( '[b]','[/b]', '[i]','[/i]', '[u]','[/u]', '[code]','[/code]', '[quote]','[/quote]', '[img]','[/img]' ); $html = array( '<b>','</b>', '<i>','</i>', '<u>','</u>', '<code>','</code>', '<quote>','</quote>', '<img src="','">' ); $sonYazi = str_replace($bbcode, $html, $yazi); return $sonYazi; } echo BBcode("[b]Deneme[/b] - [i]Abdullah[/i]")."<br><br>"; echo BBcode("[code]Denemer[/b] - [u][i]Abdullah[/i][/code]")."<br><br>"; echo BBcode("[quote]Bu bir denemedir[/quote]")."<br><br>"; ?> Quote Link to comment Share on other sites More sharing options...
reyiz Posted May 17, 2013 Share Posted May 17, 2013 (edited) div'in css özelliklerini ayarladınız mı? Hem yukarıda quote'yi <quote> diye bir etikete dönüştürüyor. Özel etiketlerinizi oluşturdunuz mu? Kolay gelsin.. Edited May 17, 2013 by reyiz Quote Link to comment Share on other sites More sharing options...
Abdullah 37 Posted May 17, 2013 Author Share Posted May 17, 2013 Div ve css az da olsa biliyorum ama bunu bbcode de nasıl uygulanır bilmiyorum malesef. Özel etiket de oluşturmadım. Yukarıdaki koda binaen bir örnek vermeniz mümkün mü acaba? Bu div nereye yazılacak ayrı bir dosya felan mı oluşturulacak. Tam manasıyla anlayamadım. Quote Link to comment Share on other sites More sharing options...
reyiz Posted May 17, 2013 Share Posted May 17, 2013 (edited) <?php Function BBcode($yazi){ // Kullanmak istediğimiz bbcode leri listeleyelim. $bbcode = array( '','', '','', '','', ' ','', 'Quote','', '' ); $html = array( '<b>','</b>', '<i>','</i>', '<u>','</u>', '<code>','</code>', '<div class="quote">','</div>', '<img src="','">' ); $sonYazi = str_replace($bbcode, $html, $yazi); return $sonYazi; } echo BBcode("Deneme - Abdullah")."<br><br>"; echo BBcode(" Denemer[/b] - [u][i]Abdullah[/i]")."<br><br>"; echo BBcode("QuoteBu bir denemedir")."<br><br>"; ?> Yukarıdaki şekilde kodu düzenlemelisiniz. Sonra da css dosyası içerisine quote classı ile ilgili öznitelikleri tanımlayacaksınız. <?php <link href="css/stil.css" rel="stylesheet" type="text/css"> ?> Örnek quote css kodu (tnctr): blockquote.ipsBlockquote { font-size: 12px; padding: 10px; border: 2px solid #e5e5e5; border-left: 2px solid #989898; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; background: #f7f7f7; margin: 0 0; overflow-x: auto; }Kolay gelsin.. Edited May 17, 2013 by reyiz Quote Link to comment Share on other sites More sharing options...
Abdullah 37 Posted May 17, 2013 Author Share Posted May 17, 2013 Teşekkür ederim denedim ve oldu. Diyelim ki code etiketi içinde ben php kodu yazacağım. Code etiketini nasıl düzenlemem gerekiyor o zaman? Quote Link to comment Share on other sites More sharing options...
reyiz Posted May 17, 2013 Share Posted May 17, 2013 <?php Function BBcode($yazi){ // Kullanmak istediğimiz bbcode leri listeleyelim. $bbcode = array( '','', '','', '','', ' ','', 'Quote','', '' ); $html = array( '<b>','</b>', '<i>','</i>', '<u>','</u>', '<div class="code">','</div>', '<div class="quote">','</div>', '<img src="','">' ); $sonYazi = str_replace($bbcode, $html, $yazi); return $sonYazi; } echo BBcode("Deneme - Abdullah")."<br><br>"; echo BBcode(" Denemer[/b] - [u][i]Abdullah[/i]")."<br><br>"; echo BBcode("QuoteBu bir denemedir")."<br><br>"; ?>Yukarıdaki şekilde kodu düzenlemelisiniz. Sonra da css dosyası içerisine code classı ile ilgili öznitelikleri tanımlayacaksınız.<?php <link href="css/stil.css" rel="stylesheet" type="text/css"> ?>Örnek code css kodu (tnctr):code { background-color: #fafafa !important; -moz-border-radius: 4px; -webkit-border-radius: 4px; -o-border-radius: 4px; -ms-border-radius: 4px; -khtml-border-radius: 4px; border-radius: 4px; color: #000; padding: 5px; border: 1px solid #c9c9c9; overflow: auto; margin-left: 10px; font-size: 13px; line-height: 140%; font-family: monospace !important; }Kolay gelsin.. Quote Link to comment Share on other sites More sharing options...
Abdullah 37 Posted May 19, 2013 Author Share Posted May 19, 2013 Teşekkür ederim. Quote Link to comment Share on other sites More sharing options...
Turkcode Posted April 1, 2014 Share Posted April 1, 2014 genelde bu sorun çıkartır pregmatchall kullanmanızı tavsiye ederim. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.