Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在zf2'中创建标头;s布局文件_Php_Zend Framework2_Zend Layout - Fatal编程技术网

Php 如何在zf2'中创建标头;s布局文件

Php 如何在zf2'中创建标头;s布局文件,php,zend-framework2,zend-layout,Php,Zend Framework2,Zend Layout,在布局文件中,我想创建一个像所有网站一样的标题。我有一个标题图像。我如何才能将该图像仅用于布局文件中页面的标题部分 这是我的密码 <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?php

在布局文件中,我想创建一个像所有网站一样的标题。我有一个标题图像。我如何才能将该图像仅用于布局文件中页面的标题部分

这是我的密码

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?php echo page_title; ?></title>
    <?php
    $homeUrl = $this->url('home', array(), array('force_canonical' => true));
    $basePath = $this->basePath();

    $this->headLink(array('rel' => 'shortcut icon', 'type' => 'image/png', 'href' => $this->basePath() . '/img/FantasyFootballLogo.png'))
    ?>

    <?php echo $this->headLink() ?>

</head>

  --Option1:  <header style="background-image:url(/img/ffheader.png)" height="300" width="1000">

              </header>
  --Option2: <header>
               <div style="background-image:url(/img/ffheader.png)"></div>
             </header>

--备选案文1:
--备选案文2:


有谁能帮我设置标题吗?

要在zf2中创建标题,您应该使用viewHelpers,这是维护代码的更好方法

编辑:选项2最好显示您的徽标^^

编辑2:您可能应该使用选项3: 因为这个文件对谷歌和公司来说“有意义”


最终编辑:如果你只是想在标题中添加背景(就像我刚刚意识到的xD一样),那么选项2也更好。

HTML文件的标题部分不是设计用来放置“可见HTML”的,你应该在正文中正确地排列容器,这样你就可以将图像固定在页面顶部。 这篇文章可以帮助你实现你所需要的: