# Using same Cell (with Helper) multiple times on same page results in fatal error (Cannot declare Helper class)

**URL:** <https://discourse.cakephp.org/t/using-same-cell-with-helper-multiple-times-on-same-page-results-in-fatal-error-cannot-declare-helper-class/9892>\
**Category:** Need Help\
**Created:** [November 6, 2021, 1:54pm UTC](https://discourse.cakephp.org/t/using-same-cell-with-helper-multiple-times-on-same-page-results-in-fatal-error-cannot-declare-helper-class/9892 "2021-11-06T13:54:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elbert](https://avatars.discourse-cdn.com/v4/letter/e/35a633/32.png) [@elbert](https://discourse.cakephp.org/u/elbert)\
**Post date:** [November 6, 2021, 1:54pm UTC](https://discourse.cakephp.org/t/using-same-cell-with-helper-multiple-times-on-same-page-results-in-fatal-error-cannot-declare-helper-class/9892/1 "2021-11-06T13:54:48Z")

</div>

Hi Everyone,

Ik have a problem with using the same Cell multiple times on the same page. The simplified version is:

To start with, I have a PagesController with a View action

```auto
    public function view()
    { }

```

So I have a View file in the Template/Pages/ folder, named ‘view.ctp’. The content of this view file is:

```auto
<?php
$section = $this->cell('Test', [1]);
echo $section;

```

I have a standard Cell, named TestCell (in the View/Cell folder) with this content:

```auto
<?php
namespace App\View\Cell;
use Cake\View\Cell;
class TestCell extends Cell
{
    protected $_validCellOptions = [];
    public function initialize()
    {
    }
    public function display($number)
    {
        $calc = $number+1;
        $this->set(compact('calc'));
    }
}

```

And a view file for the Cell, named ‘display.ctp’ (in the folder Template/Cell/Test) with this content:

```auto
<?php
echo $this->Number->currency($calc, 'EUR') ;

```

When I now visit the page project/Pages/View, The page loads as it should and I see:

> € 2,00

PERFECT! So far so good! But now my problem:  
I would like to do the following in the view.ctp file (of course: simplified):

```auto
<?php
$section = $this->cell('Test', [1]);
echo $section;
$section_2 = $this->cell('Test', [5]);
echo $section_2;

```

I had expected that would work, but: It gives me the following error:

> **Fatal error** : Cannot declare class Cake\View\Helper\NumberHelper, because the name is already in use in **C:\xampp\htdocs\lpos\src\View\Helper\NumberHelper.php** on line **30**

I get that the NumberHelper is loaded twice somehow, and that the Cell seems to to this, but: I don’t know how to get around it or fix the issue.  
I hope someone can help me out! Thanks in advance.

---

<div class="post-metadata">

**Author:** ![KevinPfeifer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kevinpfeifer/32/3365_2.png) [@KevinPfeifer](https://discourse.cakephp.org/u/KevinPfeifer)\
**Post date:** [November 7, 2021, 5:07pm UTC](https://discourse.cakephp.org/t/using-same-cell-with-helper-multiple-times-on-same-page-results-in-fatal-error-cannot-declare-helper-class/9892/2 "2021-11-07T17:07:52Z")

</div>

It seems like you have a custom View Helper in `src\View\Helper\NumberHelper.php`

are you sure you only load that in your `src/View/AppView.php` like that?

```auto
    public function initialize(): void {
        $this->loadHelper( 'Number' );
    }

```

Or how you you load your custom helper.

---

<div class="post-metadata">

**Author:** ![elbert](https://avatars.discourse-cdn.com/v4/letter/e/35a633/32.png) [@elbert](https://discourse.cakephp.org/u/elbert)\
**Post date:** [November 8, 2021, 7:35am UTC](https://discourse.cakephp.org/t/using-same-cell-with-helper-multiple-times-on-same-page-results-in-fatal-error-cannot-declare-helper-class/9892/4 "2021-11-08T07:35:25Z")

</div>

Hi Kevin,

THANK YOU!

You have pointed me in the right direction, and that helps me out A LOT. I have been struggeling with this for some time and simply did not know where to start/look (this is a bit above my head).  
To be honest; I still do not completely understand it all, but you have now given me a starting point.  
Again: thanks! and have a great day.
