Magento 2 | Create frontend route The Next CEO of Stack OverflowMagento 2 - Sample module displays blank pageHow can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlMagento 2: How to define scope in di.xml & Router.phpmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2 The page isn’t redirecting properly in custom moduleHow to create a shorter route in Magento 2?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom Options

Is it ever safe to open a suspicious html file (e.g. email attachment)?

Different harmonic changes implied by a simple descending scale

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

Inappropriate reference requests from Journal reviewers

What exact does MIB represent in SNMP? How is it different from OID?

What was the first Unix version to run on a microcomputer?

Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?

Why did we only see the N-1 starfighters in one film?

If a black hole is created from light, can this black hole then move at speed of light?

MessageLevel in QGIS3

Is there a way to save my career from absolute disaster?

How to count occurrences of text in a file?

If/When UK leaves the EU, can a future goverment conduct a referendum to join the EU?

Extending anchors in TikZ

What's the best way to handle refactoring a big file?

Can we say or write : "No, it'sn't"?

How fast would a person need to move to trick the eye?

At which OSI layer a user-generated data resides?

How does the mv command work with external drives?

Won the lottery - how do I keep the money?

Would a galaxy be visible from outside, but nearby?

Why does standard notation not preserve intervals (visually)

"and that skill is always a class skill for you" - does "always" have any meaning in Pathfinder?

What benefits would be gained by using human laborers instead of drones in deep sea mining?



Magento 2 | Create frontend route



The Next CEO of Stack OverflowMagento 2 - Sample module displays blank pageHow can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlMagento 2: How to define scope in di.xml & Router.phpmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2 The page isn’t redirecting properly in custom moduleHow to create a shorter route in Magento 2?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom Options










5















I want to create a custom frontend route. It should have this link:




www.mysite.com/myroute




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="myroute" frontName="myroute">
<module />
</route>
</router>
</config>


I've already created the route but I don't know where to place the controller.
Can you help me please?



Thanks!










share|improve this question
























  • You can accept answer. If it will helpful for you :)

    – Rohan Hapani
    Jul 18 '18 at 13:32















5















I want to create a custom frontend route. It should have this link:




www.mysite.com/myroute




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="myroute" frontName="myroute">
<module />
</route>
</router>
</config>


I've already created the route but I don't know where to place the controller.
Can you help me please?



Thanks!










share|improve this question
























  • You can accept answer. If it will helpful for you :)

    – Rohan Hapani
    Jul 18 '18 at 13:32













5












5








5








I want to create a custom frontend route. It should have this link:




www.mysite.com/myroute




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="myroute" frontName="myroute">
<module />
</route>
</router>
</config>


I've already created the route but I don't know where to place the controller.
Can you help me please?



Thanks!










share|improve this question
















I want to create a custom frontend route. It should have this link:




www.mysite.com/myroute




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="myroute" frontName="myroute">
<module />
</route>
</router>
</config>


I've already created the route but I don't know where to place the controller.
Can you help me please?



Thanks!







magento2 router






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 14 mins ago







k33n

















asked Jul 18 '18 at 13:20









k33nk33n

455110




455110












  • You can accept answer. If it will helpful for you :)

    – Rohan Hapani
    Jul 18 '18 at 13:32

















  • You can accept answer. If it will helpful for you :)

    – Rohan Hapani
    Jul 18 '18 at 13:32
















You can accept answer. If it will helpful for you :)

– Rohan Hapani
Jul 18 '18 at 13:32





You can accept answer. If it will helpful for you :)

– Rohan Hapani
Jul 18 '18 at 13:32










4 Answers
4






active

oldest

votes


















7














Here is complete example of how the fronted route work it is combination of controller,layout,block and template.



Route



app/code/QaisarSatti/HelloWorld/etc/frontend/routes.xml



<?xml version="1.0"?>
<!--
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/-->
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworld" frontName="helloworld">
<module name="QaisarSatti_HelloWorld" />
</route>
</router>
</config>


Controller



