简体   繁体   中英

what's wrong with this error?

I use zend partial helper:

   <?php echo $this->partial(include_once('../application/views/layouts/header.phtml'), array('from' => '<div id="logo_page"><img src="../css/images/master1.png"></div>')); ?>

In header.phtml:

<?php echo $this->escape($this->from) ?>

when i try to use it, i have error:

exception 'Zend_View_Exception' with message 'script ' 1 ' not found in path (Y:/home/local.mekheda/application/modules/blog/views\\scripts/;Y:\\home\\local.mekheda\\application/views\\scripts/)' in Y:\\home\\local.mekheda\\library\\Zend\\View\\Abstract.php:980

Why it's 1 and what is wrong?

You don't need the include_once directive. Use only the path to the partial view:

$this->partial('../application/views/layouts/header.phtml', array('from' => '<div id="logo_page"><img src="../css/images/master1.png"></div>'));

The include_once returns 1 on success, hence the error message.

Update:
Not sure I completely understand the question from your comment, but why not put all the HTML in the partial view:

// header.phtml
<div id="logo_page"><img src="<?php echo $this->img; ?>" /></div>

And pass it to the partial view as follows:

$this->partial('../application/views/layouts/header.phtml', array('img' => 'css/images/master.pg'));

Note: if the file css/images/master.png is under your public directory you can pass it as I did, without using ../

You use partial wrong - throw the include_once statement

echo $this->partial(
    '../application/views/layouts/header.phtml',
    array('from' => '<div id="logo_page"><img src="../css/images/master1.png"></div>'));

Place “header.phtml” in YourApplicationFolder/modules/Application/view/partials

< ?php echo $this->partial('partials/header.phtml',
                            array('from' => '<div id="logo_page"><img src="../css/images/master1.png"></div>')); ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM