7 replies
  • WEB DESIGN
  • |
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
#php #problem
  • Profile picture of the author ofir
    Banned
    Can you please add a link to your blog so I will be able to see what are you talking about?
    {{ DiscussionBoard.errors[272831].message }}
  • Profile picture of the author gimmick
    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 :-)
    {{ DiscussionBoard.errors[272959].message }}
  • Profile picture of the author JohnDaniel
    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
    {{ DiscussionBoard.errors[273890].message }}
  • Profile picture of the author gimmick
    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 :-)
    {{ DiscussionBoard.errors[274582].message }}
    • Profile picture of the author JohnDaniel
      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. =)
      {{ DiscussionBoard.errors[274848].message }}
  • Profile picture of the author gimmick
    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.
    {{ DiscussionBoard.errors[275318].message }}
    • Profile picture of the author fragin_bastich
      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;
      {{ DiscussionBoard.errors[298013].message }}

Trending Topics