Martes, Enero 27, 2015

How to add a simple WYSIWYG editor (Web text editor)

I've been looking for a free editor and this is the simplest I got. Download fckeditor and place it to your site directory. Include the following to your code:

<?php
include("../fckeditor/fckeditor.php");

$oFCKeditor = new FCKeditor('FCKeditor1') ;
$oFCKeditor->BasePath = 'fckeditor/' ;
$oFCKeditor->Value      = $_POST["respond"] ;
$oFCKeditor->Create() ;
?>

Where $_POST["respond"] is your variable. And that's it.


Hope this helps.

How to download your report as Excel

First, is to download PHPExcel Library and place it to your site directory. Open the file and see the examples folder. From there, you can edit the details and set your preferences. See more details below:

Requirements
------------

The following requirements should be met prior to using PHPExcel:
* PHP version 5.2.0 or higher
* PHP extension php_zip enabled *)
* PHP extension php_xml enabled
* PHP extension php_gd2 enabled (if not compiled in)

*) php_zip is only needed by PHPExcel_Reader_Excel2007, PHPExcel_Writer_Excel2007,
   PHPExcel_Reader_OOCalc. In other words, if you need PHPExcel to handle .xlsx or .ods
   files you will need the zip extension, but otherwise not.



Installation instructions
-------------------------

Installation is quite easy: copy the contents of the Classes folder to any location
in your application required.

Example:

If your web root folder is /var/www/ you may want to create a subfolder called
/var/www/Classes/ and copy the files into that folder so you end up with files:

/var/www/Classes/PHPExcel.php
/var/www/Classes/PHPExcel/Calculation.php
/var/www/Classes/PHPExcel/Cell.php
...



Getting started
---------------

A good way to get started is to run some of the tests included in the download.
Copy the "Examples" folder next to your "Classes" folder from above so you end up with:

/var/www/Examples/01simple.php
/var/www/Examples/02types.php
...

Start running the test by pointing your browser to the test scripts:

http://example.com/Examples/01simple.php
http://example.com/Examples/02types.php
...

Note: It may be necessary to modify the include/require statements at the beginning of
each of the test scripts if your "Classes" folder from above is named differently.