Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-20-2008, 11:37 PM
Junior Member
 
Join Date: Oct 2008
Posts: 5
Default ZF + JQuery Tabs

Hello all,

I am just starting out with Zend Framework. I have created a working interface with JQuery.

I am using a UI plugin for JQuery located here (UI/Tabs - jQuery JavaScript Library) and it has a mode where it loads in a URL for a tab instead of a hidden div. Well, in my working interface, it works perfectly fine. Also, if i go to the path in my framework, the page shows up.

My problem is that when the jquery tab tries to load it, i get an error:

PHP Code:

Error
Invalid controller specified (error)

#0 /Users/**/Desktop/site/library/Zend/Controller/Front.php(914): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))

#1 /Users//**//Desktop/site/application/bootstrap.php(143): Zend_Controller_Front->dispatch()

#2 /Users//**//Desktop/site/public/index.php(7): Bootstrap->runApp()

#3 {main} 
So, i don't really get why it loads from the URL directly, but not by the tab.

Another piece of info that is strange... if i go to the page with the jquery tabs (which errors), then go to the url of the page of the content of the single tab (which displays fine), then hit the back button, it will render the tab contents.


Anyone know JQuery and why this might be happening.

Last edited by druffus : 10-20-2008 at 11:41 PM. Reason: update
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-21-2008, 07:01 AM
Member
 
Join Date: Sep 2008
Location: Croatia
Posts: 57
Default

this is telling us (and you) nothing..

add
Code:
$frontcontroller->throwExceptions(true);
in bootstrap to get exception out, and c/p that code..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-21-2008, 04:19 PM
Junior Member
 
Join Date: Oct 2008
Posts: 5
Default

I realized using firebug that it is doing an XMLHttpRequest even though it is just trying to get a chuck of HTML back. I am assuming that is just the way jquery does requests.

So i tried adding $this->_helper->viewRenderer->setNoRender(); to the Action but it did nothing.

PHP Code:

Error
Action Helper by name Layout not found.

#0 /Users/***/Desktop/spot/library/Zend/Controller/Action/HelperBroker.php(197): Zend_Controller_Action_HelperBroker::_loadHelper('Layout')

#1 /Users/***/Desktop/spot/library/Zend/Controller/Action/HelperBroker.php(360): Zend_Controller_Action_HelperBroker->getHelper('layout')

#2 [internal function]: Zend_Controller_Action_HelperBroker->__call('layout', Array)

#3 /Users/***/Desktop/spot/library/Extension/Controller/Action.php(16): Zend_Controller_Action_HelperBroker->layout()

#4 /Users/***/Desktop/spot/library/Zend/Controller/Action.php(495): Extension_Controller_Action->preDispatch()

#5 /Users/***/Desktop/spot/library/Zend/Controller/Dispatcher/Standard.php(293): Zend_Controller_Action->dispatch('indexAction')

#6 /Users/***/Desktop/spot/library/Zend/Controller/Front.php(914): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))

#7 /Users/***/Desktop/spot/application/bootstrap.php(143): Zend_Controller_Front->dispatch()

#8 /Users/***/Desktop/spot/public/index.php(7): Bootstrap->runApp()

#9 {main} 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 10-21-2008, 05:16 PM
Junior Member
 
Join Date: Oct 2008
Posts: 5
Default

I found a little more:

I have the following extension for jquery:

PHP Code:


class Extension_Controller_Action extends Zend_Controller_Action
{
    var 
$ajaxXmlHttpRequest false;
    var 
$ajaxRequest false;

    public function 
preDispatch()
    {
        
// Check if this is a AJAX request
        // IF it is a XML HTTP request then its JQuery PHP request type
        // IF the action name contains the word ajax then its a JQuery ajax request

        
if ($this->_request->isXmlHttpRequest())
        {
          
$this->_helper->layout()->setLayout('jqueryxml');
          
//require_once 'jQuery/jQuery.php';
          
$this->ajaxXmlHttpRequest true;
          
        }

        
// IF action name contains the word ajax
        
$actionName $this->_request->getParam($this->_request->getActionKey());
        if ((isset(
$actionName)) && (strpos($actionName,'ajax')!=false))
        {
          
$this->_helper->layout()->setLayout('jquery');
          
$this->ajaxRequest true;
        }                                 
        
$this->view->baseUrl $this->_request->getBaseUrl();
        
$staticUrl Zend_Registry::get('static_url');
        
$this->view->staticUrl $staticUrl
    }

    function 
init()
    {
        
parent::init();
        
//$this->view = new Spt_View();
    
}

    public function 
zfurl($dest)
    {
        
// URL takes format /controller/action
        
$module 'default';
        
$controller 'index';
        
$action 'index';
        
$extra '';

        if (
substr_count($dest,'/')==1)
            list(
$controller$action) = split('[/.-]'$dest);
        if (
substr_count($dest,'/')==2)
            list(
$prefix$controller$action) = split('[/.-]'$dest);
        if (
substr_count($dest,'/')==3)
            list(
$prefix$module$controller$action) = split('[/.-]'$dest);
        return 
$this->view->url(array('module'=>$module'controller'=>$controller'action'=>$action),null,true);
    }


If i comment out the line that says $this->_helper->layout()->setLayout('jqueryxml'); it works. But I the file is there and i am assuming i need this for other jquery work.

Is it maybe because my template is not xml? The jqueryxml.phtml template has the following in it:

PHP Code:

jQuery
::getResponse(); 
Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 10-22-2008, 06:38 AM
Member
 
Join Date: Sep 2008
Location: Croatia
Posts: 57
Default

what was original extension of jqueryxml? was it jquery.xml or something different?
if you just added .phtml on the end thats probably the problem..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 10-23-2008, 08:24 PM
Junior Member
 
Join Date: Oct 2008
Posts: 5
Default

it was phtml, but i got it from a package i downloaded called phptaco, so i figured that was correct
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 10-24-2008, 07:04 AM
Member
 
Join Date: Sep 2008
Location: Croatia
Posts: 57
Default

try asking there.. its much better chance that someone will answer you there from its own experience..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:19 PM.