twig template help

Associate
Joined
19 Jul 2006
Posts
1,847
Having a bit of trouble with Twig.
I have a view template like this
Code:
<td>          
              <p> {{ paragraph }} </p> 
          </td>

In my controller I have something like
Code:
$view->setParagraph('What I type here will appear in the view');

The above works

However I am converting a lot of files where they use php logic.

So Id want to do something like
Code:
$view->setParagraph("<?php echo 'Foo: ' ?>"); //this just prints <?php echo 'Foo: ' ?>
$view->setParagraph('<?php echo "Foo: " ?>'); //this just prints <?php echo "Foo: " ?>

When really I want it to display Foo

This is a simple example but Id have things like <?php if true echo "something" else echo "something else" ?>

Is this do able just passing it in like I am trying to or would I have to look at a different approach.
 
Back
Top Bottom