Magento 2 | Print php in template file The Next CEO of Stack OverflowMagento page.xml main content block have no template fileGet MAGE_MODE within a template file or a blockDisplay product base image in .phtml template fileInvalid template file override Magento 2 blockMagento 2 add new block template fileGet function/value from php file in .phtmlHow to override block .php file?NOINDEX,NOFOLLOW for specific template (phtml) file?not able to render phtml file magento 1.7How to create phtml file to edit home page?
MessageLevel in QGIS3
If the heap is initialized for security, then why is the stack uninitialized?
Why does the UK parliament need a vote on the political declaration?
Why didn't Khan get resurrected in the Genesis Explosion?
Which tube will fit a -(700 x 25c) wheel?
"and that skill is always a class skill for you" - does "always" have any meaning in Pathfinder?
What do "high sea" and "carry" mean in this sentence?
Is micro rebar a better way to reinforce concrete than rebar?
Why do airplanes bank sharply to the right after air-to-air refueling?
How to start emacs in "nothing" mode (`fundamental-mode`)
Is there an analogue of projective spaces for proper schemes?
If a black hole is created from light, can this black hole then move at speed of light?
multiple labels for a single equation
Inappropriate reference requests from Journal reviewers
Preparing Indesign booklet with .psd graphics for print
How do we know the LHC results are robust?
Won the lottery - how do I keep the money?
Why do professional authors make "consistency" mistakes? And how to avoid them?
What exact does MIB represent in SNMP? How is it different from OID?
Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?
Is there a way to save my career from absolute disaster?
WOW air has ceased operation, can I get my tickets refunded?
Why did we only see the N-1 starfighters in one film?
Does it take more energy to get to Venus or to Mars?
Magento 2 | Print php in template file
The Next CEO of Stack OverflowMagento page.xml main content block have no template fileGet MAGE_MODE within a template file or a blockDisplay product base image in .phtml template fileInvalid template file override Magento 2 blockMagento 2 add new block template fileGet function/value from php file in .phtmlHow to override block .php file?NOINDEX,NOFOLLOW for specific template (phtml) file?not able to render phtml file magento 1.7How to create phtml file to edit home page?
I got this .phtml file:
How can I make it work?
Thanks!
magento2 blocks phtml
|
show 3 more comments
I got this .phtml file:
How can I make it work?
Thanks!
magento2 blocks phtml
Update the pull path of file and the whole code of that file to the question
– Sukumar Gorai
Jul 3 '18 at 15:03
I have updated it.
– k33n
Jul 3 '18 at 15:09
What is the layout file?
– Sukumar Gorai
Jul 3 '18 at 15:09
I updated it again. It's all working except the code at the end.
– k33n
Jul 3 '18 at 15:14
1
$this->getFormUrl() instead of $block->getFormUrl()
– Sukumar Gorai
Jul 3 '18 at 15:15
|
show 3 more comments
I got this .phtml file:
How can I make it work?
Thanks!
magento2 blocks phtml
I got this .phtml file:
How can I make it work?
Thanks!
magento2 blocks phtml
magento2 blocks phtml
edited 4 mins ago
k33n
asked Jul 3 '18 at 15:02
k33nk33n
455110
455110
Update the pull path of file and the whole code of that file to the question
– Sukumar Gorai
Jul 3 '18 at 15:03
I have updated it.
– k33n
Jul 3 '18 at 15:09
What is the layout file?
– Sukumar Gorai
Jul 3 '18 at 15:09
I updated it again. It's all working except the code at the end.
– k33n
Jul 3 '18 at 15:14
1
$this->getFormUrl() instead of $block->getFormUrl()
– Sukumar Gorai
Jul 3 '18 at 15:15
|
show 3 more comments
Update the pull path of file and the whole code of that file to the question
– Sukumar Gorai
Jul 3 '18 at 15:03
I have updated it.
– k33n
Jul 3 '18 at 15:09
What is the layout file?
– Sukumar Gorai
Jul 3 '18 at 15:09
I updated it again. It's all working except the code at the end.
– k33n
Jul 3 '18 at 15:14
1
$this->getFormUrl() instead of $block->getFormUrl()
– Sukumar Gorai
Jul 3 '18 at 15:15
Update the pull path of file and the whole code of that file to the question
– Sukumar Gorai
Jul 3 '18 at 15:03
Update the pull path of file and the whole code of that file to the question
– Sukumar Gorai
Jul 3 '18 at 15:03
I have updated it.
– k33n
Jul 3 '18 at 15:09
I have updated it.
– k33n
Jul 3 '18 at 15:09
What is the layout file?
– Sukumar Gorai
Jul 3 '18 at 15:09
What is the layout file?
– Sukumar Gorai
Jul 3 '18 at 15:09
I updated it again. It's all working except the code at the end.
– k33n
Jul 3 '18 at 15:14
I updated it again. It's all working except the code at the end.
– k33n
Jul 3 '18 at 15:14
1
1
$this->getFormUrl() instead of $block->getFormUrl()
– Sukumar Gorai
Jul 3 '18 at 15:15
$this->getFormUrl() instead of $block->getFormUrl()
– Sukumar Gorai
Jul 3 '18 at 15:15
|
show 3 more comments
3 Answers
3
active
oldest
votes
Use the below code:
<?= $block->getFormUrl() ?>
or
<?php echo $block->getFormUrl() ?>
or
<?= $this->getFormUrl() ?>
or
<?php echo $this->getFormUrl() ?>
instead of yours
<? $block->getFormUrl() ?>
You have missed = in your php tag.
add a comment |
I would not recommend php short_open_tags. Causes more issues than its worth.
1) are short_open_tags enabled on your server?
2) you have to use echo to print something:
<?php echo $this->doSomething(); ?>
Magento now uses the short tags btw.
– Ben Crook
Jul 3 '18 at 15:42
That is not entirely true as far as i can tell. It uses the<?=tag for echoing links or form actions, but it still uses<?phpfor pretty much everything else. It should also be noted that<?=is available without having to enable short_open_tags in your php.ini. Had a quick check invendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml
– tecjam
Jul 3 '18 at 15:47
Isn't<?=the equivalent of<?php echo? . And just check out any template you'll see they have replaced<?php echowith<?=. First template I went to - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/… The template you mention also uses shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…
– Ben Crook
Jul 3 '18 at 18:44
Even pages completely unrelated to forms are using the shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…
– Ben Crook
Jul 3 '18 at 18:45
Exactly as I said. It is not, however, using short open tags which requires php.ini settings.
– tecjam
Jul 3 '18 at 21:01
add a comment |
Just put the echo
<?php echo $block->getFormUrl() ?>
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2fmagento.stackexchange.com%2fquestions%2f232208%2fmagento-2-print-php-in-template-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use the below code:
<?= $block->getFormUrl() ?>
or
<?php echo $block->getFormUrl() ?>
or
<?= $this->getFormUrl() ?>
or
<?php echo $this->getFormUrl() ?>
instead of yours
<? $block->getFormUrl() ?>
You have missed = in your php tag.
add a comment |
Use the below code:
<?= $block->getFormUrl() ?>
or
<?php echo $block->getFormUrl() ?>
or
<?= $this->getFormUrl() ?>
or
<?php echo $this->getFormUrl() ?>
instead of yours
<? $block->getFormUrl() ?>
You have missed = in your php tag.
add a comment |
Use the below code:
<?= $block->getFormUrl() ?>
or
<?php echo $block->getFormUrl() ?>
or
<?= $this->getFormUrl() ?>
or
<?php echo $this->getFormUrl() ?>
instead of yours
<? $block->getFormUrl() ?>
You have missed = in your php tag.
Use the below code:
<?= $block->getFormUrl() ?>
or
<?php echo $block->getFormUrl() ?>
or
<?= $this->getFormUrl() ?>
or
<?php echo $this->getFormUrl() ?>
instead of yours
<? $block->getFormUrl() ?>
You have missed = in your php tag.
edited Jul 3 '18 at 15:31
answered Jul 3 '18 at 15:20
Sukumar GoraiSukumar Gorai
6,9303729
6,9303729
add a comment |
add a comment |
I would not recommend php short_open_tags. Causes more issues than its worth.
1) are short_open_tags enabled on your server?
2) you have to use echo to print something:
<?php echo $this->doSomething(); ?>
Magento now uses the short tags btw.
– Ben Crook
Jul 3 '18 at 15:42
That is not entirely true as far as i can tell. It uses the<?=tag for echoing links or form actions, but it still uses<?phpfor pretty much everything else. It should also be noted that<?=is available without having to enable short_open_tags in your php.ini. Had a quick check invendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml
– tecjam
Jul 3 '18 at 15:47
Isn't<?=the equivalent of<?php echo? . And just check out any template you'll see they have replaced<?php echowith<?=. First template I went to - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/… The template you mention also uses shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…
– Ben Crook
Jul 3 '18 at 18:44
Even pages completely unrelated to forms are using the shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…
– Ben Crook
Jul 3 '18 at 18:45
Exactly as I said. It is not, however, using short open tags which requires php.ini settings.
– tecjam
Jul 3 '18 at 21:01
add a comment |
I would not recommend php short_open_tags. Causes more issues than its worth.
1) are short_open_tags enabled on your server?
2) you have to use echo to print something:
<?php echo $this->doSomething(); ?>
Magento now uses the short tags btw.
– Ben Crook
Jul 3 '18 at 15:42
That is not entirely true as far as i can tell. It uses the<?=tag for echoing links or form actions, but it still uses<?phpfor pretty much everything else. It should also be noted that<?=is available without having to enable short_open_tags in your php.ini. Had a quick check invendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml
– tecjam
Jul 3 '18 at 15:47
Isn't<?=the equivalent of<?php echo? . And just check out any template you'll see they have replaced<?php echowith<?=. First template I went to - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/… The template you mention also uses shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…
– Ben Crook
Jul 3 '18 at 18:44
Even pages completely unrelated to forms are using the shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…
– Ben Crook
Jul 3 '18 at 18:45
Exactly as I said. It is not, however, using short open tags which requires php.ini settings.
– tecjam
Jul 3 '18 at 21:01
add a comment |
I would not recommend php short_open_tags. Causes more issues than its worth.
1) are short_open_tags enabled on your server?
2) you have to use echo to print something:
<?php echo $this->doSomething(); ?>
I would not recommend php short_open_tags. Causes more issues than its worth.
1) are short_open_tags enabled on your server?
2) you have to use echo to print something:
<?php echo $this->doSomething(); ?>
answered Jul 3 '18 at 15:25
tecjamtecjam
2,75721540
2,75721540
Magento now uses the short tags btw.
– Ben Crook
Jul 3 '18 at 15:42
That is not entirely true as far as i can tell. It uses the<?=tag for echoing links or form actions, but it still uses<?phpfor pretty much everything else. It should also be noted that<?=is available without having to enable short_open_tags in your php.ini. Had a quick check invendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml
– tecjam
Jul 3 '18 at 15:47
Isn't<?=the equivalent of<?php echo? . And just check out any template you'll see they have replaced<?php echowith<?=. First template I went to - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/… The template you mention also uses shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…
– Ben Crook
Jul 3 '18 at 18:44
Even pages completely unrelated to forms are using the shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…
– Ben Crook
Jul 3 '18 at 18:45
Exactly as I said. It is not, however, using short open tags which requires php.ini settings.
– tecjam
Jul 3 '18 at 21:01
add a comment |
Magento now uses the short tags btw.
– Ben Crook
Jul 3 '18 at 15:42
That is not entirely true as far as i can tell. It uses the<?=tag for echoing links or form actions, but it still uses<?phpfor pretty much everything else. It should also be noted that<?=is available without having to enable short_open_tags in your php.ini. Had a quick check invendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml
– tecjam
Jul 3 '18 at 15:47
Isn't<?=the equivalent of<?php echo? . And just check out any template you'll see they have replaced<?php echowith<?=. First template I went to - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/… The template you mention also uses shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…
– Ben Crook
Jul 3 '18 at 18:44
Even pages completely unrelated to forms are using the shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…
– Ben Crook
Jul 3 '18 at 18:45
Exactly as I said. It is not, however, using short open tags which requires php.ini settings.
– tecjam
Jul 3 '18 at 21:01
Magento now uses the short tags btw.
– Ben Crook
Jul 3 '18 at 15:42
Magento now uses the short tags btw.
– Ben Crook
Jul 3 '18 at 15:42
That is not entirely true as far as i can tell. It uses the
<?= tag for echoing links or form actions, but it still uses <?php for pretty much everything else. It should also be noted that <?= is available without having to enable short_open_tags in your php.ini. Had a quick check in vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml– tecjam
Jul 3 '18 at 15:47
That is not entirely true as far as i can tell. It uses the
<?= tag for echoing links or form actions, but it still uses <?php for pretty much everything else. It should also be noted that <?= is available without having to enable short_open_tags in your php.ini. Had a quick check in vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml– tecjam
Jul 3 '18 at 15:47
Isn't
<?= the equivalent of <?php echo? . And just check out any template you'll see they have replaced <?php echo with <?=. First template I went to - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/… The template you mention also uses shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…– Ben Crook
Jul 3 '18 at 18:44
Isn't
<?= the equivalent of <?php echo? . And just check out any template you'll see they have replaced <?php echo with <?=. First template I went to - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/… The template you mention also uses shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…– Ben Crook
Jul 3 '18 at 18:44
Even pages completely unrelated to forms are using the shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…
– Ben Crook
Jul 3 '18 at 18:45
Even pages completely unrelated to forms are using the shorthand - github.com/magento/magento2/blob/2.2-develop/app/code/Magento/…
– Ben Crook
Jul 3 '18 at 18:45
Exactly as I said. It is not, however, using short open tags which requires php.ini settings.
– tecjam
Jul 3 '18 at 21:01
Exactly as I said. It is not, however, using short open tags which requires php.ini settings.
– tecjam
Jul 3 '18 at 21:01
add a comment |
Just put the echo
<?php echo $block->getFormUrl() ?>
add a comment |
Just put the echo
<?php echo $block->getFormUrl() ?>
add a comment |
Just put the echo
<?php echo $block->getFormUrl() ?>
Just put the echo
<?php echo $block->getFormUrl() ?>
answered Jul 3 '18 at 17:12
RaviRavi
190113
190113
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- 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%2fmagento.stackexchange.com%2fquestions%2f232208%2fmagento-2-print-php-in-template-file%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
Update the pull path of file and the whole code of that file to the question
– Sukumar Gorai
Jul 3 '18 at 15:03
I have updated it.
– k33n
Jul 3 '18 at 15:09
What is the layout file?
– Sukumar Gorai
Jul 3 '18 at 15:09
I updated it again. It's all working except the code at the end.
– k33n
Jul 3 '18 at 15:14
1
$this->getFormUrl() instead of $block->getFormUrl()
– Sukumar Gorai
Jul 3 '18 at 15:15