1

So, my traditional method is using the template parser class instead of the standard view loading method. The only trouble with this is that variables can start to get messy after a while if more than one category of variables is used.

For example... an array like this:

$data = array(
    'THREAD' => array(
        'TITLE' => "Some Cool Title",
        'MESSAGE' => "Hello, world!",
        'AUTHOR' => $author_info //Some Array of author's info
    ),
    'COMMENT_RESULTS' => array(
        array(
            'MESSAGE' => "hello, world!",
            'AUTHOR' => array()
        )
    )
);

View:

<h1>{THREAD:TITLE}</h1> 
<H2>Posted by {THREAD:AUTHOR:USERNAME}

<p>{THREAD:MESSAGE}</p>

<ul>{COMMENT_RESULTS}
     <li>
          {COMMENT:MESSAGE}
          Posted by {COMMENT:AUTHOR:USERNAME}
     </li>
</ul>

1 Answer 1

1
{TITLE}

Posted by {AUTHOR}

{MESSAGE}

{COMMENT_RESULTS}

      {MESSAGE}
      Posted by {AUTHOR}

{/COMMENT_RESULTS}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.