PDA

View Full Version : stupid PHP problem



Mar
12-06-2006, 12:18 PM
I have some PHP code and I want to insert just a plain-jane image. I've been trying to add
<img src="images/header_top.gif" width="175" height="120" /> but when I reload the page, it's just a small empty square instead of the image. And I'm sure everything else I'm doing is right, been working on this for quite a while. This is the first time I haven't been able to insert some html into a PHP page. Here is the PHP, it's just a header file.

<div id="toptabs">
<p>
<a class="toptab" href="<?php bloginfo('rss2_url'); ?>">RSS</a><span class="hide"> | </span>
<a class="toptab" href="<?php bloginfo('comments_rss2_url'); ?>" title="Subscribe to Comments RSS feed">Comments RSS</a><span class="hide"> | </span>
<a class="toptab" href="<?php bloginfo('atom_url'); ?>" title="Subscribe to Atom feed">Atom</a></p>
</div>

<div id="container">

<!--
<div id="logo">
<h1><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>
</div>
-->
<br />
<div id="navitabs">
<h2 class="hide">Site menu:</h2>
<a class="navitab" href="<?php bloginfo('url'); ?>">Home</a><span class="hide"> | </span>
<a class="navitab" href="#">Link1</a><span class="hide"> | </span>
<a class="navitab" href="#">Link2</a><span class="hide"> | </span>
<a class="navitab" href="#">Link3</a><span class="hide"> | </span>
<a class="navitab" href="#">Link4</a>


<div id="desc">
<h2><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h2>
<p>You are currently viewing EXQUISITE Wordpress Theme. Basically it is a 2-column Elegant, Minimal, Business theme layout. The design is made with XHTML and CSS, and it has no tables.</p>
<p> Author of this theme is Kaushal Sheth who loves making WP & TXP Themes.</p>
<p class="right"><a href="#">Read more...</a></p>
</div>


I've tried adding it in 10 different places, nothing works. Same result everytime.

Mar
12-06-2006, 12:24 PM
Here's a screenshot of the page with the stylesheet. I want to add the logo to the left of the links at the top, but if you can tell me how to get it in there anywhere, I can go from there.

http://www.danmaher.com/screenshot2.jpg

benyl
12-06-2006, 12:31 PM
Have you tried a full reference?

It is probably a path problem. Relative vs. absolute.

viperous
12-06-2006, 01:18 PM
Originally posted by benyl
Have you tried a full reference?

It is probably a path problem. Relative vs. absolute.

:werd:

You'll need to have

<img src="/images/blah.jpg" />

Mar
12-06-2006, 02:16 PM
Isn't that what I have though, minus the dimensions?

*EDIT - the only difference I seen was that first slash so I added that and it still didn't work.

benyl
12-06-2006, 02:25 PM
try the full path.



img src="http://blah.com/images/header_top.gif"

Mar
12-06-2006, 02:31 PM
You, my friend, are a lifesaver. It works now.
Back to work.....

Talies R
12-06-2006, 02:36 PM
Yep, whenever troubleshooting similar problems I just add the full path first. Glad you got it going!

bennyhanna
12-06-2006, 02:56 PM
I think its amusing that you start a new job, and have to come onto Beyond for help.....

benyl
12-06-2006, 03:00 PM
Originally posted by Mar
You, my friend, are a lifesaver. It works now.
Back to work.....

If this is for work, what I showed you is not good practice. A relative reference is better. Otherwise, if your prod path is different than your dev path, you will have to update all the references. You should really use relative referencing. That way, when you promote from dev to test, to prod, you don't have to change the php files, only the config files (if you have any).



Originally posted by bennyhanna
I think its amusing that you start a new job, and have to come onto Beyond for help.....

He should start paying me. I charge $120 / hour for web work. I have spent 5 minutes on this thread, but I charge in 30 minute increments. Mar owes me $60 + GST.

hahaha

viperous
12-06-2006, 03:06 PM
very odd that you need to use a full path...

I mean....if you take a look most site's source...they don't have their img src coming from http://sitename/images/

You should echo out bloginfo('url') and bloginfo('name') and see what those output.

Mar
12-06-2006, 06:10 PM
Originally posted by bennyhanna
I think its amusing that you start a new job, and have to come onto Beyond for help.....
Thanks, but if I didn't talk to you when I worked there, I'm not about to start now.

I've developed a lot of code, I've never seen the need for an absolute path. I'll let the server admin deal with it, I think he's running the server behind a proxy right now, not sure. That was weird though, thanks.

bennyhanna
12-06-2006, 08:38 PM
Originally posted by Mar

Thanks, but if I didn't talk to you when I worked there, I'm not about to start now.




HAHAHAHA

You didnt talk to me.............
I wouldnt expect you to say anything less.

I guess life does suck when you

1)Are so young and going BALD
2)Have no Life and no friends
3)Have to get a new Job, because of a an office romance
4)Have to get a new Job, because everyone hates you where you work.
Blah, Blah, Blah



Sounds like based on you asking for Help on Beyond, that you'll be at your new Job for a long time :rolleyes:

Mar
12-06-2006, 10:03 PM
I must be the only software developer on the planet that does research, wherever it may be. No, I don't know everything, and when I run into something I've never seen in my previous development, can't find it in a book or Google, I see nothing wrong with a resource of 10,000 people. If you're waiting for me to ask another question here, it'll be a while. But you couldn't let it go, could you? You always have to get that much more on someone.

Let it go, dude.