Created
August 14, 2010 09:12
-
-
Save shamun/524156 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Q. How to do basic jQuery from Layout? Second file, step 2 i am trying but it doesn't allow. | |
# | |
# | |
Step 1: @file: application/Bootstrap.php | |
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap | |
{ | |
protected function _initHead() | |
{ | |
$this->bootstrap('view'); | |
$view = $this->getResource('view'); | |
$view->doctype('XHTML1_STRICT'); | |
//$view->HeadScript()->appendFile('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'); | |
// OR | |
ZendX_JQuery::enableView($view); | |
} | |
Step 2: @file: application/layouts/scripts/layout.phtml | |
<head> | |
<?php | |
if ($this->jQuery()->isEnabled()) { | |
$this->jQuery()->setLocalPath('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js') | |
->enable() | |
->setUiLocalPath('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js') | |
->uiEnable() | |
->addStylesheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/ui-lightness/jquery-ui.css'); | |
echo $this->jQuery(); | |
} | |
?> | |
</head> | |
Step 3: @file: application/views/scripts/index/index.phtml | |
<?php | |
$this->jQuery()->enable(); | |
?> | |
<form method="post" action="bid.php"> | |
<?php | |
echo $this->autoComplete("location", "", array('source' => array('Type this', 'Type that'))); | |
echo $this->datePicker("startDate", '', array('defaultDate' => '+7', 'minDate' => '+7')); | |
?> | |
<input type="submit" value="Bid!" /> | |
</form> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Step 2: @file: application/layouts/scripts/layout.phtml | |
<head> | |
<?php | |
if ($this->jQuery()->isEnabled()) { | |
$this->jQuery()->setLocalPath('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js') | |
->enable() | |
->setUiLocalPath('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js') | |
->uiEnable() | |
->addStylesheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/ui-lightness/jquery-ui.css'); | |
echo $this->jQuery(); | |
} | |
?> | |
</head> | |
<div> | |
<?php | |
$this->jQuery()->enable(); | |
echo $this->ajaxLink("Show me something", "/placetobe/hitit", array('update' => '#contents')); | |
?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment