sample04.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /*
  3. * FCKeditor - The text editor for Internet - http://www.fckeditor.net
  4. * Copyright (C) 2003-2009 Frederico Caldeira Knabben
  5. *
  6. * == BEGIN LICENSE ==
  7. *
  8. * Licensed under the terms of any of the following licenses at your
  9. * choice:
  10. *
  11. * - GNU General Public License Version 2 or later (the "GPL")
  12. * http://www.gnu.org/licenses/gpl.html
  13. *
  14. * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
  15. * http://www.gnu.org/licenses/lgpl.html
  16. *
  17. * - Mozilla Public License Version 1.1 or later (the "MPL")
  18. * http://www.mozilla.org/MPL/MPL-1.1.html
  19. *
  20. * == END LICENSE ==
  21. *
  22. * Sample page.
  23. */
  24. include("../../fckeditor.php") ;
  25. ?>
  26. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  27. <html>
  28. <head>
  29. <title>FCKeditor - Sample</title>
  30. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  31. <meta name="robots" content="noindex, nofollow">
  32. <link href="../sample.css" rel="stylesheet" type="text/css" />
  33. <script type="text/javascript">
  34. function FCKeditor_OnComplete( editorInstance )
  35. {
  36. var oCombo = document.getElementById( 'cmbSkins' ) ;
  37. // Get the active skin.
  38. var sSkin = editorInstance.Config['SkinPath'] ;
  39. sSkin = sSkin.match( /[^\/]+(?=\/$)/g ) ;
  40. oCombo.value = sSkin ;
  41. oCombo.style.visibility = '' ;
  42. }
  43. function ChangeSkin( skinName )
  44. {
  45. window.location.href = window.location.pathname + "?Skin=" + skinName ;
  46. }
  47. </script>
  48. </head>
  49. <body>
  50. <h1>FCKeditor - PHP - Sample 4</h1>
  51. This sample shows how to change the editor skin.
  52. <hr>
  53. <table cellpadding="0" cellspacing="0" border="0">
  54. <tr>
  55. <td>
  56. Select the skin to load:&nbsp;
  57. </td>
  58. <td>
  59. <select id="cmbSkins" onchange="ChangeSkin(this.value);" style="VISIBILITY: hidden">
  60. <option value="default" selected>Default</option>
  61. <option value="office2003">Office 2003</option>
  62. <option value="silver">Silver</option>
  63. </select>
  64. </td>
  65. </tr>
  66. </table>
  67. <br>
  68. <form action="sampleposteddata.php" method="post" target="_blank">
  69. <?php
  70. // Automatically calculates the editor base path based on the _samples directory.
  71. // This is usefull only for these samples. A real application should use something like this:
  72. // $oFCKeditor->BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value.
  73. $sBasePath = $_SERVER['PHP_SELF'] ;
  74. $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
  75. $oFCKeditor = new FCKeditor('FCKeditor1') ;
  76. $oFCKeditor->BasePath = $sBasePath ;
  77. if ( isset($_GET['Skin']) )
  78. $oFCKeditor->Config['SkinPath'] = $sBasePath . 'editor/skins/' . htmlspecialchars($_GET['Skin']) . '/' ;
  79. $oFCKeditor->Value = '<p>This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.</p>' ;
  80. $oFCKeditor->Create() ;
  81. ?>
  82. <br>
  83. <input type="submit" value="Submit">
  84. </form>
  85. </body>
  86. </html>