Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: @php directive does not work as expected in an assumed scenario #9

Open
nael94 opened this issue Jul 27, 2024 · 3 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@nael94
Copy link

nael94 commented Jul 27, 2024

Here is a quick example to describe the error:

@extends ('layout/main')

@php
  // This is php code
  $from = 10;
  $to = $from + 10;
@endphp

@section('body')
  {{ $to }}
@endsection

It is assumed to prepare the variable $to to be usable in the current viewfile, but it returns this error: Deprecated: htmlentities(): Passing null to parameter 1 ($string) of type string is deprecated in C:\xampp\htdocs\crow\vendor\corviz\crow\src\Crow.php(138) : eval()'d code on line 1

@nael94
Copy link
Author

nael94 commented Jul 29, 2024

Okay I tried to move the @php block to inside the @section block and it works. I prefer to introduce a way to share all codes from @php block through all that view file for a better code logic organizing.

@carloscarucce carloscarucce self-assigned this Jan 14, 2025
@carloscarucce carloscarucce added the enhancement New feature or request label Jan 14, 2025
@carloscarucce
Copy link
Member

Passing data between sections is a bit of a hassle. We have to take care of this one so we don't break something unexpectedly

@nael94
Copy link
Author

nael94 commented Jan 28, 2025

Passing data between sections is a bit of a hassle. We have to take care of this one so we don't break something unexpectedly

Okay this make sense for me 👍🏼 However, I still prefer that way instead of repeating blocks of code in each specific desired sections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants