I am trying to add switching capabilities to my site, now the system is very simple and the layout of a switch is as follows (note that the else is optional):
Code: Select all
<switch name>Display this if name is true</switch name><else name>Display this if not</else name>
This is where I am running into trouble. The particular HTML causing the problem is:
Code: Select all
<switch empty><switch cat>There are no link categories</switch cat><else cat>There are no links in this category</else cat></switch empty><else empty>{link_DESCRIPTION}</else empty>
Code: Select all
$parse = preg_replace ("'<switch[^>]*?>.*?</switch[^>]*?>'si", '', $parse);
1. Only remove a <switch name></switch name> block of code if the 'name' parts are identical
2. Only remove a block if it has no other blocks within it, that way it should remove the <switch cat></switch cat> block, THEN the <switch empty></switch empty> block.
Hopefully that didn't go completely over everybody's head and someone who knows this PRCE stuff better than me can offer a solution