[ Index ]
 

Code source de FCKeditor 2.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/_samples/php/ -> sample02.php (source)

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


Généré le : Sun Feb 25 15:28:05 2007 par Balluche grâce à PHPXref 0.7