Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2011-12-12 18:50:32
- Defmetalhead
- Member
- Registered: 2011-12-12
- Posts: 24
[solved] Images only showing up on front page?
I am using several images that I uploaded via FTP into the main directory. All background images seem to work fine, but for some reason only the top header image works on all subpages. What can I do to fix this? The page I am currently working on is here …
http://webkagawa.com/example/pond/textpattern/
Thanks again.
Last edited by maniqui (2011-12-12 19:52:48)
Offline
Re: [solved] Images only showing up on front page?
This is an issue caused by the way you are referring the images (ie. the URL in the src
attribute of <img />
tag).
A quick look at the source code shows:
<img src="images/ifacebook.gif" class="alignright"/>
<img src="images/ilinked.png" class="alignright"/>
<img src="images/itwitter.gif" class="alignright"/>
<img src="images/irss.png" class="alignright"/>
<img src="images/iyoutube.png" class="alignright"/>
That will work in the front page (aka the root of your website, which is http://webkagawa.com/example/pond/textpattern/
), because the “final” URL for the image will be, for example, http://webkagawa.com/example/pond/textpattern/images/ifacebook.gif
.
But on the inner pages (a section or an individual article), the “final” URL will be http://webkagawa.com/example/pond/textpattern/articles/2/images/ifacebook.gif
, which is an URL pointing to an non-existing location (404).
So, the safer way to fix this is trying to “build” the full URL to the images, to end up with something like this:
<img src="http://webkagawa.com/example/pond/textpattern/images/ifacebook.gif" class="alignright"/>
<img src="http://webkagawa.com/example/pond/textpattern/images/ilinked.png" class="alignright"/>
<img src="http://webkagawa.com/example/pond/textpattern/images/itwitter.gif" class="alignright"/>
<img src="http://webkagawa.com/example/pond/textpattern/images/irss.png" class="alignright"/>
<img src="http://webkagawa.com/example/pond/textpattern/images/iyoutube.png" class="alignright"/>
which will work, as the URL is absolute.
I’m not sure how is your code, but you could use <txp:site_url />
to get the full URL to the root of your TXP website, like this:
<img src="<txp:site_url />images/ifacebook.gif" class="alignright"/>
<img src="<txp:site_url />images/ilinked.png" class="alignright"/>
<img src="<txp:site_url />images/itwitter.gif" class="alignright"/>
<img src="<txp:site_url />images/irss.png" class="alignright"/>
<img src="<txp:site_url />images/iyoutube.png" class="alignright"/>
That should work.
Offline
#3 2011-12-12 19:13:47
- Defmetalhead
- Member
- Registered: 2011-12-12
- Posts: 24
Re: [solved] Images only showing up on front page?
The embeded images arent the actual problem. It’s the images I am using within my css that are the problem. The top banner image is the only one working, while all other images will not work. Why would only the top background images within my css work while all other images do not work? The body background also work.
This code represent the top banner background image: The rest are set up exactly like this.
#logo h1 a {
display: block;
top: 0px;
left: 0px;
width: 1250px;
height: 149px;
background: url(images/homepage04.png) no-repeat top;
}
T
Offline
Re: [solved] Images only showing up on front page?
On front page, the top banner image is applied to a <div id="wrapper">
which is a direct child of <body>
. On inner pages, that <div id="wrapper">
is missing. So, the corresponding CSS rule isn’t applied, and that’s why you don’t get that top banner image on the inner pages.
Offline
#5 2011-12-12 19:28:37
- Defmetalhead
- Member
- Registered: 2011-12-12
- Posts: 24
Re: [solved] Images only showing up on front page?
LOL …. I just figured that one out … ouch … sorry for the stupidity. It’s working fine now. WOW ….
Offline