ghqwerty Posted October 4, 2008 Share Posted October 4, 2008 ok so for my users profile i am doing the bbcode however i dont know if this bit is in the bbcode on mty thing if i was to type hello hello hello it would show hello hello hello im guessing i would have to add in <br /> but how would i single out the 'line break' to add it ?? basically what code do i need to add line breaks Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/ Share on other sites More sharing options...
wildteen88 Posted October 4, 2008 Share Posted October 4, 2008 Look into nl2br() Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657022 Share on other sites More sharing options...
ghqwerty Posted October 4, 2008 Author Share Posted October 4, 2008 thanks sorted that now when i do this ════════════════════════════ this isnt working amfg ════════════════════════════ i get ¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T this isnt working amfg ¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T or ════════════════════════════ this isnt working amfg ════════════════════════════ Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657030 Share on other sites More sharing options...
ghqwerty Posted October 4, 2008 Author Share Posted October 4, 2008 ignore that now ill do that another time my thing now is i want to let the user write hello and then make it 20px big however $str = preg_replace ('/\[size=\](.*?)\[\/size\]/is', '<span style="font-size: px">$1</span>', $str); ive got so far but not sure how im meant to make whatever the user puts as size to = the px size Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657046 Share on other sites More sharing options...
wildteen88 Posted October 4, 2008 Share Posted October 4, 2008 Use $str = preg_replace ('/\[size=([0-9]+)\](.*?)\[\/size\]/is', "<span style=\"font-size: {$1}px\">$2</span>", $str); Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657056 Share on other sites More sharing options...
ghqwerty Posted October 4, 2008 Author Share Posted October 4, 2008 im getting this error Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in C:\xampp\htdocs\stats.php on line 129 also if i wanted to make it a max size of say 30 would i just put [0-30] ??? Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657059 Share on other sites More sharing options...
wildteen88 Posted October 4, 2008 Share Posted October 4, 2008 Umm, Instresting use the following instead: $str = preg_replace ('/\[size=([0-9]+)\](.*?)\[\/size\]/is', '<span style="font-size: $1px">$2</span>', $str); if i wanted to make it a max size of say 30 would i just put [0-30] Yes change [0-9]+ to [0-30] Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657063 Share on other sites More sharing options...
ghqwerty Posted October 4, 2008 Author Share Posted October 4, 2008 meh just changed to (.+) anyway ive got one now that im not sure if its under bbcode or something else if the user types in something like &#gt; it would show < Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657078 Share on other sites More sharing options...
ghqwerty Posted October 5, 2008 Author Share Posted October 5, 2008 any suggestions on this ??? Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657426 Share on other sites More sharing options...
JasonLewis Posted October 5, 2008 Share Posted October 5, 2008 > is greater than, you gave a less than. Why would the user type in $gt; anyway, surely it'd be easier for them to just type in > Or am I missing something? Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657468 Share on other sites More sharing options...
ghqwerty Posted October 5, 2008 Author Share Posted October 5, 2008 arr you know what i mean but things like ═ is a sort of = sign but lower at the moment if i were to type in ═ and click save changes in the show profile it would show ═ then when i go back to edit it will show the variation of the = but if i click save changes again without clicking anything i get ¨T basically i want it so that it ALWAYS shows the = sign for that one or whatever the code stands for if you get my meaning ? Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657471 Share on other sites More sharing options...
JasonLewis Posted October 5, 2008 Share Posted October 5, 2008 It's probably showing it as ═ because you are running a function like htmlentities() on it. Then when you go back to edit you are not performing the function on it. That's just a guess though. Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657474 Share on other sites More sharing options...
ghqwerty Posted October 5, 2008 Author Share Posted October 5, 2008 hmm .. so how would i get around it ??? Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657480 Share on other sites More sharing options...
JasonLewis Posted October 5, 2008 Share Posted October 5, 2008 I can't say, sorry. It would only be doing for a certain group of characters that it converts. Sorry, I cannot think of a way to make it stay. But why would they be using that variation of the equals sign anyway? Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657482 Share on other sites More sharing options...
ghqwerty Posted October 5, 2008 Author Share Posted October 5, 2008 make account profiles look snazzy Link to comment https://forums.phpfreaks.com/topic/127013-bbcode/#findComment-657490 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.