denasio — 2014-01-23T05:17:20-05:00 — #1
$HTML_Ouput .= preg_replace("'\\[image\\](.+?)\\[\\/image\\]'is","<img \\\\1 align=middle style=\\"margin:4px 4px;\\">",ereg_replace(";"," ",$avalue));
pullo — 2014-01-23T06:08:08-05:00 — #2
JS will only execute once your PHP script has been parsed and the resultant HTML sent to the browser.
As such, a one to one translation is not possible.
However, if you could tell us what you are trying to do, then I'm sure a JS solution could be found.
denasio — 2014-01-23T06:25:46-05:00 — #3
pullo — 2014-01-23T07:05:18-05:00 — #4
denasio — 2014-01-23T07:13:52-05:00 — #5
Thanks, but I would prefer you help me out with my request.
pullo — 2014-01-23T07:23:25-05:00 — #6
Well, the thing is, you won't be able to translate that snippet one for one, drop it in your page and have it work.
That's not to say that what you are trying to achieve with PHP cannot be done with JS, but your snippet provides nowhere near enough context.
For example what do the variables
The best way for us to help you is if you describe what you are trying to do and provide some HTML and possibly JS for us to work with.
Also, a link to a page where we can see everything would be handy.
denasio — 2014-01-23T11:09:25-05:00 — #7
The problem is as follows:
how do I convert
<img src='http://www.url.com/pic.gif' height='10' width='15' align=middle style="margin:4px 4px;">
pullo — 2014-01-23T11:49:22-05:00 — #8
Something like this maybe?
var string = "[image]src='http://www.url.com/pic.gif';height='10';width='15'[/image]",
src = string.replace(/\\[\\/?image\\]/g, "").replace(/;/g, " ");
newString = "<img " + src + "align=middle style=\\"margin:4px 4px;\\">"
denasio — 2014-01-23T18:09:08-05:00 — #9