1 | <?php |
---|
2 | /* |
---|
3 | * FCKeditor - The text editor for internet |
---|
4 | * Copyright (C) 2003-2006 Frederico Caldeira Knabben |
---|
5 | * |
---|
6 | * Licensed under the terms of the GNU Lesser General Public License: |
---|
7 | * http://www.opensource.org/licenses/lgpl-license.php |
---|
8 | * |
---|
9 | * For further information visit: |
---|
10 | * http://www.fckeditor.net/ |
---|
11 | * |
---|
12 | * "Support Open Source software. What about a donation today?" |
---|
13 | * |
---|
14 | * File Name: sample02.php |
---|
15 | * Sample page. |
---|
16 | * |
---|
17 | * File Authors: |
---|
18 | * Frederico Caldeira Knabben (fredck@fckeditor.net) |
---|
19 | */ |
---|
20 | |
---|
21 | include("../../fckeditor.php") ; |
---|
22 | ?> |
---|
23 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
---|
24 | <html> |
---|
25 | <head> |
---|
26 | <title>FCKeditor - Sample</title> |
---|
27 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
---|
28 | <meta name="robots" content="noindex, nofollow"> |
---|
29 | <link href="../sample.css" rel="stylesheet" type="text/css" /> |
---|
30 | <script type="text/javascript"> |
---|
31 | |
---|
32 | function FCKeditor_OnComplete( editorInstance ) |
---|
33 | { |
---|
34 | var oCombo = document.getElementById( 'cmbLanguages' ) ; |
---|
35 | for ( code in editorInstance.Language.AvailableLanguages ) |
---|
36 | { |
---|
37 | AddComboOption( oCombo, editorInstance.Language.AvailableLanguages[code] + ' (' + code + ')', code ) ; |
---|
38 | } |
---|
39 | oCombo.value = editorInstance.Language.ActiveLanguage.Code ; |
---|
40 | } |
---|
41 | |
---|
42 | function AddComboOption(combo, optionText, optionValue) |
---|
43 | { |
---|
44 | var oOption = document.createElement("OPTION") ; |
---|
45 | |
---|
46 | combo.options.add(oOption) ; |
---|
47 | |
---|
48 | oOption.innerHTML = optionText ; |
---|
49 | oOption.value = optionValue ; |
---|
50 | |
---|
51 | return oOption ; |
---|
52 | } |
---|
53 | |
---|
54 | function ChangeLanguage( languageCode ) |
---|
55 | { |
---|
56 | window.location.href = window.location.pathname + "?Lang=" + languageCode ; |
---|
57 | } |
---|
58 | </script> |
---|
59 | </head> |
---|
60 | <body> |
---|
61 | <h1>FCKeditor - PHP - Sample 2</h1> |
---|
62 | This sample shows the editor in all its available languages. |
---|
63 | <hr> |
---|
64 | <table cellpadding="0" cellspacing="0" border="0"> |
---|
65 | <tr> |
---|
66 | <td> |
---|
67 | Select a language: |
---|
68 | </td> |
---|
69 | <td> |
---|
70 | <select id="cmbLanguages" onchange="ChangeLanguage(this.value);"> |
---|
71 | </select> |
---|
72 | </td> |
---|
73 | </tr> |
---|
74 | </table> |
---|
75 | <br> |
---|
76 | <form action="sampleposteddata.php" method="post" target="_blank"> |
---|
77 | <?php |
---|
78 | // Automatically calculates the editor base path based on the _samples directory. |
---|
79 | // This is usefull only for these samples. A real application should use something like this: |
---|
80 | // $oFCKeditor->BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value. |
---|
81 | $sBasePath = $_SERVER['PHP_SELF'] ; |
---|
82 | $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ; |
---|
83 | |
---|
84 | $oFCKeditor = new FCKeditor('FCKeditor1') ; |
---|
85 | $oFCKeditor->BasePath = $sBasePath ; |
---|
86 | |
---|
87 | if ( isset($_GET['Lang']) ) |
---|
88 | { |
---|
89 | $oFCKeditor->Config['AutoDetectLanguage'] = false ; |
---|
90 | $oFCKeditor->Config['DefaultLanguage'] = $_GET['Lang'] ; |
---|
91 | } |
---|
92 | else |
---|
93 | { |
---|
94 | $oFCKeditor->Config['AutoDetectLanguage'] = true ; |
---|
95 | $oFCKeditor->Config['DefaultLanguage'] = 'en' ; |
---|
96 | } |
---|
97 | |
---|
98 | $oFCKeditor->Value = 'This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.' ; |
---|
99 | $oFCKeditor->Create() ; |
---|
100 | ?> <br> |
---|
101 | <input type="submit" value="Submit"> |
---|
102 | </form> |
---|
103 | </body> |
---|
104 | </html> |
---|