English 中文(简体)
增设更多职能,帮助公民开设班级
原标题:Adding more functions to helper classes in zend

我的助教

class Zend_View_Helper_CommonArea extends Zend_View_Helper_Abstract {

    public function commonArea()
    {
        ?>

        <div class="clear"></div>
        <div id="quick_search">
            <div class="search">
                        <strong>QUICK SEARCH </strong>

                    <input type="text" name="keyword" id="keyword" value="Enter keywords" class="form" onfocus="if(this.value==this.defaultValue)this.value=  ;" onblur="if(this.value==  )this.value=this.defaultValue;" />
                <select name="select" id="select" class="selectstyled">
                    <option>Prefered Location</option>
                    <option>Prefered Location</option>
                    <option>Prefered Location</option>
                    <option>Prefered Location</option>
                    <option>Prefered Location</option>
                </select>
            </div>
            <div class="bt_box">
                <input name="find" type="submit" class="find" id="search"  value="Find Jobs" />
            </div>
            <div class="resume"><a href="jobseeker.html"><img src="images/resume.jpg" alt="" /></a></div>
        </div>


        <?php
    }
}

以及 我的问题是,我需要对这一类别增加新的职能。 我试图增加新的职能,如增加新的职能。

public function addBox()
    {
        ?>
        <div id="add_right_box"style="height:500px;"><h3 class="add_h2">Width 210px</h3></div>
        <?php
    }

to the above class, but I am getting eror something like Plugin by name AddBox was not found in the registry;

在此,我需要知道,如果是这样的话,我能为帮助者增加更多的职能。

最佳回答

首先,你应退还所有产出,而不是直接重复。

http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.custom” rel=“nofollow” Zend_View_Helper docs :

总的来说,这一类别不应重复或印刷或以其他方式产生产出。 相反,它应当将价值重新印制或回馈。 归还的数值应适当逃脱。

您打电话$this->commonArea()时,将装上共同Area类,然后使用配对法。 因此,请打电话到<代码>$this->addBox(),请看AddBox的类别——它知道你会把它作为共同Area的原始部分。

如果你想从同一个金字面上调取多种方法,则将对应方法退回一个假想的例子:

public function commonArea(){
  return $this;
}

然后,就这样说:

$this->commonArea()->addBox();
$this->commonArea()->display(); //assuming you renamed the original method to  display 

http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers. initial.navigation” rel=“nofollow”>navigation helper placeholder helper to see this patterns.

问题回答

暂无回答




相关问题
Very basic WPF layout question

How do I get this listbox to be maxiumum size, i.e. fill the group box its in. I ve tried width="auto" Height="auto", width="stretch" Height="stretch" annoyingly at the moment, it dynamicly sizes to ...

How to align the text to top of TextView?

How to align the text to top of a TextView? Equivalent Android API for Swings setInsets()? that is top of text should start be in (0,0) of TextView <?xml version="1.0" encoding="utf-8"?> <...

Centring a flow in Shoes

Can I center the contents of a flow in Shoes? I know that a paragraph can be centred like: para Centred paragrpah , :align=> center However, this does not work with flows: flow(:align=> ...

Overlaying with CSS

I want to load a website in an iframe, and overlay the website with some hints about the website that is shown. However, i got stuck at the point that the website has a variable passive white space at ...

How do you normally make a program look beautiful? [closed]

How can I make an Application look nice and not like an amateur pulled it together? I mean graphic-wise. Is there some sort of book you can read regarding beautiful program layouts, etc? I put this ...

热门标签