problem with [coder] tags in article |
[eluser]double_d[/eluser]
Hi all, Thing I want to do is to use Code: highlight_code got kind of a problem with preg_match (that was first thing I found to use...) I didn't find any CI function that would do what I want (I was looking in text helper). here is the code... Code: $str = 'bla bla bla [coder]#!/bin/bash but output on page is only oder]#!/bin Did I overlook some CI function or smthn, and if there isn't any what is wrong with my code... tnx in advance
[eluser]GSV Sleeper Service[/eluser]
you need to escape the square brackets too, also "." will not match newlines.
[eluser]double_d[/eluser]
[quote author="Vlad0" date="1228165096"]http://codeigniter.com/wiki/Another_BBCode_Helper/[/quote] @vlad (cepes ) do I really need to integrate complete helper in CI so I could just use one tag escaping square brackets gives me error when returning data from array ... will try to get the solution from that BB helper...
[eluser]narkaT[/eluser]
[quote author="double_d" date="1228165872"]escaping square brackets gives me error when returning data from array ...[/quote] because no matches are found. you should check if the expression matched anything before working with the "result": Code: if ( preg_match(/*....*/) ) { your expression won't match anything containing newlines because the appropriate pattern modifier is missing
[eluser]double_d[/eluser]
Code: $ref = preg_match("/\[coder](.*)\[\/coder]/sim", $str, $matches); works as a charm tnx allot |
Welcome Guest, Not a member yet? Register Sign In |