Foren / Cotonti / Support / ParseBlock Help

medj
#8655 23. Februar 2009, 02:48
Hello, I was wondering if someone could help me out with what I'm trying to accomplish.

I have a function that will parse tags in HTML. I know users of Seditio and Cotonti are all familiar with this method.

First off, here is some code:

class Parser {
  function ParseTags($Template, $ParseTags) {
    $Template = file_get_contents($Template);
    foreach($ParseTags as $UnParsed => $Parsed){      
      $Template = str_replace("{".$UnParsed."}", $Parsed, $Template);
      }
    return $Template;
    }

This will basically look at one of my HMTL files and convert any tags into the data that should be displayed for that page. This works fine.

My question is basically if anyone knows how to implement a parseblock function. A very simple one in which on my HTML file I can have the following code:

{START: SHOW_NEWS}
{row_news_title}
{row_news_body}
{END: SHOW_NEWS}

And basically it would repeat this for as many news posts as I want to show on a page.

Even if someone has a link for me to learn how to do this, that would be fine. I was searching for "ParseBlock" and didn't come up with any help.

Thanks.