Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthoredward
     

    I am working with Editam but I just found out that inserting PHP code inside a PagePart content field will not render as PHP code, but instead it's ignored. How could I get PHP code to render so that it can be displayed in the views?

    UPDATE:

    (I have akelos 0.7.1)

    Well, I found out that it would be easier to create my own sintags and insert the php in them that I want to use in the views. Works nicely, except I ran into something awkward.

    when I write this in my views:

    {%= get_value_for_column $property, $content_column %}

    the resulted render is:

    $url_helper->get_value_for_column($property$content_column); <--- no comma

    but ofcourse, the two variables should be separated. Am I using a wrong syntax in the sintag or should this be reported in the trac?

    In fact, I just tried one of the example from here: http://svn.akelos.org/trunk/test/fixtures/data/sintags_helpers_data.txt

    <%= link_to ("Visit Other Site", "http://www.akelos.org/", {:confirm => "Are you sure?"} ) %>

    but I again get a wrong answer because:

    <?php echo $url_helper->link_to("Visit Other Site", "http://www.akelos.org/", array('confirm'"Are you sure?")); ?>

    the last array is not properly setup.

    Thanks.

    •  
      CommentAuthorbermi
     

    Edward,

    Editam does not use standard Sintags.

    In order to make Editam templates compatible with WYSIWYG editors we had to remove the characters < and >

    So instead of <%= %> you need to type {%= %}, AND instead of => you just need to write =

    On the other hand, nor Sintags or Editags (as it is named the Editags syntax) use $ to represent variables.

    Your examples will work as

    {%= get_value_for_column property, content_column %}
    

    and

    {%= link_to ("Visit Other Site", "http://www.akelos.org/", {:confirm = "Are you sure?"} ) %}
    

    Hope it helps

    • CommentAuthoredward
     

    Thanks bermi for your response,

    Indeed your suggestions worked, I had overlooked the syntax, but now I learned it.

    However, there's another issue that I would like to ask you. I'm in a point where I absolutely need to access form helpers from within my views in Editam. As you stated, php tags are ignored. But would it be possible to leave php code inside views, so that when the .tpl.php file is cached, it still contains the php code?

    The reason is because I want to ultimately include forms stored inside a db table within my editam views. These forms contain calls to the form_helper like this one:

    $form_options_helper->select('item', 'id', $Item->collect($Item->find(), 'name', 'id'))
    

    In order to use that call, I need to wrap it with php tags, but I can't use php tags because everything the .tpl.php is cached, the php code is removed. How could I solve this? I also cannot create editags for each helper call either, because the whole form is stored in PHP inside the table.

    For that matter, how are forms created in Editam inside pages if the form_helpers cannot be accessed from the views? Would the solution be storing the form in a snippet, and then calling the snippet?