fckeditor installation problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

fckeditor installation problem

Post by m2babaey »

Hi
I tried to install fckeditor. uploading and testing samples are easy but creating my own form... I couldn't
This is the sample01.html that I tried (in _samples directory):

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>FCKeditor - Sample</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="robots" content="noindex, nofollow" />
    <link href="../sample.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../fckeditor.js"></script>
</head>
<body>
    <h1>
        FCKeditor - JavaScript - Sample 1
    </h1>
    <div>
        This sample displays a normal HTML form with an FCKeditor with full features enabled.
    </div>
    <hr />
    <form action="../php/sampleposteddata.php" method="post" target="_blank">
        <script type="text/javascript">
<!--
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
// oFCKeditor.BasePath = '/fckeditor/' ;    // '/fckeditor/' is the default value.
var sBasePath = document.location.href.substring(0,document.location.href.lastIndexOf('_samples')) ;
 
var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.Height   = 300 ;
oFCKeditor.Value    = '<p>This is some <strong>sample text<\/strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor<\/a>.<\/p>' ;
oFCKeditor.Create() ;
//-->
        </script>
        <br />
        <input type="submit" value="Submit" />
    </form>
</body>
</html>
But after I even change the folder name from _sample to sample the the sample01.html is not working
(I changed

Code: Select all

var sBasePath = document.location.href.substring(0,document.location.href.lastIndexOf('_samples')) ;
to

Code: Select all

var sBasePath = document.location.href.substring(0,document.location.href.lastIndexOf('samples')) ;
too)
I didn't find developers' guide on the site helpful for where should the directories exist when we need an editor in our www folder and how I should call the function ( plus how to set width of textarea)
Any help would be appreciated
Thanks in advance
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: fckeditor installation problem

Post by pickle »

Read the comment above the line you're working with - you shouldn't be using that convoluted code in the real world - you should be statically setting the BasePath.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply