2010-07-22 166 views
1

我有一个建立在ZF上的网站。我不知道为什么,但落后于地狱。加载简单页面需要4s。当我禁用布局时,时间正在减少。渲染启用时,它正常工作。所以我可以使用动作视图,但我不能使用布局。它可能与布局有些不好吗?或者我没有正确设置布局?Zend框架布局或视图lag

网站:http://zgarnijlicke.pl

编辑:

我添加以下布局代码:

 
<<?php ?>?xml version="1.0" encoding="UTF-8"?<?php ?>> 
<!DOCTYPE html 
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt ; 
<html xmlns=" http://www.w3.org/1999/xhtml&quot ; xml:lang="en" lang="en"> 
<head> 
<link rel="stylesheet" type="text/css" media="screen" 
     href="<?php echo $this->baseUrl;?>/public/styles/style.css" /> 
<link rel="stylesheet" type="text/css" media="screen" 
     href="<?php echo $this->baseUrl;?>/public/styles/menu.css" /> 
<link rel="shortcut icon"href="<?php echo $this->baseUrl;?>/public/images/favicon.ico">

<script src="<?php echo $this->baseUrl;?>/public/scripts/jquery.js"></script> <script src="<?php echo $this->baseUrl;?>/public/scripts/jquery.corner.js"></script> <script src="<?php echo $this->baseUrl;?>/public/scripts/jquery.media.js"></script> <title><?php echo $this->title . ' - '; echo ($this->cattitle != '') ? $this->cattitle . ' - ' : '';?>Zgarnijlicke.pl</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <div id="naglowek"> <div id="logo"><img src="<?php echo $this->baseUrl;?>/public/images/logo.png" width="338px" height="63px" /></div> <div id="szukajka"> <div id="szukaj">Szukaj</div> <div id="poleszukaj"><input name="search" maxlength="20" size="20" value="wpisz cos..." onblur="if(this.value=='') this.value='wpisz cos...';" onfocus="if(this.value=='wpisz cos...') this.value='';" type="text"> </div> </div> </div>
<?php echo $this->partial('top_menu1.phtml', array()); ?>

<div class="clear">&nbsp;</div> <div id="banner"><img src="<?php echo $this->baseUrl;?>/public/images/banner.png" width="994px" height="212px" /> </div>

<?php echo $this->placeholder('top_menu2'); ?>

<div class="clear">&nbsp;</div> <div id="wrapper"> <div id="container"> <div id="side-a"> <div class="widget"><?php echo $this->partial('menu_left_1.phtml', array()); ?></div> <div class="clear">&nbsp;</div> <div class="widget">Lewa strona</div> </div> <div id="content"> <div class="content_elem"><?php echo $this->layout()->content; ?></div> </div> <div id="side-b"> <div class="widget">Prawa strona</div> </div> </div> <div class="clear">&nbsp;</div> <div id="footer"> <img src="<?php echo $this->baseUrl;?>/public/images/stopka.png" width="992px" height="34px" /> </div> </div>

<script type="text/javascript"> $("#menu_top1").corner(); //$(".widget").corner(); //$("#top_menu2").corner(); //$(".content_elem").corner(); $('a.media').media(); </script> </body> </html>

+0

你的菜单部分是否做了任何复杂的事情,或者他们只是呈现静态HTML? – 2010-07-23 16:21:38

+0

不,他们只使用url()助手来生成url的。这是现在硬编码的菜单,没有数据库。 – Misiek 2010-07-26 12:11:53

回答

1

这是不可能的,没有任何代码审查的说。您是否碰巧使用了action stack a lot? If so, this is likely the culprit,因为它会通过每个呼叫的整个分派。

您最好打赌:使用XDebug或Zend Debugger在您的应用程序中找到瓶颈。

+0

布局滞后。行动意见不是。我会把我的布局代码置疑。等一会儿。 – Misiek 2010-07-23 07:53:38

+0

由于某些业务问题,我无法使用这2个中的任何一个。 – Misiek 2010-07-23 08:16:24

+0

@Misiek不能看到任何布局错误。另外,我的页面加载速度不到一秒钟。如果您不能使用分析器,则很难找到瓶颈。你不能帮助你。抱歉。 – Gordon 2010-07-23 08:22:00