Implemented a feature...

Topics: ASP.NET 2.0, Themes
Mar 27, 2011 at 4:31 PM

... that shows images on the frontpage, but i ran into a problem. Everything works on the front page, but when you go into the actual post the buttons at the bottom dont show. Anyone know why this happens? I remember i had a similar issue with the website header but i forgot how i fixed it.

 

http://www.muscletitans.com/

 

Oh and if anyone needs the code to implement on his site ask here.

Mar 27, 2011 at 6:33 PM

You need to use absolute urls for your images instead of relative ones.

Mar 27, 2011 at 7:06 PM

Absolute? As in the full path? How can you do that? I always used relative paths in my code.

Mar 27, 2011 at 10:50 PM

You might try something like: <img src="<%=Utils.AbsoluteWebRoot %>themes/yourtheme/img/image.png" /> or <img src="~/themes/yourtheme/img/image.png" runat="server"/>

Mar 29, 2011 at 9:43 PM

I just added "/" to the front and it works. Why is that?

Mar 29, 2011 at 9:56 PM

/ means root directory

./ means stay in current directory

../ means go up one directory

There are plenty more too such as ../../ but I find they do not work many times for me so I often use the formats I described above. Try adding a "page" to your site and see if it still works. If it does or if you don't plan on adding any pages then I guess you are good to go.