Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi.
I'm pretty tired right now, but i will try to explain my problem as thouroghly as possible...
I have very little experince with JavaScript, though some programming experince in PHP. I have great respect for w3c standards.
I'm currently building a cms using PHP, and i have come to the conclusion JavaScript will serve the purpose of creating (that is building the content (articles and the like), not displaying it, that will be handled by PHP inside the content div).
designMode, ie Midas/MSHTML, is doing a crappy job as they are not really standardised yet, and also spit out ugly code.
My approach to this a little hazy at the moment, and i would really like to hear ANY suggestions. The idea is to KeepItSimple. text-alignment/placement and other behaviours through div tags with class attributes, and also some standard xhtml tags like ul em i and so on. Nothing fancy.
Some ideas of min was:
edit the text in textarea. pass it to an iframe. style it here. can this be done if designmode is readonly? why? - i dont want text input possible here (remember designMode crap html). If it cant be done - use iframe and the DOM to markup the selected areas (this would require checking that the selection keeps inside the parent element in most, if not all cases.
As all text should (preferably) be contained withintags, so before post/send this content, Javascript will also markup first textnode without a tag, and next whitespace within p tags...
Does this approach sound reasonable to you?The tricky part will be editing this content at a later time though. I dont want designMode mess up my html. Maybe if one could make it behave (Firefox does </br> when hitting enter, ie contains it in a paragraph and </br> when hitting shift+enter!!) this could be an alternative. But i still would style it with my javascript approach.
The other way would be to use a textarea to edit the text, and preferably update an iframe in realtime with the edits. this could be pretty CPU intesive though. And it would need som way to compare cursor position in the textarea with the correct position in the iframe html. This i really need som idea on how to accomplish!
If this can't be done, then i guess you could examine what text is left, and new text inside those elements, and also what text had been added and add that for later styling if needed.Man, thats a long post :)
Suggestions, ideas and snippets would be greatly appriciated.

FCKEditor is a nice tool. There are over 2 dozen similar applications that I have seen. I usually cut down on the features.

I appriciate your reply. But i must point out this editor (and probably all of the dozen others) rely on designMode to do html. I have tried most of them out, and they generally do what i dont like (diffrent markup on diffrent platforms). But anyway, Thanks...

Hello!
Maybe you need not to build your own CMS. There dozen of CMS. Everyone can find he like more. You can build your own CMS only to study PHP not for real job. For example I use Mambo CMS. I can change editors ten times a day through admin panel and select what I want. Writing your own CMS is like writing your own text editor.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |