Wednesday, January 5, 2011

Re: How to get work PHPRtfLite in cake ???

Thanks Ryan, the problem is solved.

This is how to use PHPRtfLite with cakePHP :
1. download PHPRtfLite and then extract to temporary folder.
2. Copy the "lib" Folder from PHPRtfLite to this folder : app/vendors/
3. rename the "lib" folder with "phprtf"
4. make a new layout and give it named "rtf.ctp". This is the code for
layout :
<?php
header("Content-type: application/msword");
echo $content_for_layout;
?>

5. in my controller, make a function (an action) called "helloword".
The code is :
function helloword() {
$this->layout = 'rtf';
}

6. In a view, create file "helloword.ctp". The code is :
<?php
App::import('Vendor','phprtflite',array('file'=>'phprtf'.DS.'PHPRtfLite.php'));
$rtf = new PHPRtfLite();
$sect = $rtf->addSection();
$sect->writeText('<i>Hello <b>World</b></i>.', new
PHPRtfLite_Font(12), new PHPRtfLite_ParFormat('center'));
$rtf->sendRtf('HelloWorld'); // this is the output to a file. the
parameter is the file name (called "HelloWord.rtf")
?>

7. done.

For another examples, you can look it in "samples" folder of
PHPRtfLite.

Thanks...
Abu Zaid


On Jan 2, 3:58 pm, Ryan Schmidt <google-2...@ryandesign.com> wrote:
> On Jan 1, 2011, at 08:17, Abu Zaid wrote:
>
> > Does anyone know how to get PHPRtfLite (http://sourceforge.net/projects/phprtf/) to work in cake 1.3.x ??
> > I've copy the library in Vendor and i've use App::import but can't get worked... :(
> > even with the hello world example, i can't get it worked.
>
> Why not? What exactly did you do, and what exactly occurred?

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate