我在我的应用程序中使用了zend paginator它的工作方式很好。但是当我点击任何链接时我的意思是任何分页它查询正确的信息但css不适用于那里。最初当页面渲染所有的css被应用正确但当我刷新页面后点击任何分页时,css没有应用。我不知道wts正在进行?
这是进行分页的行动
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;
}
这是我的视图名称controlpannel.phtml
<?php
include("header.phtml");
include("blue.phtml");
include("main1.phtml");
include("footer.phtml");
?>
所有的css都在header.phtml.all中,css在header.phtml中 所以这里是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)
这是我的应用程序的结构,我的意思是路径
appname
->application
-controllers
-model
-views
-layouts
->library
-zend
->web_root
-index.php
-assets
-style
-etc
这是我在web_root里面的index.php可能这里是问题
<?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');
?>
我想这个问题很清楚,理解这个问题??任何帮助PLZ
答案 0 :(得分:5)
你包含css的方式并不好。我认为你有问题,因为网址会发生变化,所以相对路径不能按预期工作。你应该改用它:
<link rel="stylesheet" href="<?php echo $this->baseUrl('/assets/scripts/jqueryui/jqueryui.css'); ?> ...