<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>The Yaf_Bootstrap_Abstract class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="yaf-application.wakeup.html">Yaf_Application::__wakeup</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.yaf-dispatcher.html">Yaf_Dispatcher</a></div> <div class="up"><a href="book.yaf.html">Yaf</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="class.yaf-bootstrap-abstract" class="reference"> <h1 class="title">The Yaf_Bootstrap_Abstract class</h1> <div class="partintro"><p class="verinfo">(No version information available, might only be in SVN)</p> <div class="section" id="yaf-bootstrap-abstract.intro"> <h2 class="title">Introduction</h2> <p class="para"> Bootstrap is a mechanism used to do some intial config before a Application run. </p> <p class="para"> User may define their own Bootstrap class by inheriting <strong class="classname">Yaf_Bootstrap_Abstract</strong> </p> <p class="para"> Any method declared in Bootstrap class with leading "_init", will be called by <span class="methodname"><a href="yaf-application.bootstrap.html" class="methodname">Yaf_Application::bootstrap()</a></span> one by one according to their defined order. </p> </div> <div class="section"> <h2 class="title">Examples</h2> <div class="example" id="example-4125"> <p><strong>Example #1 Bootstrap example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /> </span><span style="color: #FF8000">/* bootstrap class should be defined under ./application/Bootstrap.php */<br /> </span><span style="color: #007700">class </span><span style="color: #0000BB">Bootstrap </span><span style="color: #007700">extends </span><span style="color: #0000BB">Yaf_Bootstrap_Abstract </span><span style="color: #007700">{<br /> public function </span><span style="color: #0000BB">_initConfig</span><span style="color: #007700">(</span><span style="color: #0000BB">Yaf_Dispatcher $dispatcher</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">__METHOD__</span><span style="color: #007700">);<br /> }<br /> public function </span><span style="color: #0000BB">_initPlugin</span><span style="color: #007700">(</span><span style="color: #0000BB">Yaf_Dispatcher $dispatcher</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">__METHOD__</span><span style="color: #007700">);<br /> }<br /> }<br /><br /> </span><span style="color: #0000BB">$config </span><span style="color: #007700">= array(<br /> </span><span style="color: #DD0000">"application" </span><span style="color: #007700">=> array(<br /> </span><span style="color: #DD0000">"directory" </span><span style="color: #007700">=> </span><span style="color: #0000BB">dirname</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">) . </span><span style="color: #DD0000">"/application/"</span><span style="color: #007700">,<br /> ),<br /> );<br /> <br /> </span><span style="color: #0000BB">$app </span><span style="color: #007700">= new </span><span style="color: #0000BB">Yaf_Application</span><span style="color: #007700">(</span><span style="color: #0000BB">$config</span><span style="color: #007700">);<br /> </span><span style="color: #0000BB">$app</span><span style="color: #007700">-></span><span style="color: #0000BB">bootstrap</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output something similar to:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> string(22) "Bootstrap::_initConfig" string(22) "Bootstrap::_initPlugin" </pre></div> </div> </div> </div> <div class="section" id="yaf-bootstrap-abstract.synopsis"> <h2 class="title">Class synopsis</h2> <div class="classsynopsis"> <div class="ooclass"></div> <div class="classsynopsisinfo"> <span class="ooclass"> <span class="modifier">abstract</span> <strong class="classname">Yaf_Bootstrap_Abstract</strong> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Properties */</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> }</div> </div> </div> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="yaf-application.wakeup.html">Yaf_Application::__wakeup</a></div> <div class="next" style="text-align: right; float: right;"><a href="class.yaf-dispatcher.html">Yaf_Dispatcher</a></div> <div class="up"><a href="book.yaf.html">Yaf</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>