independent/standalone pages

User avatar
Jay
Master Bludit
Posts: 144
Joined: Mon Feb 11, 2019 8:41 pm
Has thanked: 6 times
Been thanked: 4 times

arfa wrote: Sun Jul 21, 2024 11:55 pm >> insert a "hidden" string...
I am not sure what this means. I am sure it will be obvious if you could give me an example please?
Template is one of the input fields in page's options, see attached screenshot.
SpegalDev wrote: Mon Jul 22, 2024 8:25 pm I think Jay was talking about adding a custom field. You can do so in /admin/settings:
I completely forgot about custom fields which suit ideally for such things.
But atm I have no access to IDE thus can't check obj properties.

arfa: just paste the code provided by SpegalDev without the default [] brackets. At this stage you wouldn't even need more custom fields other than this one.

https:/nietak.de
Attachments
Bludit-page-options.png
Bludit-page-options.png (24.79 KiB) Viewed 8956 times
Last edited by Jay on Wed Feb 26, 2025 12:58 am, edited 1 time in total.
arfa
Master Bludit
Posts: 163
Joined: Tue Jul 04, 2017 4:31 am
Location: New Zealand
Has thanked: 13 times
Been thanked: 27 times

Ah, the missing link. Thank you.

That all works fine but still there is the question of the default [ ]
I toggle the setup with them in site.php and - in=no checkbox - out=checkbox.
It irks me :(

>> At this stage you wouldn't even need more custom fields other than this one.
Yes but, a bit of a tangent that relates to my hidden pages forming a part of a sub-set of pages.
Nav click on 'camping' and a page is loaded. The plan is to have a small list of links at the top of that page that connect to the hidden pages: 'tents' 'backpacks' 'stoves' [for example]. And each of those sub-pages has the same link set at the top.
The question is - how to dynamically inject that href text?
I was wondering about using an additional custom field to do this

Code: Select all

{
    "gallery": {
        "type": "bool",
        "label": "Page Links",
        "tip": "Add link list to gallery pages."
    }
}
And then, (in page.php?) set up a querry like

Code: Select all

if ($page->template() == "gallery") 
// then php build the list and echo - before $page->content();
I really am not sure exactly what the above should be but hopefully you get what I am aiming for?

I wouldn't be surprised if there is a better way to achieve and would be delighted to have suggestions. In the meantime I am enjoying extending my bludit knowledge with custom fields - ideally in the plural - with brackets?

I hope that this is clear enough?
thx - Kusalo
arfa
Master Bludit
Posts: 163
Joined: Tue Jul 04, 2017 4:31 am
Location: New Zealand
Has thanked: 13 times
Been thanked: 27 times

I have been revisiting the code this morning. If we forget the [ ] and use { } throughout then I now see two checkboxes in the newContent>options>custom using:

Code: Select all

{
    "hidden": {
        "type": "bool",
        "label": "Hidden Page",
        "tip": "Check if the article should be hidden in navigation."
    },
    "gallery": {
        "type": "bool",
        "label": "Page Links",
        "tip": "Add link list to gallery pages."
    }
}
And, not only does it not crash the site but this code in both pages.php and home.php

Code: Select all

if ($page->template() == "gallery") { echo 'I can PHP build list and add gallery links here'; }
Gives me what I want on both.

BTW Jay... I was able to incorporate the hidden bit of this thread into your dropdown menu code. Awesome. thx

Code: Select all

if (!$staticPage->isChild() && $staticPage->template() !== "hidden")
I think I am done here.
I have learned so much through this. Thank you.
Kusalo
Post Reply