<?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>
Add a comment
|
3 Answers
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.
-
-
Can you check the model name? Is it correct or recheck the model? Commented May 2, 2018 at 12:55
-
-
Try this code Mage::getModel('custom/homebanner')->getCollection(); Commented May 2, 2018 at 15:32
You are accessing data wrong way. Please follow below way:
$model = Mage::getModel('custom_homebanner/request')->getCollection();
foreach($model as $data){
echo $data->getCustomHomebannerText();
}
-
-
-
-
<?php $model = Mage::getModel('custom_homebanner/request')->getCollection(); foreach($model as $data){ echo $data->getCustomHomebannerText(); }– YKBCommented May 2, 2018 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>– YKBCommented May 2, 2018 at 12:39
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>