zend paginator not including CSS

487 views Asked by At

i have used zend paginator in my app its working fine the way its .but when i click on any link i mean any pagination it query right info but the css is not applied there.initially when page renders all the css is applied properly but when i click on any pagination after refreshing the page the css is not applied.i dont know wts going on ??

this is the action which do pagination

 public function controlpannelAction(){
      $data = Zend_Auth::getInstance()->getStorage()->read();  
      $user_id = $data->user_id;
      $registry = Zend_Registry::getInstance();  
      $DB = $registry['DB'];
      $sql = "SELECT * FROM `phone_service` WHERE user_id='".$user_id."'";
      $result = $DB->fetchAll($sql);
      $page=$this->_getParam('page',1);
      $paginator = Zend_Paginator::factory($result);
      $paginator->setItemCountPerPage(5);
      $paginator->setCurrentPageNumber($page);
      $this->view->paginator=$paginator;
   }

this is my view name controlpannel.phtml

<?php
include("header.phtml");
include("blue.phtml");
include("main1.phtml");
include("footer.phtml");
?>

all the css is in header.phtml.all the css is in header.phtml so here is header.phtml

  <link rel="stylesheet" href="../../../web_root/assets/scripts/jqueryui/jqueryui.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="../../../web_root/assets/styles/style.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="../../../web_root/assets/styles/global.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="../../../web_root/assets/styles/config.css" type="text/css" media="screen" />
   .
   .
   .
   .
   and all other elements(body,divs)

here is the structure of my app i mean paths

    appname
    ->application
      -controllers
      -model
      -views
      -layouts
    ->library
      -zend
     ->web_root
       -index.php
       -assets
       -style
       -etc

and here is my index.php inside web_root maybe here is the problem

 <?php
 error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', true);
$rootDir = dirname(dirname(__FILE__));
set_include_path($rootDir . '/library' . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Controller/Front.php';
require_once 'Zend/Registry.php';
require_once 'Zend/Paginator.php';
include_once 'Zend/Db/Adapter/Pdo/Mysql.php';
require_once 'Zend/View.php';
require_once 'Zend/Controller/Action/Helper/ViewRenderer.php';
$params = array('host'         => 'localhost',
            'username'  => 'root',
            'password'    => '',
            'dbname'        => 'xyz'
           );

      $DB      = new Zend_Db_Adapter_Pdo_Mysql($params);
      $DB->setFetchMode(Zend_Db::FETCH_OBJ);
      Zend_Registry::set('DB',$DB);

 $view = new Zend_View();
 $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
 $viewRenderer->setView($view);
 Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
 Zend_Controller_Front::run('../application/controllers');
  ?>

i guess this quite clear to understand the problem ??any help plz

1

There are 1 answers

2
Aurelio De Rosa On BEST ANSWER

Your way to include css is not good. I think you have the problem because the urls dinamically change and so the relative path does not work as you expected. You should use this instead:

<link rel="stylesheet" href="<?php echo $this->baseUrl('/assets/scripts/jqueryui/jqueryui.css'); ?> ...