μ (Micro) and possible Extensions

Post Reply
BranTarik
Ssr. Bludit
Posts: 21
Joined: Fri Nov 16, 2018 10:35 am

I am reffering here to the original μ (Micro) Theme from the original Topic by the Autor named hxii. ;)

hxii already helped me out in case of "centering" the whole Thing. :)

I really adore this Bludit-Theme for its minimalism, focused just on whats importan, the Content.
Oh and of course the already build in Dark-Mode!

BUT there are some "Functions" i would like to have in addition, just for my convient for usability.
I am no Coder, just doing it Stuff by "Trial&Error" and because of that i am now asking about the following "Extensions" and if they are easyly to add or not!? :roll:

1. Pagination, because there are around 1.300 Posts. That would be a very very long List at the Index and would destroy the whole overview and maybe the excellent Loading-Time.

2. Tags and/or Categories, depends on what is easier to implement for me. Maybe somewhere around at the Footer per Post.


Dont get me wrong, i dont want you to give me the whole right Code in the first place and i have to just Copy&Paste it. :oops:

Just point me at the right direction and when i fail to accomplish my goal, i will return and ask for help. :D

Thanks.
(Written with a little bit of help from DeepL in terms of right Translation.) :mrgreen:
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

BranTarik wrote: Fri Mar 19, 2021 8:39 pm 1. Pagination, because there are around 1.300 Posts. That would be a very very long List at the Index and would destroy the whole overview and maybe the excellent Loading-Time.
You can copy the paginator for example from the theme Alternative:

https://github.com/bludit/bludit/blob/b ... me.php#L81
2. Tags and/or Categories, depends on what is easier to implement for me. Maybe somewhere around at the Footer per Post.
Also this can be copied.

For tags for example from the theme Log:

https://github.com/bludit-themes/log/bl ... me.php#L52

For categories for example from the theme Keep It Simple:

https://github.com/bludit-themes/keep-i ... me.php#L35
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
BranTarik
Ssr. Bludit
Posts: 21
Joined: Fri Nov 16, 2018 10:35 am

Edi wrote: Sat Mar 20, 2021 7:08 pm You can copy the paginator for example from the theme Alternative:

https://github.com/bludit/bludit/blob/b ... me.php#L81
2. Tags and/or Categories, depends on what is easier to implement for me. Maybe somewhere around at the Footer per Post.
Also this can be copied.

For tags for example from the theme Log:

https://github.com/bludit-themes/log/bl ... me.php#L52

For categories for example from the theme Keep It Simple:

https://github.com/bludit-themes/keep-i ... me.php#L35
Me again, i'm stuck. :roll:

In the past couple Days i tried a few Things by just "Copy & Paste" and it became very clear to me that i havent any clue about what i am doing.

When i Copy&Paste the whole Code from the Example of the Paginator, i returns a "Internal-Server-Error" and thats it. Same goes for the other Code-Snippets.

The whole u-Theme is just one File, that's it and even with this simplicty in mind i cant figure out how to do it right...

Obivously i do need help, how to put the right code at the right place.... somebody willing to help?
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Why not use a theme with the features you need? :-)

To use the theme μ with the paginator you have to make some modifications.

Delete in the file index.php in the directory /bl-themes/u-master (line 25):

Code: Select all

$posts = $pages->getList(0,-1,1,0,1);
And also (line 27):

Code: Select all

