I finished a template engine, its tiny, needed it for a small project. so with that in mind I am stuck on adding a new section that is not going well.
tag: {subgame}
this will show the layout of a particular game - works fine yippe!
but that is just for one game. so now I am changing it to show more than one, and I cannot use that tag over, due to the way
"str_replace" works (changes all in one swoop)
so I thought doing it this way
2nd Method:
{subgame1} {subgame2} {subgame3} etc...
the search is: where field is one of the triggers (in this case SUBGAME)
if (strstr( '{'.$field.'}",$html_str) )
works fine for the first one, but obviously ignores the 2nd method
I tried preg_match - but i know i am missing something, because I cannot get it to work.
and ideal way would be the fnmatch( as of 5.3 its available for windows now) but only supports up to 260 characters - not good for website
So what I am looking for:
psuedo code:
if ( '{'.$field.'[optional digits]}' ) { do code here }
I know preg_match seems to be the way but cant get it to see the numbers and if it does, it misses the origianl game, or worse crashes.