Jump to content

Custom Tags - preg_replace


EGONick

Recommended Posts

Hello there.

 

I'm in need of some help.  I'm trying to develop a function which searches a page and replaces a custom HTML tag with a content section from the database.  I'm having a problem getting the var name of the content item to fetch it from the database.  When it comes to expressions I'm pants. 

 

Here's my function up to now but, the variable fetched from the tag isn't passed through.

 

function parse_content($content)
{
return preg_replace("/<content var=(.*)>/", get_object("content", '${1}'), $content);
}

 

Anyone got any idea's?  Many thanks.

Link to comment
https://forums.phpfreaks.com/topic/115022-custom-tags-preg_replace/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.