foreach ( $posts as $page ) {
   $page = new Page($page);
Add the following (after line 29):

Code: Select all

<?php foreach ($content as $page): ?>
And the following (line 33):

Code: Select all

<?php endforeach ?>

<!-- Pagination -->
<?php if (Paginator::numberOfPages()>1): ?>
<nav class="paginator">
   <ul class="pagination flex-wrap justify-content-center">

      <!-- Previous button -->
      <?php if (Paginator::showPrev()): ?>
      <li class="page-item mr-2">
         <a class="page-link" href="<?php echo Paginator::previousPageUrl() ?>" tabindex="-1">&#9664; <?php echo $L->get('Previous'); ?></a>
      </li>
      <?php endif; ?>

      <!-- Home button -->
      <li class="page-item <?php if (Paginator::currentPage()==1) echo 'disabled' ?>">
         <a class="page-link" href="<?php echo Theme::siteUrl() ?>"><?php echo $L->get('Home'); ?></a>
      </li>

      <!-- Next button -->
      <?php if (Paginator::showNext()): ?>
      <li class="page-item ml-2">
         <a class="page-link" href="<?php echo Paginator::nextPageUrl() ?>"><?php echo $L->get('Next'); ?> &#9658;</a>
      </li>
      <?php endif; ?>
   </ul>
</nav>

<?php endif ?>
Finally delete (line 35):

Code: Select all

}
The code of the file index.php will now be:

Code: Select all

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<link rel="icon" href="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=">
		<?php echo Theme::metaTags( 'title' ); ?>
		<?php echo Theme::metaTags( 'description' ); ?>
		<?php if ( ! isset( $_GET['textonly'] ) ): ?>
		<style>
			<?php include('css/style.css'); ?>
		</style>
		<?php endif; ?>
		<?php Theme::plugins( 'siteHead' ) ?>
	</head>
	<body>
		<div class="container<?php echo ($page->template())?? ''; ?>">
			<?php
			if ( $WHERE_AM_I === 'home' ) { ?>
			<header class="mb2">
				<?php echo $site->title(); ?>
			</header>
				<?php
				echo '<div class="entries mb2">';
				?>
				<?php foreach ($content as $page): ?>
					<div class="entry mbh">
						<a href="<?php echo $page->permalink(); ?>"><?php echo $page->title(); ?></a>
						<span class="meta g">&mdash; <?php echo $page->date("d.m.y");?><?php echo ($page->category())? ', ' . $page->category() : ''; ?></span>
					</div>
				<?php endforeach ?>

				<!-- Pagination -->
				<?php if (Paginator::numberOfPages()>1): ?>
				<nav class="paginator">
					<ul class="pagination flex-wrap justify-content-center">

						<!-- Previous button -->
						<?php if (Paginator::showPrev()): ?>
						<li class="page-item mr-2">
							<a class="page-link" href="<?php echo Paginator::previousPageUrl() ?>" tabindex="-1">&#9664; <?php echo $L->get('Previous'); ?></a>
						</li>
						<?php endif; ?>

						<!-- Home button -->
						<li class="page-item <?php if (Paginator::currentPage()==1) echo 'disabled' ?>">
							<a class="page-link" href="<?php echo Theme::siteUrl() ?>"><?php echo $L->get('Home'); ?></a>
						</li>

						<!-- Next button -->
						<?php if (Paginator::showNext()): ?>
						<li class="page-item ml-2">
							<a class="page-link" href="<?php echo Paginator::nextPageUrl() ?>"><?php echo $L->get('Next'); ?> &#9658;</a>
						</li>
						<?php endif; ?>
					</ul>
				</nav>
				<?php endif ?>

				<?php

				echo '</div>';
			}
			if ( $WHERE_AM_I === 'page' ) {
				?>
				<header class="mb2">
					<?php if ( $page->parent() ) {
						$parent = new Page($page->parent());
						$p = '<a href="'.$parent->permalink().'">'.$parent->title().'</a> / ';
					} ?>
					<a href="<?php echo $site->url(); ?>"><?php echo $site->title(); ?></a> / <?php echo ($p)?? ''; ?><?php echo $page->title(); ?></header>
				<?php if ($page->coverImage()): ?>
					<div class="cover"><img src="<?php echo $page->coverImage(); ?>" alt="<?php echo $site->title(); ?></a>"></div>
				<?php endif; ?>
				<div class="entry mb2">
					<?php echo $page->content(); ?>
				</div><?php } ?>
			<div class="footer"><?php echo $site->footer(); ?></div>
		</div>
	</body>
</html>
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Post Reply