CakePdf\Pdf\CakePdf::templatePath PHP Метод

templatePath() публичный Метод

Template path
public templatePath ( mixed $templatePath = false ) : mixed
$templatePath mixed The path of the template to use
Результат mixed
    public function templatePath($templatePath = false)
    {
        if ($templatePath === false) {
            return $this->_templatePath;
        }
        $this->_templatePath = $templatePath;
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * Test the custom paths for Templates
  *
  * @dataProvider provider
  */
 public function testCustomTemplatePaths($config)
 {
     $pdf = new CakePdf($config);
     $pdf->viewVars(['post' => 'testing']);
     $pdf->template('view', 'default');
     $pdf->templatePath('Posts/pdf');
     $result = $pdf->output();
     $expected = '<h2>Rendered with default layout</h2>' . "\n" . 'Post data: testing';
     $this->assertEquals($expected, $result);
 }