[solved] list posts // all | by tags

ccbc
Ssr. Bludit
Posts: 14
Joined: Tue Mar 01, 2016 1:22 pm

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?
User avatar
Edi
Site Admin
Posts: 3120
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

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.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
ccbc
Ssr. Bludit
Posts: 14
Joined: Tue Mar 01, 2016 1:22 pm

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...
User avatar
Edi
Site Admin
Posts: 3120
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Yes, really weird. Can you please mail me a ZIP with the installation. Then I can have a look at it.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
LRAM
Master Bludit
Posts: 199
Joined: Sat Sep 24, 2016 4:02 pm
Location: France
Has thanked: 22 times
Been thanked: 2 times
Contact:

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
https://sucrepop.com
Candies for the ears
User avatar
Edi
Site Admin
Posts: 3120
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

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.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
LRAM
Master Bludit
Posts: 199
Joined: Sat Sep 24, 2016 4:02 pm
Location: France
Has thanked: 22 times
Been thanked: 2 times
Contact:

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
https://sucrepop.com
Candies for the ears
User avatar
Edi
Site Admin
Posts: 3120
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

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.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
LRAM
Master Bludit
Posts: 199
Joined: Sat Sep 24, 2016 4:02 pm
Location: France
Has thanked: 22 times
Been thanked: 2 times
Contact:

Thanks Edi
I'll give it a try
https://sucrepop.com
Candies for the ears
User avatar
Edi
Site Admin
Posts: 3120
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

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
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Post Reply