Skip to content

What PHP directives does PHP2Blade translate to its blade form? #10

@oknoote

Description

@oknoote

For example I was expecting

<?php echo 'this is my name:'.my_name();?>

to be transpiled to
This is {{my_name()}}

I see now using a different control structure might solve the problem. Because this is happening inside a PHP code block.

My current code:

 <?php
  if (!$category_as_link)
  {
       echo $this->ad_model->adCategoryString($ad);
  } else
  {
          echo $this->ad_model->category_link($ad);
   }
 ?>

The output from PHP2Blade is just an entire @php codeblock

@php if (!$category_as_link)
{
     echo $ci->ad_model->adCategoryString($ad);
} else
{
    echo $ci->ad_model->category_link($ad);
} 
@endphp

I will try the alternative control structure syntax which you mention in the previous issue, this means adding a LOT of opening and closing PHP tags to my current code unfortunately, I imagine so:

<?php if (!$category_as_link): ?>
<?php  echo $this->ad_model->adCategoryString($ad);  ?>
<?php else: ?>
<?php  $this->ad_model->category_link($ad); ?>
<?php  endelse; ?>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions