doccy extension

can anyone help me im newbie here, how to solved this problem ?

Error 500

mkdir() [<a href=‘function.mkdir’>function.mkdir</a>]: No such file or directory

does anyone have an example of the correct script when using doccy ?

This function should help - although not doccy:




// Creates a new directory (or a chain of directories)

// Returns true if created okay.

// Returns true if path already exists.

public function fctnCreatePath($path) 

{

    if (is_dir($path)) return true;

    $prev_path = substr($path, 0, strrpos($path, '/', -2) + 1 );

    $return = $this->fctnCreatePath($prev_path);

    return ($return && is_writable($prev_path)) ? mkdir($path) : false;

}



still error :(

What is your path?

i still use default path for trying




public function behaviors()

	{

		$output = Yii::app()->request->baseUrl . '/protected/views/penerimaan/';

		

		return array(

            'doccy'=>array(                                                                                                

                'class' => 'application.extensions.doccy.Doccy',   

				'options' => array(

							//'templatePath' => '/Templates',  // Path where docx templates are stored. Default value is controller`s view folder 

							'outputPath' => Yii::app()->request->baseUrl . '/protected/views/penerimaan/',  // Path where output files should be stored. Default value is application runtime folder 

							//'docxgenFolder' => 'docxgen-master',  // Name of the folder which holds docxgen library (must be in the extension folder). Default value is 'docxgen-master' 

				),

			),

		);

	}


    public function actionDownload()

    {

        $this->doccy->newFile('template.docx'); // template.docx must be located in protected/views/report/template.docx  where "report" is the name of the curren controller view folder (alternatively you must configure option "templatePath")

        $this->doccy->phpdocx->assignToHeader("#HEADER1#","HRADIeader 1"); // basic field mapping to header

        $this->doccy->phpdocx->assignToFooter("#FOOTER1#","Footer 1"); // basic field mapping to footer

        $this->doccy->phpdocx->assign("#TITLE1#","Pet shop BOYS list"); // basic field mapping

        $this->doccy->phpdocx->assignBlock("members",array(array("#NAME#"=>"John","#SURNAME#"=>"DOE"),array("#NAME#"=>"Jane","#SURNAME#"=>"DOE"))); // this would replicate two members block with the associated values

        $this->doccy->phpdocx->assignNestedBlock("pets",array(array("#PETNAME#"=>"Rex")),array("members"=>1)); // would create a block pets for john doe with the name rex

        $this->doccy->phpdocx->assignNestedBlock("pets",array(array("#PETNAME#"=>"Rox")),array("members"=>2)); // would create a block pets for jane doe with the name rox

        $this->doccy->phpdocx->assignNestedBlock("toys",array(array("#TOYNAME#"=>"Ball"),array("#TOYNAME#"=>"Frisbee"),array("#TOYNAME#"=>"Box")),array("members"=>1,"pets"=>1)); // would create a block toy for rex

        $this->doccy->phpdocx->assignNestedBlock("toys",array(array("#TOYNAME#"=>"Frisbee")),array("members"=>2,"pets"=>1)); // would create a block toy for rox

        $this->renderDocx("ExampleReport.docx", true); // use $forceDownload=false in order to (just) store file in the outputPath folder.

    }



Check all the answers and their links in this post

It could be for example that some directories in your path does not exist yet and your mkdir() function does not create them (recursive parameter is not set to true).