Ana içeriğe geç

Include custom HTML files or execute custom PHP files in templates - Bilgi Bankası / Developer & Reporting / Portal Customization - Deskpro Support

Include custom HTML files or execute custom PHP files in templates

Yazarlar listesi

These options increase the power of the template system.

To use these options you need to enable a special option. Add this line to your config.php file:

$DP_CONFIG['enable_include_file'] = true;

 

Including a file in a template

Use the include_file template function to include a file:

<div class="page">
{{ include_file('/path/to/file.html') }}
</div>

 

The file will be included as-is (i.e., the contents are not filtered or executed in any way).

 

Including and executing PHP in a template

Use the include_php_file template function to include a PHP file:

<div class="page">
{{ include_php_file('/path/to/file.php') }}
</div>

 

The file will be PHP include()'ed into the template. This means the file will be executed as PHP and the contents captured and inserted into the template.

You can pass template variables into the local scope by passing a second parameter:

<div class="page">
{{ include_php_file('/path/to/file.php', {user_email: app.user.primary_email_address}) }}
</div>

// In file.php
echo "Hello, $user_email\n";

Yararlı Yararlı değil

82 kişiden 38 kişi bu sayfayı yararlı buldu

Bir yorum ekle

Bir yorum gönderebilmek için lütfen oturum açın ya da kayıt olun.

Bir parola hatırlatıcısına ihtiyacın var mı?