app/code/QaisarSatti/HelloWorld/Controller/Index/Index.php



<?php
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/

namespace QaisarSattiHelloWorldControllerIndex;

class Index extends MagentoFrameworkAppActionAction

public function execute()

$this->_view->loadLayout();
$this->_view->renderLayout();




Layout File



app/code/QaisarSatti/HelloWorld/view/frontend/layout/helloworld_index_index.xml



<?xml version="1.0"?>
<!--
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/-->
<page
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
layout="1column"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block
class="QaisarSattiHelloWorldBlockHelloWorld"
name="HelloWorld"
template="QaisarSatti_HelloWorld::HelloWorld.phtml">
.
</block>
</referenceContainer>
</body>
</page>


Template File



app/code/QaisarSatti/HelloWorld/view/frontend/templates/HelloWorld.phtml



<?php
/**
* Catalog Product Rewrite Helper
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/
echo 'Hello World';


Custom Block



app/code/QaisarSatti/HelloWorld/Block/HelloWorld.php



<?php
/**
* Simple Hello World Module
*
* @category QaisarSatti
* @package QaisarSatti_HelloWorld
* @author Muhammad Qaisar Satti
* @Email qaisarssatti@gmail.com
*
*/

namespace QaisarSattiHelloWorldBlock;

class HelloWorld extends MagentoFrameworkViewElementTemplate

public function _prepareLayout()

parent::_prepareLayout();
$this->pageConfig->getTitle()->set(__('First Hello World Module'));
return $this;




Reference






