Skip to main content
Improving the question
Source Link
Rafael Corrêa Gomes
  • 13.7k
  • 14
  • 91
  • 181

I'm from Brazil, so sorry for bad English, I'd like to display data from the database table on my frontend screen, I'm trying this way:

Teste/Cadastro/Block/Tabela.phpTeste/Cadastro/Block/Tabela.php

<?php
class Teste_Cadastro_Block extends Mage_Core_Block_Template
{

        public function getContent()
     {
        $cadastroModel = Mage::getModel('cadastro/cadastro');

        $collections = $cadastroModel->getCollection();

            foreach($collections as $collection)
        {
             print_r($collection->getdata(''));
        }
?>

default/template/cadastro/cadastro.phtmldefault/template/cadastro/cadastro.phtml

...
            <div>
                    <?php echo $this->getContent(); ?>
            </div>
...

And in my config.xmlconfig.xml I have the declared block.

Does this have to be done through a block or even an action?

I'm from Brazil, so sorry for bad English, I'd like to display data from the database table on my frontend screen, I'm trying this way

Teste/Cadastro/Block/Tabela.php

<?php
class Teste_Cadastro_Block extends Mage_Core_Block_Template
{

        public function getContent()
     {
        $cadastroModel = Mage::getModel('cadastro/cadastro');

        $collections = $cadastroModel->getCollection();

            foreach($collections as $collection)
        {
             print_r($collection->getdata(''));
        }
?>

default/template/cadastro/cadastro.phtml

...
            <div>
                    <?php echo $this->getContent(); ?>
            </div>
...

And in my config.xml I have the declared block.

Does this have to be done through a block or even an action?

I'd like to display data from the database table on my frontend screen, I'm trying this way:

Teste/Cadastro/Block/Tabela.php

<?php
class Teste_Cadastro_Block extends Mage_Core_Block_Template
{

        public function getContent()
     {
        $cadastroModel = Mage::getModel('cadastro/cadastro');

        $collections = $cadastroModel->getCollection();

            foreach($collections as $collection)
        {
             print_r($collection->getdata(''));
        }
?>

default/template/cadastro/cadastro.phtml

...
            <div>
                    <?php echo $this->getContent(); ?>
            </div>
...

And in my config.xml I have the declared block.

Does this have to be done through a block or even an action?

Source Link

How do I display data from my table in the magento frontend?

I'm from Brazil, so sorry for bad English, I'd like to display data from the database table on my frontend screen, I'm trying this way

Teste/Cadastro/Block/Tabela.php

<?php
class Teste_Cadastro_Block extends Mage_Core_Block_Template
{

        public function getContent()
     {
        $cadastroModel = Mage::getModel('cadastro/cadastro');

        $collections = $cadastroModel->getCollection();

            foreach($collections as $collection)
        {
             print_r($collection->getdata(''));
        }
?>

default/template/cadastro/cadastro.phtml

...
            <div>
                    <?php echo $this->getContent(); ?>
            </div>
...

And in my config.xml I have the declared block.

Does this have to be done through a block or even an action?