Jump to content
Science Forums

How do Smilies work?


Recommended Posts

I have started by inserting <br> tags into the text of posts in place of chr(13).
If you want to be XHTML-compliant, you should use "<br/>"... :)
I built a function that finds these and replaces them. Next I am building a similar function...

And finally wrap it all in a "translate2html(msg)" function and put it in an includable module so you can use it all over the place!

On the DB side I have decided to have two fields for posts. One I call the Post, and the other is the RawPost...This uses more disk space, but saves me from having to translate the posts on the fly each time they are put into a control for viewing.
Always a trade-off. I tend to prefer translate on the fly (but only if its been modularized as I describe above!), partly because of the disk usage issue, but also because if you decide to change something about your translation later (e.g. deciding always to surround the name "Bill" with <b> tags), you won't need to go convert your entire data set (not that it would take long to run, but you'd have to write the conversion script...). Either way has its benefits! :)
I will give a link to the final product when it is ready.
I can't wait! :)

 

Modularizable object classes,

Buffy

Link to comment
Share on other sites

</br>??? Is your knowledge 82 eschalons greater than my own, (and/) or does the slash go prior to the command?
No, dear. Its <br/>, because its what's known as an "empty-element tag": it has no paired closing tag (which have a leading / like </p>). <img> is another example which should have a trailing slash--as in <img src="myhappysmilie.jpg"/>--in order to be xhtml-compliant....

 

Parse this,

Buffy

Link to comment
Share on other sites

No, dear. Its <br/>, because its what's known as an "empty-element tag": it has no paired closing tag (which have a leading / like </p>). <img> is another example which should have a trailing slash--as in <img src="myhappysmilie.jpg"/>--in order to be xhtml-compliant....

 

Parse this,

Buffy

 

So I should be shooting for xhtml? Since I know almost nothing, it should be just as easy to start there, right?

 

Bill

Link to comment
Share on other sites

So I should be shooting for xhtml? Since I know almost nothing, it should be just as easy to start there, right?

Absolutely! Its easy too! Just follow these simple directions!

  1. At the top of your files put:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    (You can be a freak and use the "strict" form, but I personally think its silly)

  2. Redo your <html> tags thusly:

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


  3. Use Firefox for your testing!
  4. Download and install the "Html validator 0.7.9.3" extension from the Firefox Extensions site (at mozilla.org)
  5. When testing, you'll see a little indicator at the bottom which translates as: "red" you idiot you've got an error in your html, "yellow" does not comply with xhtml, or "green" dude! you're compliant!
  6. double click on the little indicator and it will tell you where your code is messed up.

I spend a *lot* of time with this little puppy...can't live without it!

 

Tidy,

Buffy

Link to comment
Share on other sites

I am using Visual Web Developer Express, and I am pretty much letting it dictate the formatting for me. As I have learned more I have gone in and removed some of the stuff that was making pages ugly in Firefox. Here is the doc tag at the top of each page...

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

I am trying to keep to a slow pace. I realize that every page I have made is going to be redone completely. I am focusing on the mechanics of the UI, and not so much at this time on the beauty of it.

 

Bill

Link to comment
Share on other sites

Here is the doc tag at the top of each page...
That's the right one! You're off to a good start!
I am trying to keep to a slow pace. I realize that every page I have made is going to be redone completely. I am focusing on the mechanics of the UI, and not so much at this time on the beauty of it.

That's a good approach. You can assume you'll write everything twice no matter what you're doing....

 

The only reason to pay attention to the little complaints from the validator is that its a great way to find actual bugs that are driving you nuts because you don't know where they came from: sometimes, just fixing the validation errors will "magically" fix inexplicable bugs....

 

Good luck!

 

divs are blocks and spans are inline,

Buffy

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...