share|improve this answer
































    3














    create Index.php controller in on below path :




    /app/code/UO/NewsletterUV/Controller/Index/




    <?php
    namespace UONewsletterUVControllerIndex;

    use MagentoFrameworkAppActionAction;

    class Index extends Action

    public function execute()

    echo "Controller call successfully";







    share|improve this answer






























      3














      Try this:



      Create PHP file at app/code/UO/NewsletterUV/Controller/Index/ with Index.php.



      Code should be like this in that file.



      namespace UONewsletterUVControllerIndex;

      use MagentoFrameworkAppActionAction;

      /**
      * Class Index
      * @package UONewsletterUVControllerIndexIndex
      */
      class Index extends Action



      /**
      * Function execute
      * @return MagentoFrameworkViewResultPage
      */
      public function execute()

      echo "Rout Called";








      share|improve this answer
































        3














        For this route, the controller must be in UO/NewsletterUv/Controllers ...



        So if you access www.mysite.com/myroute -> it will call UO/Newsletter/Controllers/Index/Index.php



        If you access www.mysite.com/myroute/my-action -> it will call UO/Newsletter/Controllers/MyAction/Index.php.



        And so on...



        The Controllers content looks like Rohan's answer.



        I hope it helps.






        share|improve this answer

























          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
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f235006%2fmagento-2-create-frontend-route%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          4 Answers
          4






          active

          oldest

          votes








          4 Answers
          4






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          7














          Here is complete example of how the fronted route work it is combination of controller,layout,block and template.



          Route



          app/code/QaisarSatti/HelloWorld/etc/frontend/routes.xml



          <?xml version="1.0"?>
          <!--
          /**
          * Simple Hello World Module
          *
          * @category QaisarSatti
          * @package QaisarSatti_HelloWorld
          * @author Muhammad Qaisar Satti
          * @Email qaisarssatti@gmail.com
          *
          */-->
          <config
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
          <router id="standard">
          <route id="helloworld" frontName="helloworld">
          <module name="QaisarSatti_HelloWorld" />
          </route>
          </router>
          </config>


          Controller



          app/code/QaisarSatti/HelloWorld/Controller/Index/Index.php



          <?php
          /**
          * Simple Hello World Module
          *
          * @category QaisarSatti
          * @package QaisarSatti_HelloWorld
          * @author Muhammad Qaisar Satti
          * @Email qaisarssatti@gmail.com
          *
          */

          namespace QaisarSattiHelloWorldControllerIndex;

          class Index extends MagentoFrameworkAppActionAction

          public function execute()

          $this->_view->loadLayout();
          $this->_view->renderLayout();




          Layout File



          app/code/QaisarSatti/HelloWorld/view/frontend/layout/helloworld_index_index.xml



          <?xml version="1.0"?>
          <!--
          /**
          * Simple Hello World Module
          *
          * @category QaisarSatti
          * @package QaisarSatti_HelloWorld
          * @author Muhammad Qaisar Satti
          * @Email qaisarssatti@gmail.com
          *
          */-->
          <page
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          layout="1column"
          xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
          <body>
          <referenceContainer name="content">
          <block
          class="QaisarSattiHelloWorldBlockHelloWorld"
          name="HelloWorld"
          template="QaisarSatti_HelloWorld::HelloWorld.phtml">
          .
          </block>
          </referenceContainer>
          </body>
          </page>


          Template File



          app/code/QaisarSatti/HelloWorld/view/frontend/templates/HelloWorld.phtml



          <?php
          /**
          * Catalog Product Rewrite Helper
          *
          * @category QaisarSatti
          * @package QaisarSatti_HelloWorld
          * @author Muhammad Qaisar Satti
          * @Email qaisarssatti@gmail.com
          *
          */
          echo 'Hello World';


          Custom Block



          app/code/QaisarSatti/HelloWorld/Block/HelloWorld.php



          <?php
          /**
          * Simple Hello World Module
          *
          * @category QaisarSatti
          * @package QaisarSatti_HelloWorld
          * @author Muhammad Qaisar Satti
          * @Email qaisarssatti@gmail.com
          *
          */

          namespace QaisarSattiHelloWorldBlock;

          class HelloWorld extends MagentoFrameworkViewElementTemplate

          public function _prepareLayout()

          parent::_prepareLayout();
          $this->pageConfig->getTitle()->set(__('First Hello World Module'));
          return $this;




          Reference






          share|improve this answer





























            7














            Here is complete example of how the fronted route work it is combination of controller,layout,block and template.



            Route



            app/code/QaisarSatti/HelloWorld/etc/frontend/routes.xml



            <?xml version="1.0"?>
            <!--
            /**
            * Simple Hello World Module
            *
            * @category QaisarSatti
            * @package QaisarSatti_HelloWorld
            * @author Muhammad Qaisar Satti
            * @Email qaisarssatti@gmail.com
            *
            */-->
            <config
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
            <router id="standard">
            <route id="helloworld" frontName="helloworld">
            <module name="QaisarSatti_HelloWorld" />
            </route>
            </router>
            </config>


            Controller



            app/code/QaisarSatti/HelloWorld/Controller/Index/Index.php



            <?php
            /**
            * Simple Hello World Module
            *
            * @category QaisarSatti
            * @package QaisarSatti_HelloWorld
            * @author Muhammad Qaisar Satti
            * @Email qaisarssatti@gmail.com
            *
            */

            namespace QaisarSattiHelloWorldControllerIndex;

            class Index extends MagentoFrameworkAppActionAction

            public function execute()

            $this->_view->loadLayout();
            $this->_view->renderLayout();




            Layout File



            app/code/QaisarSatti/HelloWorld/view/frontend/layout/helloworld_index_index.xml



            <?xml version="1.0"?>
            <!--
            /**
            * Simple Hello World Module
            *
            * @category QaisarSatti
            * @package QaisarSatti_HelloWorld
            * @author Muhammad Qaisar Satti
            * @Email qaisarssatti@gmail.com
            *
            */-->
            <page
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            layout="1column"
            xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
            <body>
            <referenceContainer name="content">
            <block
            class="QaisarSattiHelloWorldBlockHelloWorld"
            name="HelloWorld"
            template="QaisarSatti_HelloWorld::HelloWorld.phtml">
            .
            </block>
            </referenceContainer>
            </body>
            </page>


            Template File



            app/code/QaisarSatti/HelloWorld/view/frontend/templates/HelloWorld.phtml



            <?php
            /**
            * Catalog Product Rewrite Helper
            *
            * @category QaisarSatti
            * @package QaisarSatti_HelloWorld
            * @author Muhammad Qaisar Satti
            * @Email qaisarssatti@gmail.com
            *
            */
            echo 'Hello World';


            Custom Block



            app/code/QaisarSatti/HelloWorld/Block/HelloWorld.php



            <?php
            /**
            * Simple Hello World Module
            *
            * @category QaisarSatti
            * @package QaisarSatti_HelloWorld
            * @author Muhammad Qaisar Satti
            * @Email qaisarssatti@gmail.com
            *
            */

            namespace QaisarSattiHelloWorldBlock;

            class HelloWorld extends MagentoFrameworkViewElementTemplate

            public function _prepareLayout()

            parent::_prepareLayout();
            $this->pageConfig->getTitle()->set(__('First Hello World Module'));
            return $this;




            Reference






            share|improve this answer



























              7












              7








              7







              Here is complete example of how the fronted route work it is combination of controller,layout,block and template.



              Route



              app/code/QaisarSatti/HelloWorld/etc/frontend/routes.xml



              <?xml version="1.0"?>
              <!--
              /**
              * Simple Hello World Module
              *
              * @category QaisarSatti
              * @package QaisarSatti_HelloWorld
              * @author Muhammad Qaisar Satti
              * @Email qaisarssatti@gmail.com
              *
              */-->
              <config
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
              <router id="standard">
              <route id="helloworld" frontName="helloworld">
              <module name="QaisarSatti_HelloWorld" />
              </route>
              </router>
              </config>


              Controller



              app/code/QaisarSatti/HelloWorld/Controller/Index/Index.php



              <?php
              /**
              * Simple Hello World Module
              *
              * @category QaisarSatti
              * @package QaisarSatti_HelloWorld
              * @author Muhammad Qaisar Satti
              * @Email qaisarssatti@gmail.com
              *
              */

              namespace QaisarSattiHelloWorldControllerIndex;

              class Index extends MagentoFrameworkAppActionAction

              public function execute()

              $this->_view->loadLayout();
              $this->_view->renderLayout();




              Layout File



              app/code/QaisarSatti/HelloWorld/view/frontend/layout/helloworld_index_index.xml



              <?xml version="1.0"?>
              <!--
              /**
              * Simple Hello World Module
              *
              * @category QaisarSatti
              * @package QaisarSatti_HelloWorld
              * @author Muhammad Qaisar Satti
              * @Email qaisarssatti@gmail.com
              *
              */-->
              <page
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              layout="1column"
              xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
              <body>
              <referenceContainer name="content">
              <block
              class="QaisarSattiHelloWorldBlockHelloWorld"
              name="HelloWorld"
              template="QaisarSatti_HelloWorld::HelloWorld.phtml">
              .
              </block>
              </referenceContainer>
              </body>
              </page>


              Template File



              app/code/QaisarSatti/HelloWorld/view/frontend/templates/HelloWorld.phtml



              <?php
              /**
              * Catalog Product Rewrite Helper
              *
              * @category QaisarSatti
              * @package QaisarSatti_HelloWorld
              * @author Muhammad Qaisar Satti
              * @Email qaisarssatti@gmail.com
              *
              */
              echo 'Hello World';


              Custom Block



              app/code/QaisarSatti/HelloWorld/Block/HelloWorld.php



              <?php
              /**
              * Simple Hello World Module
              *
              * @category QaisarSatti
              * @package QaisarSatti_HelloWorld
              * @author Muhammad Qaisar Satti
              * @Email qaisarssatti@gmail.com
              *
              */

              namespace QaisarSattiHelloWorldBlock;

              class HelloWorld extends MagentoFrameworkViewElementTemplate

              public function _prepareLayout()

              parent::_prepareLayout();
              $this->pageConfig->getTitle()->set(__('First Hello World Module'));
              return $this;




              Reference






              share|improve this answer















              Here is complete example of how the fronted route work it is combination of controller,layout,block and template.



              Route



              app/code/QaisarSatti/HelloWorld/etc/frontend/routes.xml



              <?xml version="1.0"?>
              <!--
              /**
              * Simple Hello World Module
              *
              * @category QaisarSatti
              * @package QaisarSatti_HelloWorld
              * @author Muhammad Qaisar Satti
              * @Email qaisarssatti@gmail.com
              *
              */-->
              <config
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
              <router id="standard">
              <route id="helloworld" frontName="helloworld">
              <module name="QaisarSatti_HelloWorld" />
              </route>
              </router>
              </config>


              Controller



              app/code/QaisarSatti/HelloWorld/Controller/Index/Index.php



              <?php
              /**
              * Simple Hello World Module
              *
              * @category QaisarSatti
              * @package QaisarSatti_HelloWorld
              * @author Muhammad Qaisar Satti
              * @Email qaisarssatti@gmail.com
              *
              */

              namespace QaisarSattiHelloWorldControllerIndex;

              class Index extends MagentoFrameworkAppActionAction

              public function execute()

              $this->_view->loadLayout();
              $this->_view->renderLayout();




              Layout File



              app/code/QaisarSatti/HelloWorld/view/frontend/layout/helloworld_index_index.xml



              <?xml version="1.0"?>
              <!--
              /**
              * Simple Hello World Module
              *
              * @category QaisarSatti
              * @package QaisarSatti_HelloWorld
              * @author Muhammad Qaisar Satti
              * @Email qaisarssatti@gmail.com
              *
              */-->
              <page
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              layout="1column"
              xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
              <body>
              <referenceContainer name="content">
              <block
              class="QaisarSattiHelloWorldBlockHelloWorld"
              name="HelloWorld"
              template="QaisarSatti_HelloWorld::HelloWorld.phtml">
              .
              </block>
              </referenceContainer>
              </body>
              </page>


              Template File



              app/code/QaisarSatti/HelloWorld/view/frontend/templates/HelloWorld.phtml



              <?php
              /**
              * Catalog Product Rewrite Helper
              *
              * @category QaisarSatti
              * @package QaisarSatti_HelloWorld
              * @author Muhammad Qaisar Satti
              * @Email qaisarssatti@gmail.com
              *
              */
              echo 'Hello World';


              Custom Block



              app/code/QaisarSatti/HelloWorld/Block/HelloWorld.php



              <?php
              /**
              * Simple Hello World Module
              *
              * @category QaisarSatti
              * @package QaisarSatti_HelloWorld
              * @author Muhammad Qaisar Satti
              * @Email qaisarssatti@gmail.com
              *
              */

              namespace QaisarSattiHelloWorldBlock;

              class HelloWorld extends MagentoFrameworkViewElementTemplate

              public function _prepareLayout()

              parent::_prepareLayout();
              $this->pageConfig->getTitle()->set(__('First Hello World Module'));
              return $this;




              Reference







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Aug 2 '18 at 12:50









              Marc-André Appel

              1034




              1034










              answered Jul 19 '18 at 6:41









              Qaisar SattiQaisar Satti

              27k1256109




              27k1256109























                  3














                  create Index.php controller in on below path :




                  /app/code/UO/NewsletterUV/Controller/Index/




                  <?php
                  namespace UONewsletterUVControllerIndex;

                  use MagentoFrameworkAppActionAction;

                  class Index extends Action

                  public function execute()

                  echo "Controller call successfully";







                  share|improve this answer



























                    3














                    create Index.php controller in on below path :




                    /app/code/UO/NewsletterUV/Controller/Index/




                    <?php
                    namespace UONewsletterUVControllerIndex;

                    use MagentoFrameworkAppActionAction;

                    class Index extends Action

                    public function execute()

                    echo "Controller call successfully";







                    share|improve this answer

























                      3












                      3








                      3







                      create Index.php controller in on below path :




                      /app/code/UO/NewsletterUV/Controller/Index/




                      <?php
                      namespace UONewsletterUVControllerIndex;

                      use MagentoFrameworkAppActionAction;

                      class Index extends Action

                      public function execute()

                      echo "Controller call successfully";







                      share|improve this answer













                      create Index.php controller in on below path :




                      /app/code/UO/NewsletterUV/Controller/Index/




                      <?php
                      namespace UONewsletterUVControllerIndex;

                      use MagentoFrameworkAppActionAction;

                      class Index extends Action

                      public function execute()

                      echo "Controller call successfully";








                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jul 18 '18 at 13:26









                      Rohan HapaniRohan Hapani

                      6,76331865




                      6,76331865





















                          3














                          Try this:



                          Create PHP file at app/code/UO/NewsletterUV/Controller/Index/ with Index.php.



                          Code should be like this in that file.



                          namespace UONewsletterUVControllerIndex;

                          use MagentoFrameworkAppActionAction;

                          /**
                          * Class Index
                          * @package UONewsletterUVControllerIndexIndex
                          */
                          class Index extends Action



                          /**
                          * Function execute
                          * @return MagentoFrameworkViewResultPage
                          */
                          public function execute()

                          echo "Rout Called";








                          share|improve this answer





























                            3














                            Try this:



                            Create PHP file at app/code/UO/NewsletterUV/Controller/Index/ with Index.php.



                            Code should be like this in that file.



                            namespace UONewsletterUVControllerIndex;

                            use MagentoFrameworkAppActionAction;

                            /**
                            * Class Index
                            * @package UONewsletterUVControllerIndexIndex
                            */
                            class Index extends Action



                            /**
                            * Function execute
                            * @return MagentoFrameworkViewResultPage
                            */
                            public function execute()

                            echo "Rout Called";








                            share|improve this answer



























                              3












                              3








                              3







                              Try this:



                              Create PHP file at app/code/UO/NewsletterUV/Controller/Index/ with Index.php.



                              Code should be like this in that file.



                              namespace UONewsletterUVControllerIndex;

                              use MagentoFrameworkAppActionAction;

                              /**
                              * Class Index
                              * @package UONewsletterUVControllerIndexIndex
                              */
                              class Index extends Action



                              /**
                              * Function execute
                              * @return MagentoFrameworkViewResultPage
                              */
                              public function execute()

                              echo "Rout Called";








                              share|improve this answer















                              Try this:



                              Create PHP file at app/code/UO/NewsletterUV/Controller/Index/ with Index.php.



                              Code should be like this in that file.



                              namespace UONewsletterUVControllerIndex;

                              use MagentoFrameworkAppActionAction;

                              /**
                              * Class Index
                              * @package UONewsletterUVControllerIndexIndex
                              */
                              class Index extends Action



                              /**
                              * Function execute
                              * @return MagentoFrameworkViewResultPage
                              */
                              public function execute()

                              echo "Rout Called";









                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Jul 18 '18 at 13:34

























                              answered Jul 18 '18 at 13:27









                              kunjkunj

                              2,6702523




                              2,6702523





















                                  3














                                  For this route, the controller must be in UO/NewsletterUv/Controllers ...



                                  So if you access www.mysite.com/myroute -> it will call UO/Newsletter/Controllers/Index/Index.php



                                  If you access www.mysite.com/myroute/my-action -> it will call UO/Newsletter/Controllers/MyAction/Index.php.



                                  And so on...



                                  The Controllers content looks like Rohan's answer.



                                  I hope it helps.






                                  share|improve this answer





























                                    3














                                    For this route, the controller must be in UO/NewsletterUv/Controllers ...



                                    So if you access www.mysite.com/myroute -> it will call UO/Newsletter/Controllers/Index/Index.php



                                    If you access www.mysite.com/myroute/my-action -> it will call UO/Newsletter/Controllers/MyAction/Index.php.



                                    And so on...



                                    The Controllers content looks like Rohan's answer.



                                    I hope it helps.






                                    share|improve this answer



























                                      3












                                      3








                                      3







                                      For this route, the controller must be in UO/NewsletterUv/Controllers ...



                                      So if you access www.mysite.com/myroute -> it will call UO/Newsletter/Controllers/Index/Index.php



                                      If you access www.mysite.com/myroute/my-action -> it will call UO/Newsletter/Controllers/MyAction/Index.php.



                                      And so on...



                                      The Controllers content looks like Rohan's answer.



                                      I hope it helps.






                                      share|improve this answer















                                      For this route, the controller must be in UO/NewsletterUv/Controllers ...



                                      So if you access www.mysite.com/myroute -> it will call UO/Newsletter/Controllers/Index/Index.php



                                      If you access www.mysite.com/myroute/my-action -> it will call UO/Newsletter/Controllers/MyAction/Index.php.



                                      And so on...



                                      The Controllers content looks like Rohan's answer.



                                      I hope it helps.







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Jul 18 '18 at 13:52

























                                      answered Jul 18 '18 at 13:30









                                      lpFranzlpFranz

                                      362113




                                      362113



























                                          draft saved

                                          draft discarded
















































                                          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.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f235006%2fmagento-2-create-frontend-route%23new-answer', 'question_page');

                                          );

                                          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







                                          Popular posts from this blog

                                          Best approach to update all entries in a list that is paginated?Best way to add items to a paginated listChoose Your Country: Best Usability approachUpdate list when a user is viewing the list without annoying themWhen would the best day to update your webpage be?What should happen when I add a Row to a paginated, sorted listShould I adopt infinite scrolling or classical pagination?How to show user that page objects automatically updateWhat is the best location to locate the comments section in a list pageBest way to combine filtering and selecting items in a listWhen one of two inputs must be updated to satisfy a consistency criteria, which should you update (if at all)?

                                          Вунгтау (аеропорт) Загальні відомості | Див. також | Посилання | Навігаційне меню10°22′00″ пн. ш. 107°05′00″ сх. д. / 10.36667° пн. ш. 107.08333° сх. д. / 10.36667; 107.0833310°22′00″ пн. ш. 107°05′00″ сх. д. / 10.36667° пн. ш. 107.08333° сх. д. / 10.36667; 107.083337731608Vinh AirportVinh airport facelift improves serviceвиправивши або дописавши їївиправивши або дописавши їїр

                                          Тонконіг бульбистий Зміст Опис | Поширення | Екологія | Господарське значення | Примітки | Див. також | Література | Джерела | Посилання | Навігаційне меню1114601320038-241116202404kew-435458Poa bulbosaЭлектронный каталог сосудистых растений Азиатской России [Електронний каталог судинних рослин Азіатської Росії]Малышев Л. Л. Дикие родичи культурных растений. Poa bulbosa L. - Мятлик луковичный. [Малишев Л. Л. Дикі родичи культурних рослин. Poa bulbosa L. - Тонконіг бульбистий.]Мятлик (POA) Сем. Злаки (Мятликовые) [Тонконіг (POA) Род. Злаки (Тонконогові)]Poa bulbosa Linnaeus, Sp. Pl. 1: 70. 1753. 鳞茎早熟禾 lin jing zao shu he (Description from Flora of China) [Poa bulbosa Linnaeus, Sp. Pl. 1: 70. 1753. 鳞茎早熟禾 lin jing zao shu he (Опис від Флора Китаю)]Poa bulbosa L. – lipnice cibulkatá / lipnica cibulkatáPoa bulbosa в базі даних Poa bulbosa на сайті Poa bulbosa в базі даних «Global Biodiversity Information Facility» (GBIF)Poa bulbosa в базі даних «Euro + Med PlantBase» — інформаційному ресурсі для Євро-середземноморського розмаїття рослинPoa bulbosa L. на сайті «Плантариум»