Page 2 of 3

Re: list posts

Posted: Thu Mar 30, 2017 5:30 pm
by ccbc
So, I adjusted it and it still doesn't work...

index.php of the theme :

Code: Select all

 <?php
    if( ($Url->whereAmI()=='home') || ($Url->whereAmI()=='tag') )
    {
      include(PATH_THEME_PHP.'home.php');
    }
    elseif($Url->whereAmI()=='post')
    {
      include(PATH_THEME_PHP.'post.php');
    }
    elseif($Url->whereAmI()=='page')
    {
      include(PATH_THEME_PHP.'page.php');
    }
    elseif($Url->whereAmI()=='page' && ($Page->title()=='all'))
    {
      include(PATH_THEME_PHP.'archives.php');
    }
  ?>
New file for the theme, php/archives.php :

Code: Select all

 <article class="post">
    <!-- Plugins Page Begin -->
    <?php Theme::plugins('pageBegin') ?>
    <section class="post-header">
      <header class="post-title">
        <h1><?php echo $Page->title() ?></h1>
      </header>
    </section>
    <section class="post-content">
	<?php 
	$totalPublishedPosts = $dbPosts->numberPost();

    $posts = buildPostsForPage(0, $totalPublishedPosts, true, false);
    
    foreach($posts as $Post) 
    {
        echo '<h1><a href="'.$Post->permalink().'">'.$Post->title().'</a></h1>';
    }
    ?>
    </section>
    <!-- Plugins Page Begin -->
    <?php Theme::plugins('pageEnd') ?>
  </article>
When I am calling URL/pages/all, I got the 404 default error.

What am I doing wrong?

Re: list posts

Posted: Thu Mar 30, 2017 7:24 pm
by Edi
ccbc wrote:When I am calling URL/pages/all, I got the 404 default error.
Have you set "/pages/" at settings "Advanced" > "URL filters" for "Pages"? If you use the default setting the link would be URL/all.

Re: list posts

Posted: Fri Mar 31, 2017 3:32 am
by ccbc
Edi wrote:
ccbc wrote:When I am calling URL/pages/all, I got the 404 default error.
Have you set "/pages/" at settings "Advanced" > "URL filters" for "Pages"? If you use the default setting the link would be URL/all.
Yes it is set to /pages/.

Weird...

Re: list posts

Posted: Fri Mar 31, 2017 11:49 am
by Edi
Yes, really weird. Can you please mail me a ZIP with the installation. Then I can have a look at it.

Re: [solved] list posts // all | by tags

Posted: Fri Aug 03, 2018 8:50 am
by LRAM
Hi

I also need a page were all my post will be list with a link to open each of them (with a filter by categories eventually)
Any simple way to do this ?
thanks

Re: [solved] list posts // all | by tags

Posted: Fri Aug 03, 2018 6:58 pm
by Edi
LRAM wrote: Fri Aug 03, 2018 8:50 am I also need a page were all my post will be list with a link to open each of them (with a filter by categories eventually)
The following shows all posts on a page:
  1. Go to "Settings" > "Advanced".
  2. Select at "Content" > "Items per page" the option "All content".
  3. Select at "Predefined pages" > "Homepage" the option "Default".
If another page is set as "Homepage" the page is shown with the URL that can be set at "URL filters" > "Blog". For example:

https://mydomain.com/blog/

Categories are by itself a sort of filter.

Re: [solved] list posts // all | by tags

Posted: Sun Aug 05, 2018 10:16 am
by LRAM
Hi Edi

Thanks for your answer
It's not exactly what i'm searching for
Your solution is not a list of all available post, but all the post

https://sucrepop.com/Ukulele/

What i wish to provide is a list where someone could choose the post, click on it and access it

Re: [solved] list posts // all | by tags

Posted: Sun Aug 05, 2018 2:20 pm
by Edi
You can copy and modify the template home.php and show only selected elements as permalink, title etc.

Bludit 3 will allow to define own templates for posts and pages.

Using Bludit 2 you can extend the template index.php like this:

Code: Select all

<?php
	if ($WHERE_AM_I=='page'){
		if ( $page->slug() == 'list'){
			include(THEME_DIR_PHP.'list.php');
		} else {
			include(THEME_DIR_PHP.'page.php');
		}
	} else {
		include(THEME_DIR_PHP.'home.php');
	}
?>
In this case the title (and slug) of the page with the list is "List" ("list"), the copied and modified template is list.php.

Re: [solved] list posts // all | by tags

Posted: Mon Aug 06, 2018 8:26 am
by LRAM
Thanks Edi
I'll give it a try

Re: [solved] list posts // all | by tags

Posted: Mon Aug 06, 2018 12:56 pm
by Edi
By the way, you can find the code snippet to list all pages in the documentation:

https://docs.bludit.com/en/developers/content-pages

And the code snippet for all static pages:

https://docs.bludit.com/en/developers/c ... atic-pages