Custom template for the pages

Post Reply
Artem
Ssr. Bludit
Posts: 10
Joined: Wed Mar 13, 2019 7:24 pm

Thu Mar 14, 2019 11:51 am

How should I use this option?
Image

Do I need to write something else in the index.php?
User avatar
Edi
Site Admin
Posts: 1567
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Sat Mar 16, 2019 11:49 pm

The function is not yet implemented.

But you can modify the if conditions in the file index.php of your theme.You can for example use an own template contact.php for your contact page with the following:

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).
Artem
Ssr. Bludit
Posts: 10
Joined: Wed Mar 13, 2019 7:24 pm

Sun Mar 17, 2019 7:44 pm

YEAH!
Thanks!

And when this feature will be implemented?
User avatar
Edi
Site Admin
Posts: 1567
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Sun Mar 17, 2019 10:56 pm

Artem wrote:
Sun Mar 17, 2019 7:44 pm
And when this feature will be implemented?
Sorry, no idea at the moment.
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
Artem
Ssr. Bludit
Posts: 10
Joined: Wed Mar 13, 2019 7:24 pm

Tue Mar 19, 2019 6:25 pm

Ok.
I did like this:

Code: Select all

if ($WHERE_AM_I == 'page') {
	if ($page->template()) {
		include(THEME_DIR_PHP.$page->template().'.php');
	} else {
		include(THEME_DIR_PHP.'page.php');
	}
} else {
	include(THEME_DIR_PHP.'blog.php');
}
Bludit 3.8.1 pro
User avatar
Edi
Site Admin
Posts: 1567
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Tue Mar 19, 2019 10:54 pm

Thank you, I didn't know that this is possible! :oops:
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
User avatar
jmonroe
Ssr. Bludit
Posts: 24
Joined: Mon Feb 22, 2016 8:06 am
Location: USA
Contact:

Sun Mar 24, 2019 1:45 pm

Nice workaround @Artem So Edi...now we know :D
Jeremy Monroe
Kreativmind Show Support for Bludit via Patreon
User avatar
Torsten_Kelsch
Master Bludit
Posts: 163
Joined: Thu Aug 27, 2015 10:24 pm
Location: Germany
Contact:

Tue May 28, 2019 9:07 pm

Nice workaround, but it would be better if editors could choose the template in the backend while creating a page (if there are different templates in the theme). Some CMSs offer such a function, and it makes the CMS really flexible, regarding the design.
ON ERROR GOTO BED
Post Reply