I just finished a website for a client and he asked me if we could have a simple temporary homepage while he uploads the contents on the final website. I created a template for this simple page but I am just not sure on how should I use this template as the homepage and keep the original homepage in the layout so he can upload the contents and see how it looks, could someone point me in a solution for this? I searched in the forum and saw some options with “c::set(‘home’…” but somehow didn’t understand how to do this and didn’t finde anything on the docs
I also have another question regarding multiple return arrays on the config.php. I was looking on the docs and I should only have 1 array had but when I try to put everything together I get an error, can someone point me in right approach here?
If you do it like this, you should make sure that all other templates go to the error page (either add a redirect in your templates or use a route) or are in draft status.
You can only use one return statement. Why? It’s important to understand what return does: it returns the control to the calling script, which means that anything that comes after a return statement is ignored. Of course, a script/function can have multiple return statements when it uses conditions, e.g. stupid example:
thank you so much for the answer and explaining the importance of return, just one to make sure that I understand the debug as well, the debug should be false as soon as the website goes online right? thank you once again!!
On a side note, you can use multiple config files per domain, e.g. on the one for localhost you can set debug to true, on production to false (so you don’t have to remember to change your settings):
Hi @texnixe sorry for another question but I just set up the original home, about & projects to drafts but then they are not accessible via the panel and therefore the client cannot update them. is there a way to keep them visible in the panel? on the content folder they are “01_projects” “02_about” & home folders. I need to access them via the panel while the temporary homepage is published so the client can update them.
Whether they appear in the Panel or not doesn’t depend on their status, rather how your sections are set up.
If your pages have a prepended number they are not drafts, anyway.
However, it might make more sense if you follow my first suggestion and redirect all templates apart from the temporary one and the imprint to the error page if user is not logged in.
I have a drafts section my site.yml and I see it on my panel but if I change 03_about to drafts it just disappears completely on the panel, I can see iit on my content folder under drafts and without the number but on the panel is just gone. do you know why this happens?
To redirect all templates can I use something like this: <?php
if(!$site->user()->isTrue()) go(‘error’) ?>
it seems to be working but added as a snippet and now I need to add it to all templates, is there a way to do this in a more simple way so I don’t have to go to each template again when the pages are ready? thank you so much!
thank you I just updated the redirect and it’s working, and is this a good way to add this code to a snippet and add this snippet to each template or is there a better way?
I just realised why the drafts were not working, I had a template on the blueprint that’s why. Do you think it’s still better to use the redirect? I am just wondering because then when the pages are ready to go online I need to remove the redirect
Thank you so much, I just tried the route way and deleted the snippet but now I always go to the error page even if I’m logged in. not sure why this is happening