Jump to:

5450 Posts in 1672 Topics by 1197 members

Customising the CMS

SilverStripe Forums » Customising the CMS » How to link the header to hompage?

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1650 Views
  • Sunnybex
    Avatar
    Community Member
    39 Posts

    How to link the header to hompage? Link to this post

    Hi everyone,

    I would like to have a link from the header of my page (same for all subpages & home) to the HomePage. The header contains only a picture and no text. How can I do this?

    Thanks for your comments

    Bex

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: How to link the header to hompage? Link to this post

    Well if its an image tag in the template you can just wrap it in a <a> tag.

    Your current html might be something like -

    <img src="MyHeader.jpg" alt="Header Image" />

    To link it to the home page you change it to

    <a href="home/"><img src="MyHeader.jpg" alt="Header Image" /></a>

  • Sunnybex
    Avatar
    Community Member
    39 Posts

    Re: How to link the header to hompage? Link to this post

    not really...

    the image is in the layout.css file:
    #logo{
    ...
    background: url(../images/picture.jpg) no repeat left top;}

    and I changed the page.ss file
    <div id="logo">
    <img src="picture.jpg" alt="Header Image" />
    </div>

    But it is not working, what did I miss? (yes, I did the flush-thing...)

  • banal
    Avatar
    Community Member
    901 Posts

    Re: How to link the header to hompage? Link to this post

    Why do you specify a background via CSS and put an image in the logo div?
    You can easily wrap the <img> in <a> Tags as willr pointed out.. you can even style the <a> tag to look and behave exactly like the <div> element there:

    <a id="logo" href="$BaseHref">
    <img src="picture.jpg" alt="Header Image" />
    </a>

    Then in CSS you have to change the #logo element from inline to block

    #logo {
    ....
    display: block;
    }

  • Sunnybex
    Avatar
    Community Member
    39 Posts

    Re: How to link the header to hompage? Link to this post

    that was how the template "highway" was build, but I guess in the end it is because I am no ssspecialist but an enduser...

  • banal
    Avatar
    Community Member
    901 Posts

    Re: How to link the header to hompage? Link to this post

    It doesn't really matter if you're a SilverStripe specialist or not. These are simple html/css issues. If you know CSS and HTML, you should be able to edit/modify the SilverStripe templates, since they are basically just HTML documents mixed with some special template markup.
    At least adding the logo and a link to the homepage should not require any deep knowledge of SilverStripe or PHP.

  • Sunnybex
    Avatar
    Community Member
    39 Posts

    Re: How to link the header to hompage? Link to this post

    ok, after some trials and buying the book I finally got it. Not nice but running at least:

    page.ss:
    <div id="header">
             <a id="logo" href="http://www.mywonderfullsite.com/">
             </a>
    ...
    </div>

    header.ss:
    <div id="Header"
       
       <a> id="logo" href"$BaseHref">
       <img src="url(../images/picture.png" alt "Header Image" />
       </a>
       
    </div>

    layout.css:
    ...
       background: url(../images/picture.png) no-repeat left top;
       display: block;
    ...

    Thank you fo the help & all the best
    Bex

    1650 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.