简体   繁体   中英

how to create header in zf2's layout file

In layout file I want to create a header like the all website has .I have an image for the header how can I put that image only for the header portion of the page in layout File?

this is my Code..

<!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>

can anybody Please Help me how to set Header?

to make a header in zf2 you should use viewHelpers it's a better way to maintain the code

EDIT : the option 2 is better to display your logo ^^

EDIT 2 : and you probably should use an option 3 : cause this file "makes sense" to google and co

FINAL EDIT : and if you juste want a background to your header (like i just realise xD) the option 2 is better too.

The header part of an HTML file is not designed to put "visible HTML", you should arrange your containers orrectly in the body thus you fix and image to the top of the page. this post could help you achieve what you need: HTML Header With Image And Text

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