How to call custom slider from backend to frontend dynamically in magento2.2.5?Image Slider not working only on Magento Frontend HomepageHow to change store theme dynamicallyHow to use fotorama in Magento 2 as custom slider?Saving page in backend results in 404 on frontendHow to call Owl Slider in Magento2How to get product's frontend url from backend?Backend Block for frontend in Magento2How to Remove description text from product slider - Luma ThemeMake backend url domain different from frontend url domainHow to save custom frontend form to database in Magento2.2.5?

How to regain access to running applications after accidentally zapping X.org?

Does detail obscure or enhance action?

Paid for article while in US on F-1 visa?

Theorems that impeded progress

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

How old can references or sources in a thesis be?

Approximately how much travel time was saved by the opening of the Suez Canal in 1869?

Was any UN Security Council vote triple-vetoed?

Mortgage Pre-approval / Loan - Apply Alone or with Fiancée?

Operational amplifier as a comparator at high frequency

Mutually beneficial digestive system symbiotes

DC-DC converter from low voltage at high current, to high voltage at low current

What does "Puller Prush Person" mean?

Convert two switches to a dual stack, and add outlet - possible here?

Can a monk's single staff be considered dual wielded, as per the Dual Wielder feat?

Is it inappropriate for a student to attend their mentor's dissertation defense?

Which country benefited the most from UN Security Council vetoes?

How to source a part of a file

Linear Path Optimization with Two Dependent Variables

Why doesn't a class having private constructor prevent inheriting from this class? How to control which classes can inherit from a certain base?

Is it possible to do 50 km distance without any previous training?

How can bays and straits be determined in a procedurally generated map?

dbcc cleantable batch size explanation

Did Shadowfax go to Valinor?



How to call custom slider from backend to frontend dynamically in magento2.2.5?


Image Slider not working only on Magento Frontend HomepageHow to change store theme dynamicallyHow to use fotorama in Magento 2 as custom slider?Saving page in backend results in 404 on frontendHow to call Owl Slider in Magento2How to get product's frontend url from backend?Backend Block for frontend in Magento2How to Remove description text from product slider - Luma ThemeMake backend url domain different from frontend url domainHow to save custom frontend form to database in Magento2.2.5?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I have created a custom module in backend for uploading image slider in homepage, but I am not able to call in homepage?(frontend).
I don't know where I am making mistake.



Here is my code.



<?php
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$modelCollection = $objectManager->get('AmyHomebannerModelGrid')->getCollection();
echo "<pre>";
var_dump($modelCollection->getData());
echo "</pre>";
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

?>
<div class="ves-slideshow container">
<div id="owl-demo2" class="owl-carousel owl-theme">
<div class="item">

<div class="ves-slider">

<?php foreach ($modelCollection as $_model) ?>
<?php if ($_model->getIsActive() == '0' && $_model->getPageSelection() == '1') ?>
<li <?php if ($_model->getUrl() != '') ?> onclick="location.href = '<?php echo $_model->getUrl() ?>'" <?php ?>>

<?php if ($deviceDetect->isMobile()) ?>

<img src="<?php echo $this->_storeManager->getStore()->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_MEDIA) . $_model->getImageMobile() ?>" alt="<?php echo $_model['alternate_text'] ?>" title="<?php echo $_model['alternate_text'] ?>" />

<?php else ?>

<img src="<?php echo $this->_storeManager->getStore()->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_MEDIA) . $_model->getImage() ?>" alt="<?php echo $_model['alternate_text'] ?>" title="<?php echo $_model['alternate_text'] ?>" />
<?php ?>
</li>
<?php ?>
<?php ?>
</div>
</div>
</div>




When the status is enabled the homepage shows blank, while the status is disabled the homepage is showing but the slider is not showing.



Any help would be appreciated.










share|improve this question






















  • Nope, it is not module status. It is each field status $_model->getIsActive() == '0'

    – Amy
    Mar 19 at 12:00











  • Do you have helper? if so remove object manager and get the collection by applying filter using DI

    – Prathap Gunasekaran
    Mar 19 at 12:01











  • How did you added this phtml to home page?? via xml or cms?

    – Prathap Gunasekaran
    Mar 19 at 12:01











  • I am using theme. so i override the theme and applied in theme homepage.

    – Amy
    Mar 19 at 12:03











  • Okay i will try it, and let you know..

    – Amy
    Mar 19 at 12:22

















1















I have created a custom module in backend for uploading image slider in homepage, but I am not able to call in homepage?(frontend).
I don't know where I am making mistake.



Here is my code.



<?php
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$modelCollection = $objectManager->get('AmyHomebannerModelGrid')->getCollection();
echo "<pre>";
var_dump($modelCollection->getData());
echo "</pre>";
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

?>
<div class="ves-slideshow container">
<div id="owl-demo2" class="owl-carousel owl-theme">
<div class="item">

<div class="ves-slider">

<?php foreach ($modelCollection as $_model) ?>
<?php if ($_model->getIsActive() == '0' && $_model->getPageSelection() == '1') ?>
<li <?php if ($_model->getUrl() != '') ?> onclick="location.href = '<?php echo $_model->getUrl() ?>'" <?php ?>>

<?php if ($deviceDetect->isMobile()) ?>

<img src="<?php echo $this->_storeManager->getStore()->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_MEDIA) . $_model->getImageMobile() ?>" alt="<?php echo $_model['alternate_text'] ?>" title="<?php echo $_model['alternate_text'] ?>" />

<?php else ?>

<img src="<?php echo $this->_storeManager->getStore()->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_MEDIA) . $_model->getImage() ?>" alt="<?php echo $_model['alternate_text'] ?>" title="<?php echo $_model['alternate_text'] ?>" />
<?php ?>
</li>
<?php ?>
<?php ?>
</div>
</div>
</div>




When the status is enabled the homepage shows blank, while the status is disabled the homepage is showing but the slider is not showing.



Any help would be appreciated.










share|improve this question






















  • Nope, it is not module status. It is each field status $_model->getIsActive() == '0'

    – Amy
    Mar 19 at 12:00











  • Do you have helper? if so remove object manager and get the collection by applying filter using DI

    – Prathap Gunasekaran
    Mar 19 at 12:01











  • How did you added this phtml to home page?? via xml or cms?

    – Prathap Gunasekaran
    Mar 19 at 12:01











  • I am using theme. so i override the theme and applied in theme homepage.

    – Amy
    Mar 19 at 12:03











  • Okay i will try it, and let you know..

    – Amy
    Mar 19 at 12:22













1












1








1








I have created a custom module in backend for uploading image slider in homepage, but I am not able to call in homepage?(frontend).
I don't know where I am making mistake.



Here is my code.



<?php
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$modelCollection = $objectManager->get('AmyHomebannerModelGrid')->getCollection();
echo "<pre>";
var_dump($modelCollection->getData());
echo "</pre>";
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

?>
<div class="ves-slideshow container">
<div id="owl-demo2" class="owl-carousel owl-theme">
<div class="item">

<div class="ves-slider">

<?php foreach ($modelCollection as $_model) ?>
<?php if ($_model->getIsActive() == '0' && $_model->getPageSelection() == '1') ?>
<li <?php if ($_model->getUrl() != '') ?> onclick="location.href = '<?php echo $_model->getUrl() ?>'" <?php ?>>

<?php if ($deviceDetect->isMobile()) ?>

<img src="<?php echo $this->_storeManager->getStore()->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_MEDIA) . $_model->getImageMobile() ?>" alt="<?php echo $_model['alternate_text'] ?>" title="<?php echo $_model['alternate_text'] ?>" />

<?php else ?>

<img src="<?php echo $this->_storeManager->getStore()->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_MEDIA) . $_model->getImage() ?>" alt="<?php echo $_model['alternate_text'] ?>" title="<?php echo $_model['alternate_text'] ?>" />
<?php ?>
</li>
<?php ?>
<?php ?>
</div>
</div>
</div>




When the status is enabled the homepage shows blank, while the status is disabled the homepage is showing but the slider is not showing.



Any help would be appreciated.










share|improve this question














I have created a custom module in backend for uploading image slider in homepage, but I am not able to call in homepage?(frontend).
I don't know where I am making mistake.



Here is my code.



<?php
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$modelCollection = $objectManager->get('AmyHomebannerModelGrid')->getCollection();
echo "<pre>";
var_dump($modelCollection->getData());
echo "</pre>";
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

?>
<div class="ves-slideshow container">
<div id="owl-demo2" class="owl-carousel owl-theme">
<div class="item">

<div class="ves-slider">

<?php foreach ($modelCollection as $_model) ?>
<?php if ($_model->getIsActive() == '0' && $_model->getPageSelection() == '1') ?>
<li <?php if ($_model->getUrl() != '') ?> onclick="location.href = '<?php echo $_model->getUrl() ?>'" <?php ?>>

<?php if ($deviceDetect->isMobile()) ?>

<img src="<?php echo $this->_storeManager->getStore()->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_MEDIA) . $_model->getImageMobile() ?>" alt="<?php echo $_model['alternate_text'] ?>" title="<?php echo $_model['alternate_text'] ?>" />

<?php else ?>

<img src="<?php echo $this->_storeManager->getStore()->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_MEDIA) . $_model->getImage() ?>" alt="<?php echo $_model['alternate_text'] ?>" title="<?php echo $_model['alternate_text'] ?>" />
<?php ?>
</li>
<?php ?>
<?php ?>
</div>
</div>
</div>




When the status is enabled the homepage shows blank, while the status is disabled the homepage is showing but the slider is not showing.



Any help would be appreciated.







magento2 frontend backend slider dynamic






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 19 at 11:36









AmyAmy

3399




3399












  • Nope, it is not module status. It is each field status $_model->getIsActive() == '0'

    – Amy
    Mar 19 at 12:00











  • Do you have helper? if so remove object manager and get the collection by applying filter using DI

    – Prathap Gunasekaran
    Mar 19 at 12:01











  • How did you added this phtml to home page?? via xml or cms?

    – Prathap Gunasekaran
    Mar 19 at 12:01











  • I am using theme. so i override the theme and applied in theme homepage.

    – Amy
    Mar 19 at 12:03











  • Okay i will try it, and let you know..

    – Amy
    Mar 19 at 12:22

















  • Nope, it is not module status. It is each field status $_model->getIsActive() == '0'

    – Amy
    Mar 19 at 12:00











  • Do you have helper? if so remove object manager and get the collection by applying filter using DI

    – Prathap Gunasekaran
    Mar 19 at 12:01











  • How did you added this phtml to home page?? via xml or cms?

    – Prathap Gunasekaran
    Mar 19 at 12:01











  • I am using theme. so i override the theme and applied in theme homepage.

    – Amy
    Mar 19 at 12:03











  • Okay i will try it, and let you know..

    – Amy
    Mar 19 at 12:22
















Nope, it is not module status. It is each field status $_model->getIsActive() == '0'

– Amy
Mar 19 at 12:00





Nope, it is not module status. It is each field status $_model->getIsActive() == '0'

– Amy
Mar 19 at 12:00













Do you have helper? if so remove object manager and get the collection by applying filter using DI

– Prathap Gunasekaran
Mar 19 at 12:01





Do you have helper? if so remove object manager and get the collection by applying filter using DI

– Prathap Gunasekaran
Mar 19 at 12:01













How did you added this phtml to home page?? via xml or cms?

– Prathap Gunasekaran
Mar 19 at 12:01





How did you added this phtml to home page?? via xml or cms?

– Prathap Gunasekaran
Mar 19 at 12:01













I am using theme. so i override the theme and applied in theme homepage.

– Amy
Mar 19 at 12:03





I am using theme. so i override the theme and applied in theme homepage.

– Amy
Mar 19 at 12:03













Okay i will try it, and let you know..

– Amy
Mar 19 at 12:22





Okay i will try it, and let you know..

– Amy
Mar 19 at 12:22










2 Answers
2






active

oldest

votes


















0














There are quite a few issues with your code



  1. You Should not use object manager directly in you files.

  2. You should not call model directly for collection than create a Repository class for you module , create a getlist Method and filter collection using search criteria .

  3. Rather than getting the full collection filter the collection before by checking IsActive == 1


  4. Use ViewModel rather than posting code in you PHTML



    Regarding the above code issue try




 $modelCollection = $objectManager->get('AmyHomebannerModelGrid');
$modelCollection ->getCollection()
->addFieldToSelect('*')
->addFieldToFilter('is_active', '1');
if ($modelCollection->getSize() > 0) {//show slider?>



if you are still facing the issue switch to developer mode and in file 'appbootstrap.php' uncomment the following line



error_reporting(E_ALL);
#ini_set('display_errors', 1);


Your error will be displayed






share|improve this answer






























    0














    Get collection using helper Data.php



    Place Data.php in the below path




    app/code/Amy/Homebanner/Helper/Data.php




    then add the below code to get the collection by filter i.e., is_active = '0' and page_selection = '1' so



    <?php
    namespace AmyHomebannerHelper;
    use MagentoFrameworkAppHelperAbstractHelper;
    class Data extends AbstractHelper

    protected $_scopeConfig;
    public function __construct(
    AmyHomebannerModelGridFactory $collection
    )
    $this->collection = $collection;


    public function getCollection()

    $dataCollection = $this->collection->create()->getCollection()->addFieldToSelect('*')->addFieldToFilter('is_active', array(
    'eq' => '0'
    ))->addFieldToFilter('page_selection', array(
    'eq' => '1'
    ));
    return $dataCollection;




    then call this in your phtml



    $data = $this->helper('AmyHomebannerHelperData')->getCollection();


    then foreach to print the collection as you require



    foreach($data as $items)
    echo $items->getIsActive();




    NOTE : Object Manager shouldn't used anywhere since because it will create object each time when the file load. So it consume loads of memory and time. Site will literally slow down. Best practice to go for DI.




    In addition to above answer, enable developer mode check the issue.



    php bin/magento deploy:mode:set developer


    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%2f266516%2fhow-to-call-custom-slider-from-backend-to-frontend-dynamically-in-magento2-2-5%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









      0














      There are quite a few issues with your code



      1. You Should not use object manager directly in you files.

      2. You should not call model directly for collection than create a Repository class for you module , create a getlist Method and filter collection using search criteria .

      3. Rather than getting the full collection filter the collection before by checking IsActive == 1


      4. Use ViewModel rather than posting code in you PHTML



        Regarding the above code issue try




       $modelCollection = $objectManager->get('AmyHomebannerModelGrid');
      $modelCollection ->getCollection()
      ->addFieldToSelect('*')
      ->addFieldToFilter('is_active', '1');
      if ($modelCollection->getSize() > 0) {//show slider?>



      if you are still facing the issue switch to developer mode and in file 'appbootstrap.php' uncomment the following line



      error_reporting(E_ALL);
      #ini_set('display_errors', 1);


      Your error will be displayed






      share|improve this answer



























        0














        There are quite a few issues with your code



        1. You Should not use object manager directly in you files.

        2. You should not call model directly for collection than create a Repository class for you module , create a getlist Method and filter collection using search criteria .

        3. Rather than getting the full collection filter the collection before by checking IsActive == 1


        4. Use ViewModel rather than posting code in you PHTML



          Regarding the above code issue try




         $modelCollection = $objectManager->get('AmyHomebannerModelGrid');
        $modelCollection ->getCollection()
        ->addFieldToSelect('*')
        ->addFieldToFilter('is_active', '1');
        if ($modelCollection->getSize() > 0) {//show slider?>



        if you are still facing the issue switch to developer mode and in file 'appbootstrap.php' uncomment the following line



        error_reporting(E_ALL);
        #ini_set('display_errors', 1);


        Your error will be displayed






        share|improve this answer

























          0












          0








          0







          There are quite a few issues with your code



          1. You Should not use object manager directly in you files.

          2. You should not call model directly for collection than create a Repository class for you module , create a getlist Method and filter collection using search criteria .

          3. Rather than getting the full collection filter the collection before by checking IsActive == 1


          4. Use ViewModel rather than posting code in you PHTML



            Regarding the above code issue try




           $modelCollection = $objectManager->get('AmyHomebannerModelGrid');
          $modelCollection ->getCollection()
          ->addFieldToSelect('*')
          ->addFieldToFilter('is_active', '1');
          if ($modelCollection->getSize() > 0) {//show slider?>



          if you are still facing the issue switch to developer mode and in file 'appbootstrap.php' uncomment the following line



          error_reporting(E_ALL);
          #ini_set('display_errors', 1);


          Your error will be displayed






          share|improve this answer













          There are quite a few issues with your code



          1. You Should not use object manager directly in you files.

          2. You should not call model directly for collection than create a Repository class for you module , create a getlist Method and filter collection using search criteria .

          3. Rather than getting the full collection filter the collection before by checking IsActive == 1


          4. Use ViewModel rather than posting code in you PHTML



            Regarding the above code issue try




           $modelCollection = $objectManager->get('AmyHomebannerModelGrid');
          $modelCollection ->getCollection()
          ->addFieldToSelect('*')
          ->addFieldToFilter('is_active', '1');
          if ($modelCollection->getSize() > 0) {//show slider?>



          if you are still facing the issue switch to developer mode and in file 'appbootstrap.php' uncomment the following line



          error_reporting(E_ALL);
          #ini_set('display_errors', 1);


          Your error will be displayed







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 19 at 12:10









          Vishwas BhatnagarVishwas Bhatnagar

          2,93622046




          2,93622046























              0














              Get collection using helper Data.php



              Place Data.php in the below path




              app/code/Amy/Homebanner/Helper/Data.php




              then add the below code to get the collection by filter i.e., is_active = '0' and page_selection = '1' so



              <?php
              namespace AmyHomebannerHelper;
              use MagentoFrameworkAppHelperAbstractHelper;
              class Data extends AbstractHelper

              protected $_scopeConfig;
              public function __construct(
              AmyHomebannerModelGridFactory $collection
              )
              $this->collection = $collection;


              public function getCollection()

              $dataCollection = $this->collection->create()->getCollection()->addFieldToSelect('*')->addFieldToFilter('is_active', array(
              'eq' => '0'
              ))->addFieldToFilter('page_selection', array(
              'eq' => '1'
              ));
              return $dataCollection;




              then call this in your phtml



              $data = $this->helper('AmyHomebannerHelperData')->getCollection();


              then foreach to print the collection as you require



              foreach($data as $items)
              echo $items->getIsActive();




              NOTE : Object Manager shouldn't used anywhere since because it will create object each time when the file load. So it consume loads of memory and time. Site will literally slow down. Best practice to go for DI.




              In addition to above answer, enable developer mode check the issue.



              php bin/magento deploy:mode:set developer


              Hope it helps .






              share|improve this answer





























                0














                Get collection using helper Data.php



                Place Data.php in the below path




                app/code/Amy/Homebanner/Helper/Data.php




                then add the below code to get the collection by filter i.e., is_active = '0' and page_selection = '1' so



                <?php
                namespace AmyHomebannerHelper;
                use MagentoFrameworkAppHelperAbstractHelper;
                class Data extends AbstractHelper

                protected $_scopeConfig;
                public function __construct(
                AmyHomebannerModelGridFactory $collection
                )
                $this->collection = $collection;


                public function getCollection()

                $dataCollection = $this->collection->create()->getCollection()->addFieldToSelect('*')->addFieldToFilter('is_active', array(
                'eq' => '0'
                ))->addFieldToFilter('page_selection', array(
                'eq' => '1'
                ));
                return $dataCollection;




                then call this in your phtml



                $data = $this->helper('AmyHomebannerHelperData')->getCollection();


                then foreach to print the collection as you require



                foreach($data as $items)
                echo $items->getIsActive();




                NOTE : Object Manager shouldn't used anywhere since because it will create object each time when the file load. So it consume loads of memory and time. Site will literally slow down. Best practice to go for DI.




                In addition to above answer, enable developer mode check the issue.



                php bin/magento deploy:mode:set developer


                Hope it helps .






                share|improve this answer



























                  0












                  0








                  0







                  Get collection using helper Data.php



                  Place Data.php in the below path




                  app/code/Amy/Homebanner/Helper/Data.php




                  then add the below code to get the collection by filter i.e., is_active = '0' and page_selection = '1' so



                  <?php
                  namespace AmyHomebannerHelper;
                  use MagentoFrameworkAppHelperAbstractHelper;
                  class Data extends AbstractHelper

                  protected $_scopeConfig;
                  public function __construct(
                  AmyHomebannerModelGridFactory $collection
                  )
                  $this->collection = $collection;


                  public function getCollection()

                  $dataCollection = $this->collection->create()->getCollection()->addFieldToSelect('*')->addFieldToFilter('is_active', array(
                  'eq' => '0'
                  ))->addFieldToFilter('page_selection', array(
                  'eq' => '1'
                  ));
                  return $dataCollection;




                  then call this in your phtml



                  $data = $this->helper('AmyHomebannerHelperData')->getCollection();


                  then foreach to print the collection as you require



                  foreach($data as $items)
                  echo $items->getIsActive();




                  NOTE : Object Manager shouldn't used anywhere since because it will create object each time when the file load. So it consume loads of memory and time. Site will literally slow down. Best practice to go for DI.




                  In addition to above answer, enable developer mode check the issue.



                  php bin/magento deploy:mode:set developer


                  Hope it helps .






                  share|improve this answer















                  Get collection using helper Data.php



                  Place Data.php in the below path




                  app/code/Amy/Homebanner/Helper/Data.php




                  then add the below code to get the collection by filter i.e., is_active = '0' and page_selection = '1' so



                  <?php
                  namespace AmyHomebannerHelper;
                  use MagentoFrameworkAppHelperAbstractHelper;
                  class Data extends AbstractHelper

                  protected $_scopeConfig;
                  public function __construct(
                  AmyHomebannerModelGridFactory $collection
                  )
                  $this->collection = $collection;


                  public function getCollection()

                  $dataCollection = $this->collection->create()->getCollection()->addFieldToSelect('*')->addFieldToFilter('is_active', array(
                  'eq' => '0'
                  ))->addFieldToFilter('page_selection', array(
                  'eq' => '1'
                  ));
                  return $dataCollection;




                  then call this in your phtml



                  $data = $this->helper('AmyHomebannerHelperData')->getCollection();


                  then foreach to print the collection as you require



                  foreach($data as $items)
                  echo $items->getIsActive();




                  NOTE : Object Manager shouldn't used anywhere since because it will create object each time when the file load. So it consume loads of memory and time. Site will literally slow down. Best practice to go for DI.




                  In addition to above answer, enable developer mode check the issue.



                  php bin/magento deploy:mode:set developer


                  Hope it helps .







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 19 at 12:21

























                  answered Mar 19 at 12:13









                  Prathap GunasekaranPrathap Gunasekaran

                  1,7261618




                  1,7261618



























                      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%2f266516%2fhow-to-call-custom-slider-from-backend-to-frontend-dynamically-in-magento2-2-5%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

                      Identifying “long and narrow” polygons in with PostGISlength and width of polygonWhy postgis st_overlaps reports Qgis' “avoid intersections” generated polygon as overlapping with others?Adjusting polygons to boundary and filling holesDrawing polygons with fixed area?How to remove spikes in Polygons with PostGISDeleting sliver polygons after difference operation in QGIS?Snapping boundaries in PostGISSplit polygon into parts adding attributes based on underlying polygon in QGISSplitting overlap between polygons and assign to nearest polygon using PostGIS?Expanding polygons and clipping at midpoint?Removing Intersection of Buffers in Same Layers

                      Masuk log Menu navigasi

                      อาณาจักร (ชีววิทยา) ดูเพิ่ม อ้างอิง รายการเลือกการนำทาง10.1086/39456810.5962/bhl.title.447410.1126/science.163.3863.150576276010.1007/BF01796092408502"Phylogenetic structure of the prokaryotic domain: the primary kingdoms"10.1073/pnas.74.11.5088432104270744"Towards a natural system of organisms: proposal for the domains Archaea, Bacteria, and Eucarya"1990PNAS...87.4576W10.1073/pnas.87.12.4576541592112744PubMedJump the queueexpand by handPubMedJump the queueexpand by handPubMedJump the queueexpand by hand"A revised six-kingdom system of life"10.1111/j.1469-185X.1998.tb00030.x9809012"Only six kingdoms of life"10.1098/rspb.2004.2705169172415306349"Kingdoms Protozoa and Chromista and the eozoan root of the eukaryotic tree"10.1098/rsbl.2009.0948288006020031978เพิ่มข้อมูล