Using the template keyword

Post Reply
keltis
Jr. Bludit
Posts: 1
Joined: Fri Jul 12, 2019 4:50 pm

Fri Jul 12, 2019 4:55 pm

Hi everybody,

under `Content > Options > Advanced` you can specify a template name, as shown in the screenshot.

Do I need to manually check for the template name using php or is there a build-in support for templates already?

Best regards
Thomas

Sreenshot:
Screenshot 2019-07-12 at 16.51.46.png
Screenshot 2019-07-12 at 16.51.46.png (24.42 KiB) Viewed 78 times
User avatar
Edi
Site Admin
Posts: 1567
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Fri Jul 12, 2019 8:17 pm

This function is not yet implemented.

But you can select a template with an if condition in the file index.php of the theme.

If you have for example a template for a page with contact information (with the slug "contact") you can use:

Code: Select all

if ($WHERE_AM_I == 'page') {
   if ($page->slug() == 'contact') {
      include(THEME_DIR_PHP.'contact.php');
   else {
      include(THEME_DIR_PHP.'page.php');
      }
} else {
   include(THEME_DIR_PHP.'home.php');
}
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
Post Reply