tags:

views:

61

answers:

1

It seems for me that objects in CakePHP are too much overloaded. I've output debug in my layout: debug($this); and I found 6 instances of HTML helper object:

[Html] => HtmlHelper Object
        ([tags] => Array
             ([meta] => <meta%s/>
              [metalink] => <link href="%s"%s/>
              [link] => <a href="%s"%s>%s</a>
              [mailto] => <a href="mailto:%s" %s>%s</a>
              [form] => <form %s>
              .........................................
              .........................................

Why is that and is it possible to reduce this quantity to 1 instance?

+1  A: 

It's likely they're all references to the same instance.

To prove that they are, you could modify the helper constructor to include your own debug trace.

spoulson
Could you provide more specifics? Where can I find the helper constructor?
bancer
Look in `cake/libs/views/helpers/html.php`.
spoulson
I have not found the __construct or similar method there. What did you mean by "helper constructor"?
bancer
If the `__construct` method isn't there, you're free to create one. If there's any confusion as to what the html helper is or why it's here, check out the CakePHP book section 2.4.4 View Conventions http://book.cakephp.org/view/906/View-Conventions
spoulson