1
<?php
    $model = Mage::getModel('custom_homebanner/request')->getCollection()
?>
<div class="owl-carousel"  id="owl-demo-intro" >
    <div class="item">
        <h2 class="all_caps color_white"><?php echo $banner->custom_homebanner_text ?></h2>
        <!-- <figure id="mouse-pointer"></figure> -->
    </div>
    <div class="item">
        <h1 class="color_white all_caps"><?php echo $banner->custom_homebanner_text1 ?></h1>
        <!-- <figure id="mouse-pointer"></figure> -->
    </div>
    <div class="item">
        <h2 class="color_white all_caps"><?php echo $banner->custom_homebanner_text2 ?></h2>
        <!-- <figure id="mouse-pointer"></figure> -->
    </div>
</div>
1

If you are using collection and want to loop and print the data then use for loop to iterate over it.

<?php $model = Mage::getModel('custom_homebanner/request')->getCollection(); ?>
<div>
    <?php foreach($model as $banner): ?>
    <div>
       <h2 class="all_caps color_white"><?php echo $banner->getCustomHomebannerText() ?></h2>
        <!-- <figure id="mouse-pointer"></figure> -->
    </div>
    <div class="item">
        <h1 class="color_white all_caps"><?php echo $banner->getCustomHomebannerText1() ?></h1>
        <!-- <figure id="mouse-pointer"></figure> -->
    </div>
    <div class="item">
        <h2 class="color_white all_caps"><?php echo $banner->getCustomHomebannerText2() ?></h2>
        <!-- <figure id="mouse-pointer"></figure> -->
    </div>
    <?php endforeach; ?>
</div>

If you want the first Item from your collection you should use getFirstItem() method

<?php $model = Mage::getModel('custom_homebanner/request')->getCollection()->getFirstItem(); ?>
<div>
    <div>
       <h2 class="all_caps color_white"><?php echo $model->getCustomHomebannerText() ?></h2>
        <!-- <figure id="mouse-pointer"></figure> -->
    </div>
</div>

If you have Id of the Item you want you can use load() method

<?php $model = Mage::getModel('custom_homebanner/request')->load(1); ?>
<div>
    <div>
       <h2 class="all_caps color_white"><?php echo $model->getCustomHomebannerText() ?></h2>
        <!-- <figure id="mouse-pointer"></figure> -->
    </div>
</div>
0

Use below code

<?php echo $banner->getCustomHomebannerText(); ?>

Instead of

<?php echo $banner->custom_homebanner_text ?>

If still not works then print your collection and check if the values are correctly showing or not.

  • This code is not working. – YKB May 2 '18 at 12:29
  • Can you check the model name? Is it correct or recheck the model? – Sukumar Gorai May 2 '18 at 12:55
  • Model name is: custom_homebanner – YKB May 2 '18 at 13:03
  • Try this code Mage::getModel('custom/homebanner')->getCollection(); – Sukumar Gorai May 2 '18 at 15:32
0

You are accessing data wrong way. Please follow below way:

  $model = Mage::getModel('custom_homebanner/request')->getCollection();
  foreach($model as $data){
   echo $data->getCustomHomebannerText();
  }
  • Try to understand my question and the code which I wrote. – YKB May 2 '18 at 12:31
  • have you getting collection ? – Prasanta Hatui May 2 '18 at 12:34
  • Not yet, but I tried the above code also. – YKB May 2 '18 at 12:38
  • <?php $model = Mage::getModel('custom_homebanner/request')->getCollection(); foreach($model as $data){ echo $data->getCustomHomebannerText(); } – YKB May 2 '18 at 12:39
  • <div class="owl-carousel" id="owl-demo-intro" > <div class="item"> <h2 class="all_caps color_white"><?php echo $banner->custom_homebanner_text ?></h2> </div> <div class="item"> <h1 class="color_white all_caps"><?php echo $banner->custom_homebanner_text1 ?></h1> </div> <div class="item"> <h2 class="color_white all_caps"><?php echo $banner->custom_homebanner_text2 ?></h2> </div> </div> – YKB May 2 '18 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.