Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: posting system

  1. #1
    Regular Coder
    Join Date
    Oct 2003
    Posts
    603
    Thanks
    2
    Thanked 1 Time in 1 Post

    posting system

    i have admin panel systems set up on over 12 sites and i would love to learn how to make a "page edit" box like this one im typing in right now that you can just click B for Bold text, change colors, etc.... but i dont know where to get the javascript info to make all these [B] tags to get put in when i click the B button... can anyone help me?

  • #2
    Regular Coder
    Join Date
    Mar 2004
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You should give more information, for example if you are just wanting to insert a bbcode into the text box it is very simple, but I you will need some php code to replace, I did it very simply on my Guestbook, you can download it and look at the source, but just to give you a quick example:
    PHP Code:
    // the javascript code to insert to the textarea
    <SCRIPT>
    function 
    addb()
    {
            
    document.formname.textareaname.value += "[ b ] [/ b ]" //spaces in tags because of forum bbcode
    }
    </SCRIPT> 
    that will do the javascript, to call that code from a button:
    PHP Code:
    <INPUT type='button' Value='B' Onclick="addb()" style="font-weight: bold"
    the font-weight: will make the button bold,
    and to turn it into html for your admin panel
    you can use preg_replace e.g.
    PHP Code:
    $_POST['comments'] = preg_replace("/\[b\]/","<strong>",$_POST['comments']);
        
    $_POST['comments'] = preg_replace("/\[\/b\]/","</strong>",$_POST['comments']); 
    that's the code I use, and btw <strong> is the same as <b> basically,
    I am not really sure if that is what you wanted but it is my best guess..

  • #3
    Regular Coder
    Join Date
    Oct 2003
    Posts
    603
    Thanks
    2
    Thanked 1 Time in 1 Post
    i was already planning on doing that... but what about the actual script on the buttons that add the [B] to the text area im typing in. thanks

  • #4
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,108
    Thanks
    11
    Thanked 101 Times in 99 Posts
    google for 'htmlarea' V3 is x-browser and free , likea hotmail editor but without relying on MS stuff (so works on linux and 1 day Mac they reckon?)
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #5
    Regular Coder
    Join Date
    Mar 2004
    Posts
    232
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by boeing747fp
    i was already planning on doing that... but what about the actual script on the buttons that add the [B] to the text area im typing in. thanks
    I already posted it:
    PHP Code:
     // the javascript code to insert to the textarea 
    <SCRIPT
    function 
    addb() 

            
    document.formname.textareaname.value += "[ b ] [/ b ]" //spaces in tags because of forum bbcode 

    </SCRIPT> 
    Read my post next time


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •