1

我的 login.phtml(查看页面)

    <head>
       <? $this->HeadScript()->appendFile('../public/js/jquery-2.0.2.min.js','text/javascript');
        $this->HeadScript()->appendFile('../public/js/clck.js','text/javascript');?>
    </head>

    <body onload="startTime">

    <div id="wrapper">

        <div id="header">
            <link rel="stylesheet" type="text/css" href="../images/mystyle.css">

            <h2>Employee Login</h2>
            <hr>
            <h4 align="left"><?echo "Date:". date('d-m-Y H-ia'); ?> </h4>


        </div>

        <div id="content">
            <?php
            if(isset($this->errorMessage))
            {
                echo $this->errorMessage;
            }
            ?>
            <table align="center"><tr><td>  <? echo $this->form;?></tr></table>

            <a href="<?=$this->url(array('controller'=>'Login','action'=>'signup'))?>">New users ?click here</a><br>
            <a href="<?=$this->url(array('controller'=>'Adminlogin','action'=>'adminlogin'))?>">Admin Login</a>

        </div>

        <div id="footer">
            <p>Copyright (c) 2010 quickstart.com All rights reserved</p>
        </div>

    </div>

    </body>

我的 layout.phtml 页面

<?php echo $this->layout()->content;?>

<?php echo $this->headScript()->prependFile(
    $this->baseUrl('../public/js/clck.js')) ?>

<?php echo $this->headLink()->prependStylesheet(
    $this->baseUrl('../public/images/mystyle.css'))?>



<?php echo $this->inlineScript()->prependFile(
    '../public/js/jquery-2.0.2.min.js') ?>

我的 js 页面 clck.js

function startTime()
{
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
// add a zero in front of numbers<10
m=checkTime(m);
s=checkTime(s);
document.getElementById('txt').innerHTML=h+":"+m+":"+s;
t=setTimeout(function(){startTime()},500);
}

function checkTime(i)
{
if (i<10)
{
    i="0" + i;
}
return i;
}

我的应用程序.ini

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.db.adapter = "PDO_MYSQL"
resources.db.params.dbname = "test"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "mysql"


 resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

我的引导文件

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{

protected function _initPlaceholders()
{
}
}

?>
<?php
set_include_path('../quickstart/application/models'.get_include_path());
?>

我在 bootstrap 或 application.ini 中留下了任何设置吗?我试图包含 javascript 文件来查看页面。但它不起作用。CSS 工作正常。

4

1 回答 1

0

我尝试在查看页面(login.phtml)上使用以下代码:

src="/Zend/public/js/clck.js

它适用于查看页面。

于 2013-10-02T02:01:08.070 回答