0

Im coding a blog for a website which will have a backend where users can write their own posts.

What I need to do is to enable the author to link in an image into the content, what I need to do is to take a string like [image="URL HERE"]CAPTION HERE[/image] and when the website is loading the post it need to identify the string and dissect the url from the caption and tags to output an image + p tag.

I am wondering how i could achieve this in the simplest manner?

I expect the output to be something like:

<img src="URL TO IMAGE" alt="CAPTION HERE" /><p>CAPTION HERE</p>
4

1 に答える 1