Exclude Page from Menu+Page Count
ttrack opened this issue · comments
hello,
how can i exclude a page from the menu/nav?
i looked at reference but can´t figure it out.
also how can i count the total pages from article (the total pages from one page) and echo it.
thank you in advanced.
have a nice day
ttrack
how can i exclude a page from the menu/nav?
The easiest way would be to save the page with extension .archive
.
how can i count the total pages from article (the total pages from one page) and echo it.
Try:
echo Pages::from('.\path\to\page-folder')->count();
Or, you can also do that in the raw way:
echo q(g('.\path\to\page-folder', 'page'));
Related: #122
how can i exclude a page from the menu/nav?
The easiest way would be to save the page with extension
.archive
.
briliant! this works! -----> hide-from-navigation: true in yaml doesn´t work.
how can i count the total pages from article (the total pages from one page) and echo it.
Try:
echo Pages::from('.\path\to\page-folder')->count();
doesn ´t work
Or, you can also do that in the raw way:
echo q(g('.\path\to\page-folder', 'page'));
doesn´t work
Related: #122
what worked ---> echo $pages->count(); <---
thank you for your super-fast reply!
is their a way to show/echo the last modified/last updated time?
and a genernal question, as i work with mecha for the first time, i have build-in 3 custom-fields as data in layout, is there a better/faster way to do it?
i love the simplicity of mecha, everything is where it should be - the panel is great!
By default, Mecha does not have last updated data because to generate such data requires a GUI form to store the current time to a file. As alternative, you can get page’s file modification time. But this does not guarantee that the value will remain consistent across copy/paste/move actions.
$updated = new Time(filemtime($page->path));
echo 'Last update: ' . $updated->en;
Please note that echo $pages->count()
only show pages count in the current page. Sometimes this value represent total chunk of visible pages in index view rather than showing the whole pages count.
Try this to show the total article pages:
echo Pages::from(LOT . DS . 'page' . DS . 'article')->count();
i have build-in 3 custom-fields as data in layout, is there a better/faster way to do it?
If the value is constant, you can put them as default states:
State::set('x.page.page', [
'foo' => 1,
'bar' => 2,
'baz' => 3
]);
If the value is dynamic (you need to fill it manually), you can add custom fields.