[solved] list posts // all | by tags

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

Thu Mar 30, 2017 5:30 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: 1261
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Thu Mar 30, 2017 7:24 pm

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.
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
ccbc
Ssr. Bludit
Posts: 12
Joined: Tue Mar 01, 2016 1:22 pm

Fri Mar 31, 2017 3:32 am

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: 1261
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Fri Mar 31, 2017 11:49 am

Yes, really weird. Can you please mail me a ZIP with the installation. Then I can have a look at it.
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
User avatar
LRAM
Master Bludit
Posts: 69
Joined: Sat Sep 24, 2016 4:02 pm
Location: France
Contact:

Fri Aug 03, 2018 8:50 am

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
User avatar
Edi
Site Admin
Posts: 1261
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Fri Aug 03, 2018 6:58 pm

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.
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
User avatar
LRAM
Master Bludit
Posts: 69
Joined: Sat Sep 24, 2016 4:02 pm
Location: France
Contact:

Sun Aug 05, 2018 10:16 am

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
User avatar
Edi
Site Admin
Posts: 1261
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Sun Aug 05, 2018 2:20 pm

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.
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
User avatar
LRAM
Master Bludit
Posts: 69
Joined: Sat Sep 24, 2016 4:02 pm
Location: France
Contact:

Mon Aug 06, 2018 8:26 am

Thanks Edi
I'll give it a try
User avatar
Edi
Site Admin
Posts: 1261
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Contact:

Mon Aug 06, 2018 12:56 pm

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
Planet Bludit, Tipps, Snippets und nützliche Links. - Newsletter, Informationen zu Bludit (auf Deutsch).
Post Reply