Thread: CSS and Forums
View Single Post
  #2 (permalink)  
Old October 8th, 2007, 04:20 PM
Maxxim Maxxim is offline
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Now you are talking...
In past I eared you saying that it is easy implement some things into TBH forums... Like parent-child category... treeviews etc! I gave you same time to fall in reality! :)
I know because I made an all new forum for asp.net 1.1!
It all can be done but... it take some time!

Quote:
quote:Also, I've been looking into forums. My users are used to vBulletin, and compared to that, TBH forums stink. I've pondered just coding a lot myself, but frankly I'd rather spend my time on other parts of the site. Heck, if users would pick too big a picture as avatar (my users will want their own pictures), the completely forum layout is messed up as it is :(
Don't worry...
for the avatar image, use something like this:

Code:
<%# checkImage(Eval("AvatarUrl")) %>

// write some CheckImage(urlString) function that will check if the image with is bigger than 110px (for example) if it is... then resize to 110px
For the other images in forums you can do one of two things:
by css like:

Code:
<div class="postContent">
<%# Eval("Message") %>
</div>

css:
.postContent{
width:445px; /* td width */
overflow:auto; 
word-wrap: break-word;
}
//this css lines are very usefull! Because if some user post an url with 100 characters without spaces, your design will be corrupted!
//overflow:auto;word-wrap: break-word; avoid that making an horizontal scroll just for that div!
The second choice (my choice is a little javascript):
You can use css together, just for avoid bigwords/urlLinks without spaces
Code:
  function resize_images()
  {
    for (i = 1; i < document.images.length; i++)
    {
      while ( !document.images[i].complete )
      {
        break;
      }
      if ( document.images[i].width > 445 )
      {
        document.images[i].width = 445;
      }
    }
  }
//-->
        </script>
...
<body onload="resize_images()">
But now we have a problem... with masterpage we can't acess to the body in order to write:
Code:
<body onload="resize_images()">
But the javascript function is very usefull and works in my forum!
If you have a method to run this function with masterpages please tell me

I hope it helped!

Max