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 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2006
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Decoding html chars for FCKeditor

    Hi guys,

    I am trying to extract data that was placed in my DB by FCKeditor. I am using this to put into the WYSIWYG editor screen.

    The content in the DB looks like this:
    PHP Code:
    <p><p>Default text in editor</p></p&gt
    I am using this to convert the data and place it in the editors screen:
    PHP Code:
    $content "$r[content]"
    $pagecontent html_entity_decode($content); 


    $oFCKeditor = new FCKeditor("$_GET[page]"); 
    $oFCKeditor->BasePath '../../fckeditor/'
    $oFCKeditor->Value "$pagecontent"
    Its almost getting it in the right format, howver I am left with this:

    PHP Code:
    <p>Default text in editor</p
    Can anyone please help?

  • #2
    Regular Coder meth's Avatar
    Join Date
    Jan 2003
    Posts
    262
    Thanks
    0
    Thanked 9 Times in 9 Posts
    This is not the usual output from fckeditor. Your fck configuration is in error.
    I do Web Design, Brisbane based.
    More time spent in PHP/MySQL Web Development.
    And Search Engine Optimisation takes up the rest of it.

  • #3
    New Coder
    Join Date
    Jul 2006
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I got it to display corrently, not sure which of my changes worked LOL

    Does anyone use FCKeditor or anything similiar?
    I am struggling to get this working, I am thinking I am going about this the wrong way ??

    Pages_Table
    page_id | page_name

    Content Table
    content_id | page_id | content

    In my CMS I have a page that I insert entries into the pages_table. (pages on the website that I want to use the FCKeditor on.

    I then added a page that has a dropdown list, this pulls a list of pagenames from the pages table getting the 'page_id'. The form sends you to the next page with the FCKeditor, in effect pulling the data / html from the content_table for the relevant 'page_id'

    Ok...
    So what the problem is if there isnt an entry for the page_id, nothing is displayed?

    Another problem I am sure I will face is to Update or insert

    PHP Code:
      <?php 

    $query 
    mysql_query("SELECT * FROM CMS_content WHERE page_id='$_GET[page]'");
        while(
    $r mysql_fetch_assoc($query)) 
        {
         
        
    ?> 
         
        <br /><br />

         <form action="pages-edit-process.php" method="post">

    <?php
    $content 
    "$r[content]";

    // Adjust HTML Tags
    $pagecontent html_entity_decode ($content);

    $oFCKeditor = new FCKeditor("$_GET[page]");
    $oFCKeditor->BasePath '../../fckeditor/';
    $oFCKeditor->Value "$pagecontent";
    $oFCKeditor->Width  '100%' ;
    $oFCKeditor->Height '300' ;
    $oFCKeditor->Create();
    ?>

    <br / >
          <input type="submit" value="Submit">
        </form>
            
     </div>
     
     <?
     
    // end of while statemnt
     
    ?>

    The code that processes this:
    PHP Code:
     # this is processed when the form is submitted
        # back on to this page (POST METHOD)
        
    if ($REQUEST_METHOD=="POST") {


            
    # setup SQL statement
            
    $SQL " UPDATE CMS_content SET content ='$postedValue' WHERE page_id='$sForm' ";


            
    #execute SQL statement
            
    $result mysql_db_query($db,"$SQL",$cid);

            
    # check for error
            
    if (!$result) { echo("ERROR: " mysql_error() . "\n$SQL\n");    }

            echo (
    "<P align=center><font class=menu><b>The new data has been added!</b></font></P>\n");

        }

    mysql_close($cid); 

    Can anyone make any sense of this?
    Any advice would be GREATLY appreciated.

  • #4
    New Coder
    Join Date
    Jul 2006
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I got it sorted using:

    PHP Code:
    $query = ("SELECT * FROM CMS_content WHERE page_id='$_GET[page]'");
    $result = mysql_db_query($db,"$query",$cid);

    if (!$result) die("Query Failed.");

    if (mysql_num_rows($result) > 0) {  



    // if it found a result
         echo "results found ";
         
         $query = mysql_query("SELECT * FROM CMS_content WHERE page_id='$_GET[page]'");
        while($r = mysql_fetch_assoc($query)) 
        {
        
         ?> 
         
        <br /><br />

         <form action="pages-edit-process.php?m=update" method="post">

    <?php
    $content 
    "$r[content]";

    // Adjust HTML Tags
    $pagecontent html_entity_decode ($content);

    $oFCKeditor = new FCKeditor("$_GET[page]");
    $oFCKeditor->BasePath '../../fckeditor/';
    $oFCKeditor->Value "$pagecontent";
    $oFCKeditor->Width  '100%' ;
    $oFCKeditor->Height '300' ;
    $oFCKeditor->Create();
    ?>

    <br / >
          <input type="submit" value="Submit">
        </form>
            
     </div>
     
     <?
     
    // end of while statemnt

         
        
    } else {

      
    /**************    
      
      If no data exists for the page_id - Show modified form.
      Then set notice as different process page method - update / Insert   
                              
      ********************/
      
         
    echo "no result ";
         
         
    ?>
          <form action="pages-edit-process.php?m=insert" method="post">

    <?php


      
    /**************    
      
      Begin FCKeditor Code / Settings  
                          
      ********************/

    $oFCKeditor = new FCKeditor("$_GET[page]");
    $oFCKeditor->BasePath '../../fckeditor/';
    $oFCKeditor->Value "blank";
    $oFCKeditor->Width  '100%' ;
    $oFCKeditor->Height '300' ;
    $oFCKeditor->Create();
    ?>

    <br / >
          <input type="submit" value="Submit">
        </form>
     
     <?    
        
    }  // end of if else

     
    ?>


  •  

    Posting Permissions

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