Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Website Design
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 11-23-2008, 08:44 AM   #1
Active Warrior
 
gimmick's Avatar
 
Join Date: Oct 2008
Posts: 59
Thanks: 0
Thanked 1 Time in 1 Post
Default PHP problem

Hi!
I have a new blog and there is a clickbank ad on the first page on the sidebar (sidebar.php) with an image link, the image is stored in the root directory of my website.

On the index page is also a link to another page - inside my blog - and the content is of course different, but the sidebar is the same.

The thing is, the same image link is there on the sidebar, but on this second page the image doesn’t show.

I'm pretty knowledgeable at webdesign and HTML/CSS but PHP is new and I can't figure out why this happens. The sidebar.php file should fetch the image from the same location but it does not...

Help very much appreciated.
Kevin
gimmick is offline   Reply With Quote
Old 11-23-2008, 01:13 PM   #2
Banned
 
Join Date: Sep 2008
Posts: 91
Blog Entries: 1
Thanks: 0
Thanked 5 Times in 5 Posts
Contact Info
Send a message via Skype™ to ofir
Default Re: PHP problem

Can you please add a link to your blog so I will be able to see what are you talking about?
ofir is offline   Reply With Quote
Old 11-23-2008, 02:44 PM   #3
Active Warrior
 
gimmick's Avatar
 
Join Date: Oct 2008
Posts: 59
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: PHP problem

Here you go: Kevin’s Weight Loss Program there the link "diets that work" and you see the missing pic on right.

Thanks for any help :-)
gimmick is offline   Reply With Quote
Old 11-23-2008, 09:56 PM   #4
HyperActive Warrior
War Room Member
 
JohnDaniel's Avatar
 
Join Date: May 2007
Posts: 272
Thanks: 3
Thanked 8 Times in 6 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Yahoo to JohnDaniel
Default Re: PHP problem

How about just hard-linking the image, e.g. entering the complete image url:
img src="http://yousite.com/filename.jpg"

Instead of what your using:
img src="filename.jpg"

The image may not be showing because when you click a new post the url becomes http://yoursite.com/new-post-title and the image link might be reading to http://yousite.com/new-post/filename.jpg because you only used the filename instead of the complete image url.

Also the slug of your "Let’s talk about Weight loss" post is hello-world.
=). You might want to change it too.

cheers.
john

JohnDaniel is offline   Reply With Quote
Old 11-24-2008, 07:04 AM   #5
Active Warrior
 
gimmick's Avatar
 
Join Date: Oct 2008
Posts: 59
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: PHP problem

Thanks John, that helped :-)

Still I can't figure out why that happened...
Also I don't understand why my adsense ads are showing on the "diets that work" page in the sidebar, but not on the mainpage under 'more resources' where it should also be...

The ads are not working yet, but will in few days, and I would like understand why this happens also.

If anybody has a clue, let me know.
Thanks :-)
gimmick is offline   Reply With Quote
Old 11-24-2008, 09:40 AM   #6
HyperActive Warrior
War Room Member
 
JohnDaniel's Avatar
 
Join Date: May 2007
Posts: 272
Thanks: 3
Thanked 8 Times in 6 Posts
Social Networking View Member's Twitter Profile 
Contact Info
Send a message via Yahoo to JohnDaniel
Default Re: PHP problem

Cool.

I think that happened because the image's path, as I mentioned in the previous post.

As for the adsense ads... hmm.. I'm not sure why that's happening.
Maybe you can try putting the <li> tags after the <ul> tags.

Currently it looks like this:

<li><h2>More resources</h2>
<ul>

your google code

</ul>
</li>

How about this:
<li><h2>More resources</h2>
<ul>
<li>

your google code
</li>
</ul>
</li>

not sure if it will work tho. =)

JohnDaniel is offline   Reply With Quote
Old 11-24-2008, 01:00 PM   #7
Active Warrior
 
gimmick's Avatar
 
Join Date: Oct 2008
Posts: 59
Thanks: 0
Thanked 1 Time in 1 Post
Default Re: PHP problem

Thanks again for your post John :-)

I tried it, but it didn't work yet, guess I have to wait a bit because adsense ads load very slowly.

I will let you know.
gimmick is offline   Reply With Quote
Old 12-03-2008, 11:59 PM   #8
Active Warrior
 
Join Date: Jun 2008
Location: , , .
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: PHP problem

Just a quick note...generally speaking if you want to include images in your theme directly it's much easier to place the images in your theme directory (as oppose to root directory) and code it like:

<?php bloginfo('template_url');?>/images/filename.jpg

This format makes the root path irrelevant, as it will echo the full url to the browser regardless of which page you are on.

Of course that is the same as coding a full path url, but it's easier and faster when building your theme, and it makes it possible for you to easily move things without breaking all of your images, as the php responds accordingly.

The problem is that your image url is in relation to which page you are ON...not where php file calling it is located. So if you are on your homepage than src="filename.jpg" is valid...but if you are on

yoursite.com/diets-that-work/

the browser try's and fails to echo

yoursite.com/diets-that-work/filename.jpg

See where I'm going with this?

Second...you should really cloak and track your links.

Also, you could add some padding to your sidebar so the contents aren't squashed up against the edge

and lastly, if you add an auto margin (in css) to your sidebar images they will center horizontally within the sidebar div instead of defaulting to the left hand side.

margin: 0px auto 0px;
fragin_bastich is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Website Design

Tags
php, problem

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 03:01 PM.