This is implemented in 3.9.2 (and perhaps in a few earlier minor versions).Torsten_Kelsch wrote: ↑Tue May 28, 2019 9:07 pm Nice workaround, but it would be better if editors could choose the template in the backend …
Custom template for the pages
- Torsten_Kelsch
- Legend Bludit
- Posts: 263
- Joined: Thu Aug 27, 2015 10:24 pm
- Location: Germany
- Has thanked: 4 times
- Been thanked: 2 times
- Contact:
On Error GoTo Bed
@torsten, could you please explain how to achieve this?Torsten_Kelsch wrote: ↑Mon Sep 16, 2019 11:32 pmThis is implemented in 3.9.2 (and perhaps in a few earlier minor versions).Torsten_Kelsch wrote: ↑Tue May 28, 2019 9:07 pm Nice workaround, but it would be better if editors could choose the template in the backend …
In backend under "options" i see the field for "template" but how do I choose my own new template so that it works?
I made a new file called "newpage.php" and put it in the folder PHP, but how do I actually get it to select this new php file template?
/Carsten - New member
- Torsten_Kelsch
- Legend Bludit
- Posts: 263
- Joined: Thu Aug 27, 2015 10:24 pm
- Location: Germany
- Has thanked: 4 times
- Been thanked: 2 times
- Contact:
Manage > Content > Edit > Options > Advanced > Template
Verwalten > Inhalte > Bearbeiten > Einstellungen > Erweitert > Template
Verwalten > Inhalte > Bearbeiten > Einstellungen > Erweitert > Template
- Attachments
-
- bludit-template.png (25.95 KiB) Viewed 4747 times
On Error GoTo Bed
Could you maybe explain a little bit more? Is the template a template for a page? What should a template file look like? Should I save it in the php folder?Torsten_Kelsch wrote: ↑Wed Jan 01, 2020 12:26 am Manage > Content > Edit > Options > Advanced > Template
Verwalten > Inhalte > Bearbeiten > Einstellungen > Erweitert > Template
Thanks
- Torsten_Kelsch
- Legend Bludit
- Posts: 263
- Joined: Thu Aug 27, 2015 10:24 pm
- Location: Germany
- Has thanked: 4 times
- Been thanked: 2 times
- Contact:
@puschmie: Yes, it is a template file for pages, and it should look similar to those in your theme folder (/bl-themes/[theme-name]/php), and you can name it as you wish, let’s say special-page.php or whatever. Also see https://docs.bludit.com/en/themes/theme-basics.
On Error GoTo Bed
Hi and hello from Vienna. After trying various flat file CMS's, i've finally found BLUDIT and it is all i have been looking for. Thanks a lot for this!
I am now having issue with this new page template function - newest version fresh install.
So if i understand correctly, i shall
1 - create a template php file in my /bl-mytheme/php/ folder as
/bl-mytheme/php/my-static-page.php
with some content, or for starters i will just copy the page.php code with some markers to be able to distinguish it from the original
2 - in backend, at page edit, i will enter the "my-static-page.php" in ->options -> template
Here, i've tried both
my-static-page.php
and
my-static-page
but neither seems to work. Am i omitting something?
I've checked the bl-content/databases/page.php and the template is being correctly written to the file, but obviously not used.
Thanks!
Danke und Grüße
I am now having issue with this new page template function - newest version fresh install.
So if i understand correctly, i shall
1 - create a template php file in my /bl-mytheme/php/ folder as
/bl-mytheme/php/my-static-page.php
with some content, or for starters i will just copy the page.php code with some markers to be able to distinguish it from the original
2 - in backend, at page edit, i will enter the "my-static-page.php" in ->options -> template
Here, i've tried both
my-static-page.php
and
my-static-page
but neither seems to work. Am i omitting something?
I've checked the bl-content/databases/page.php and the template is being correctly written to the file, but obviously not used.
Thanks!
Danke und Grüße
Last edited by overcat on Sat Oct 31, 2020 4:08 pm, edited 2 times in total.
i do stuff. #women on slackware.
- Edi
- Site Admin
- Posts: 3121
- Joined: Sun Aug 09, 2015 5:01 pm
- Location: Zurich
- Has thanked: 54 times
- Been thanked: 77 times
- Contact:
This function does not work yet work.
The template is defined in the file index.php of the theme:
Code: Select all
<?php
// $WHERE_AM_I variable detect where the user is browsing
// If the user is watching a particular page/post the variable takes the value "page"
// If the user is watching the frontpage the variable takes the value "home"
if ($WHERE_AM_I == 'page') {
include(THEME_DIR_PHP.'page.php');
} else {
include(THEME_DIR_PHP.'home.php');
}
?>
Code: Select all
<?php
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');
}
?>
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
- Torsten_Kelsch
- Legend Bludit
- Posts: 263
- Joined: Thu Aug 27, 2015 10:24 pm
- Location: Germany
- Has thanked: 4 times
- Been thanked: 2 times
- Contact:
It does not work yet? I did not know that, because I have not tried it already, but I’m wondering why this option isn’t greyed out then.
On Error GoTo Bed
Hi, thanks. That is one of the things which makes me like bludit - pure PHP and very logical.
Too bad, that there is a function which "undocumented does not work yet" - but thanks for clearing this out for me.
The index.php way works fine and it would be enough
(no bloated UI - the text version in index.php is manageable better anyway)
Too bad, that there is a function which "undocumented does not work yet" - but thanks for clearing this out for me.
The index.php way works fine and it would be enough
(no bloated UI - the text version in index.php is manageable better anyway)
i do stuff. #women on slackware.
Now it's some months later - is it planned that this function is coming to life maybe in Bludit 4.x?This function does not work yet work.
The recent solution is not really working for me because I want to use a special template for many pages. (Perhaps a solution could be to use the php-switch Edi described for a category, but I don't know how to implement this …)