First of all, thanks for helping me here, I really appreciate your time.
Let me tell you a little about what I'm trying to accomplish:
I am working on a small improvement to the site where I want to add a simple, related message widget in the content area of ββcertain messages.
Now, for any given message, I have all the contents of my message stored in a variable. Let me call it $ content.
What I hope to do is parse this $ content line and insert the widget right after the second instance of the H3 tag.
This is an example of one of my failed attempts:
$widgetizedContent = explode("</h3>", $content); $widgetizedContent[1] .= 'widget code'; $finalContent = implode($widgetizedContent, "<p>");
I'm not quite sure where to go from here, and I will be grateful for any direction that you could provide to me.
Edit: this is the output:
<h3>This is my header text[this is the text I'm trying to insert]</h3>
Instead of embedding the widget code after H3, it inserts it before the closing H3 tag. I donβt think that I understand that I will explode, but I also have to :)
source share