You can use regular expressions to match your custom tags.
$html // Your html preg_match_all('/<module\s*([^>]*)\s*\/?>/', $html, $customTags, PREG_SET_ORDER); foreach ($customTags as $customTag) { $originalTag=$customTag[0]; $rawAttributes=$customTag[1]; preg_match_all('/([^=\s]+)="([^"]+)"/', $rawAttributes, $attributes, PREG_SET_ORDER); $formatedAttributes=array(); foreach ($attributes as $attribute) { $name=$attribute[1]; $value=$attribute[2]; $formatedAttributes[$name]=$value; } $html=str_replace($originalTag, yourFunction($formatedAttributes), $html); }
If you want to use XML aproach, contact me and I will show you how to do it.
Cristian toma
source share