TomPich Posted October 11, 2023 Posted October 11, 2023 Hello there, I’m exploring Processwire and I really like what I discovered up to now. I would like to abandon WordPress and I have quite fair knowledge in both back- and frontend dev. So, from what I saw with Processwire, it seems to really fit my needs. Here is my question: I need a place to store global data (like phone number, socials links, website title, etc...) and some pictures that will be used in several pages (like a logo). As per my understanding, I created a page based on a template with all fields required. This page must not be displayed in the front site (and I didn’t create any template file for it). When I keep it unpublished, the title of the page, in the admin page tree, is strikethrough. That may be a bit confusing for the end user (i.e. my client). And I’m pretty sure that, if my client edit this page, they will press the "publish" button instead of "save + keep unpublished". So keeping it unpublished is kind of a lame option. If I publish it, it uses the basic-page.php file to render (although I read somewhere that if no template file is provided, the page will not be shown). So that’s not good either. Am I missing something? Is there some kind of best practice that I’m not aware of? Sorry if I didn’t RTFM enough, but I did some research and didn’t find the answer to my question. Thank you, Cheers Thomas
ngrmm Posted October 11, 2023 Posted October 11, 2023 @TomPich welcome! Happy for you escaping WordPress. If you create a page in the CMS it always needs a template. This template defines which fields it has, handles access etc. … This is the backend part. In order to display this page under the it's own path you will need a .php-Template file in the dir site/templates/your-template-name.php So for your need you could do this: – create a new template in processwire Setup > Templates > add new – add your fields to this template – create a page with this template somewhere in the page tree As long as you don't create a php-template file for it, you will be not able to display it under it's own path. But you still can use the content of this page in other php templates. 1
TomPich Posted October 11, 2023 Author Posted October 11, 2023 Thank you for your answer. That was quick! ? Quote As long as you don't create a php-template file for it, you will be not able to display it under it's own path. That’s indeed what I read. But, even without a php-template file, when the page is published and I enter the corresponding url, it uses the basic-page.php file to display the content. It seems to act as a fall-back template. I don’t understand why. Just to clarify the situation. The page name is informations-generales. It uses a template named "general_informations" with some fields, but with no template file associated. The page is published. When I enter [localhost/myprocesswiretestsite]/informations-generales/, I get the basic-page.php template displayed. Maybe I missed something in the config file.
ngrmm Posted October 11, 2023 Posted October 11, 2023 I think what happens is this: When you try to view [localhost/myprocesswiretestsite]/informations-generales/ processwire does not find any associated template and gives you a 404-Error. And your 404-Error-Page has the basic-page.php template. This is how it supposed to be. This happens also if you type in [localhost/myprocesswiretestsite]/qwer1234/. 2 1
Krlos Posted October 11, 2023 Posted October 11, 2023 @TomPich welcome to Processwire! There are two modules that could solve your need https://processwire.com/modules/settings-factory/ https://processwire.com/modules/process-general-settings/
TomPich Posted October 11, 2023 Author Posted October 11, 2023 Thanks @ngrmm. It’s definitly that! It’s so logic, I should have thought about that. ? Thank you @Krlos. But before I use any modules, I’d rather have a fair understanding of what’s going on under the hood. Cheers Thomas 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now