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
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
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
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>
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...)
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;
}
that was how the template "highway" was build, but I guess in the end it is because I am no ssspecialist but an enduser...
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.
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