Upgrading Laravel 5.2 to 5.3 with hidden comment code
I am updating a site from Laravel 5.2 to (eventually) 5.7 that was coded by someone else.
Currently I having an issue with this type of code in a blade file:
{{-- */ $hidden = 'hidden' /* --}}
That creates a variable that is used in the file itself like this:
<div class="col-xs-2 {{$hidden}}" id="person1div">
</div>
That seems to work fine in Laravel 5.2 but in 5.3 I get the error message:
Undefined variable: hidden
I could change the code to
<?php $hidden = 'hidden' ?>
but the issue is that there are many variables like this, used in various ways.
Something to note is that these variable are in loops which I guess is why the original developer used them as they get reset and re-populated.
Is there a more correct way to populate the variables?
php laravel laravel-5.2 laravel-5.3 laravel-blade
add a comment |
I am updating a site from Laravel 5.2 to (eventually) 5.7 that was coded by someone else.
Currently I having an issue with this type of code in a blade file:
{{-- */ $hidden = 'hidden' /* --}}
That creates a variable that is used in the file itself like this:
<div class="col-xs-2 {{$hidden}}" id="person1div">
</div>
That seems to work fine in Laravel 5.2 but in 5.3 I get the error message:
Undefined variable: hidden
I could change the code to
<?php $hidden = 'hidden' ?>
but the issue is that there are many variables like this, used in various ways.
Something to note is that these variable are in loops which I guess is why the original developer used them as they get reset and re-populated.
Is there a more correct way to populate the variables?
php laravel laravel-5.2 laravel-5.3 laravel-blade
add a comment |
I am updating a site from Laravel 5.2 to (eventually) 5.7 that was coded by someone else.
Currently I having an issue with this type of code in a blade file:
{{-- */ $hidden = 'hidden' /* --}}
That creates a variable that is used in the file itself like this:
<div class="col-xs-2 {{$hidden}}" id="person1div">
</div>
That seems to work fine in Laravel 5.2 but in 5.3 I get the error message:
Undefined variable: hidden
I could change the code to
<?php $hidden = 'hidden' ?>
but the issue is that there are many variables like this, used in various ways.
Something to note is that these variable are in loops which I guess is why the original developer used them as they get reset and re-populated.
Is there a more correct way to populate the variables?
php laravel laravel-5.2 laravel-5.3 laravel-blade
I am updating a site from Laravel 5.2 to (eventually) 5.7 that was coded by someone else.
Currently I having an issue with this type of code in a blade file:
{{-- */ $hidden = 'hidden' /* --}}
That creates a variable that is used in the file itself like this:
<div class="col-xs-2 {{$hidden}}" id="person1div">
</div>
That seems to work fine in Laravel 5.2 but in 5.3 I get the error message:
Undefined variable: hidden
I could change the code to
<?php $hidden = 'hidden' ?>
but the issue is that there are many variables like this, used in various ways.
Something to note is that these variable are in loops which I guess is why the original developer used them as they get reset and re-populated.
Is there a more correct way to populate the variables?
php laravel laravel-5.2 laravel-5.3 laravel-blade
php laravel laravel-5.2 laravel-5.3 laravel-blade
asked Jan 2 at 7:43
Mhluzi BhakaMhluzi Bhaka
705827
705827
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You can select and replace the syntax like shown below.
You can set variables with values in blade file like this:
@php $hello = "Hello World!"; @endphp
and to print the variable on the blade file,
{{$hello}}
Thanks @himanshu-upadhyay, seems this is the best way to go.
– Mhluzi Bhaka
Jan 2 at 20:03
In these code-blocks would the trailing semi-colon be required?
– Mhluzi Bhaka
Jan 2 at 21:00
If there will be 1 line of code, then it will work without semi-colon.
– Himanshu Upadhyay
Jan 3 at 5:08
add a comment |
Right, solved this (as often happens on SO) just after I posted this question.
I did a global find and replace and changed instances of
{{-- */
to
{!!
and also
/* --}}
to
!!}
So instead of
{{-- */ $hidden = 'hidden' /* --}}
I have:
{!! $hidden = 'hidden' !!}
That has done the trick.
Thanks for the answers - hope this helps someone else.
EDIT***********************************
Although I thought this was going to work for me as it turns out I kept on getting errors such as "Array to string conversion"
So I am going ahead with the answer from @himanshu-upadhyay
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54002843%2fupgrading-laravel-5-2-to-5-3-with-hidden-comment-code%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can select and replace the syntax like shown below.
You can set variables with values in blade file like this:
@php $hello = "Hello World!"; @endphp
and to print the variable on the blade file,
{{$hello}}
Thanks @himanshu-upadhyay, seems this is the best way to go.
– Mhluzi Bhaka
Jan 2 at 20:03
In these code-blocks would the trailing semi-colon be required?
– Mhluzi Bhaka
Jan 2 at 21:00
If there will be 1 line of code, then it will work without semi-colon.
– Himanshu Upadhyay
Jan 3 at 5:08
add a comment |
You can select and replace the syntax like shown below.
You can set variables with values in blade file like this:
@php $hello = "Hello World!"; @endphp
and to print the variable on the blade file,
{{$hello}}
Thanks @himanshu-upadhyay, seems this is the best way to go.
– Mhluzi Bhaka
Jan 2 at 20:03
In these code-blocks would the trailing semi-colon be required?
– Mhluzi Bhaka
Jan 2 at 21:00
If there will be 1 line of code, then it will work without semi-colon.
– Himanshu Upadhyay
Jan 3 at 5:08
add a comment |
You can select and replace the syntax like shown below.
You can set variables with values in blade file like this:
@php $hello = "Hello World!"; @endphp
and to print the variable on the blade file,
{{$hello}}
You can select and replace the syntax like shown below.
You can set variables with values in blade file like this:
@php $hello = "Hello World!"; @endphp
and to print the variable on the blade file,
{{$hello}}
answered Jan 2 at 7:48
Himanshu UpadhyayHimanshu Upadhyay
5,3691825
5,3691825
Thanks @himanshu-upadhyay, seems this is the best way to go.
– Mhluzi Bhaka
Jan 2 at 20:03
In these code-blocks would the trailing semi-colon be required?
– Mhluzi Bhaka
Jan 2 at 21:00
If there will be 1 line of code, then it will work without semi-colon.
– Himanshu Upadhyay
Jan 3 at 5:08
add a comment |
Thanks @himanshu-upadhyay, seems this is the best way to go.
– Mhluzi Bhaka
Jan 2 at 20:03
In these code-blocks would the trailing semi-colon be required?
– Mhluzi Bhaka
Jan 2 at 21:00
If there will be 1 line of code, then it will work without semi-colon.
– Himanshu Upadhyay
Jan 3 at 5:08
Thanks @himanshu-upadhyay, seems this is the best way to go.
– Mhluzi Bhaka
Jan 2 at 20:03
Thanks @himanshu-upadhyay, seems this is the best way to go.
– Mhluzi Bhaka
Jan 2 at 20:03
In these code-blocks would the trailing semi-colon be required?
– Mhluzi Bhaka
Jan 2 at 21:00
In these code-blocks would the trailing semi-colon be required?
– Mhluzi Bhaka
Jan 2 at 21:00
If there will be 1 line of code, then it will work without semi-colon.
– Himanshu Upadhyay
Jan 3 at 5:08
If there will be 1 line of code, then it will work without semi-colon.
– Himanshu Upadhyay
Jan 3 at 5:08
add a comment |
Right, solved this (as often happens on SO) just after I posted this question.
I did a global find and replace and changed instances of
{{-- */
to
{!!
and also
/* --}}
to
!!}
So instead of
{{-- */ $hidden = 'hidden' /* --}}
I have:
{!! $hidden = 'hidden' !!}
That has done the trick.
Thanks for the answers - hope this helps someone else.
EDIT***********************************
Although I thought this was going to work for me as it turns out I kept on getting errors such as "Array to string conversion"
So I am going ahead with the answer from @himanshu-upadhyay
add a comment |
Right, solved this (as often happens on SO) just after I posted this question.
I did a global find and replace and changed instances of
{{-- */
to
{!!
and also
/* --}}
to
!!}
So instead of
{{-- */ $hidden = 'hidden' /* --}}
I have:
{!! $hidden = 'hidden' !!}
That has done the trick.
Thanks for the answers - hope this helps someone else.
EDIT***********************************
Although I thought this was going to work for me as it turns out I kept on getting errors such as "Array to string conversion"
So I am going ahead with the answer from @himanshu-upadhyay
add a comment |
Right, solved this (as often happens on SO) just after I posted this question.
I did a global find and replace and changed instances of
{{-- */
to
{!!
and also
/* --}}
to
!!}
So instead of
{{-- */ $hidden = 'hidden' /* --}}
I have:
{!! $hidden = 'hidden' !!}
That has done the trick.
Thanks for the answers - hope this helps someone else.
EDIT***********************************
Although I thought this was going to work for me as it turns out I kept on getting errors such as "Array to string conversion"
So I am going ahead with the answer from @himanshu-upadhyay
Right, solved this (as often happens on SO) just after I posted this question.
I did a global find and replace and changed instances of
{{-- */
to
{!!
and also
/* --}}
to
!!}
So instead of
{{-- */ $hidden = 'hidden' /* --}}
I have:
{!! $hidden = 'hidden' !!}
That has done the trick.
Thanks for the answers - hope this helps someone else.
EDIT***********************************
Although I thought this was going to work for me as it turns out I kept on getting errors such as "Array to string conversion"
So I am going ahead with the answer from @himanshu-upadhyay
edited Jan 2 at 20:02
answered Jan 2 at 7:52
Mhluzi BhakaMhluzi Bhaka
705827
705827
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54002843%2fupgrading-laravel-5-2-to-5-3-with-hidden-comment-code%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown