Skip to content

Commit

Permalink
Automated deployment: Fri Mar 22 14:29:16 UTC 2024 master
Browse files Browse the repository at this point in the history
  • Loading branch information
froschdesign committed Mar 22, 2024
1 parent ad36b23 commit b35a5ac
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 121 deletions.
Binary file added images/user-guide.navigation.menu-breadcrumbs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/user-guide.pagination.sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -965,5 +965,5 @@ <h5 class="modal-title">Search</h5>

<!--
MkDocs version : 1.5.3
Build Date UTC : 2024-03-22 09:47:25.281372+00:00
Build Date UTC : 2024-03-22 14:29:15.374380+00:00
-->
11 changes: 7 additions & 4 deletions navigation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -653,11 +653,12 @@ <h2 id="adding-breadcrumbs">Adding Breadcrumbs</h2>
&lt;?= $this-&gt;content ?&gt;
&lt;/div&gt;</code></pre>
<p>This adds a simple but functional breadcrumb to every page (we tell it to render
from a depth of 0 so we see all page levels), but we can do better than that!
Because Bootstrap has a styled breadcrumb as part of its base CSS, let's add
from a depth of 0 so we see all page levels), but we can do better than that!</p>
<p>Because Bootstrap has a styled breadcrumb as part of its base CSS, let's add
a partial that outputs the <code>&lt;ul&gt;</code> using Bootstrap styles. We'll create it in the
<code>view</code> directory of the <code>Application</code> module (this partial is application wide,
rather than album specific):</p>
rather than album specific).</p>
<p>Let's create the partial <code>module/Application/view/partial/breadcrumbs.phtml</code>:</p>
<pre class="highlight"><code class="language-php">&lt;?php // in module/Application/view/partial/breadcrumb.phtml: ?&gt;
&lt;nav aria-label="breadcrumb"&gt;
&lt;ol class="breadcrumb"&gt;
Expand Down Expand Up @@ -697,7 +698,9 @@ <h2 id="adding-breadcrumbs">Adding Breadcrumbs</h2>
-&gt;setPartial('partial/breadcrumb') ?&gt;
&lt;?= $this-&gt;content ?&gt;
&lt;/div&gt;</code></pre>
<p>Refreshing the page now gives us a styled set of breadcrumbs on each page.</p>
<p>Refreshing the page now gives us a styled set of breadcrumbs on each page that should look
like this:</p>
<p><img alt="navigation" src="../images/user-guide.navigation.menu-breadcrumbs.png" class="img-responsive"/></p>



Expand Down
35 changes: 21 additions & 14 deletions pagination/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,9 @@ <h1 id="using-laminas-paginator-in-your-album-module">Using laminas-paginator in
one page is not a problem. However, how will the album list look when we have
100 albums or more in our database? The standard solution to this problem is to
split the data up into a number of pages, and allow the user to navigate around
these pages using a pagination control. Just type "Laminas" into Google,
and you can see their pagination control at the bottom of the page:</p>
<p><img alt="Example pagination control" src="../images/pagination.sample.png" class="img-responsive"/></p>
these pages using a pagination control. </p>
<p>A typical paginator on a web page looks like this:</p>
<p><img alt="Example pagination control" src="../images/user-guide.pagination.sample.png" class="img-responsive"/></p>
<h2 id="preparation">Preparation</h2>
<p>As before, we are going to use sqlite, via PHP's PDO driver. Create a text file
<code>data/album-fixtures.sql</code> with the following contents:</p>
Expand Down Expand Up @@ -704,20 +704,24 @@ <h3 id="using-php-to-create-the-database">Using PHP to Create the Database</h3>
list at <code>/album</code>, you'll see a huge long list of 150+ albums; it's ugly.</p>
<h2 id="install-laminas-paginator">Install laminas-paginator</h2>
<p>laminas-paginator is not installed or configured by default, so we will need to do
that. Run the following from the application root:</p>
<pre class="highlight"><code class="language-bash">$ composer require laminas/laminas-paginator</code></pre>
that. </p>
<p>laminas-paginator uses data source adapters to access data collections. In order to
access data into our database, we will need an adapter that uses laminas-db which is
provided by an additional component: laminas-paginator-adapter-laminasdb.</p>
<p>Run the following from the application root:</p>
<pre class="highlight"><code class="language-bash">$ composer require laminas/laminas-paginator laminas-paginator-adapter-laminasdb</code></pre>
<p>Assuming you followed the <a href="../getting-started/overview/">Getting Started tutorial</a>,
you will be prompted by the <a href="https://docs.laminas.dev/laminas-component-installer">laminas-component-installer</a>
plugin to inject <code>Laminas\Paginator</code>; be sure to select the option for either
<code>config/application.config.php</code> or <code>config/modules.config.php</code>; since it is the
only package you are installing, you can answer either "y" or "n" to the "Remember this
option for other packages of the same type" prompt.</p>
plugin to inject <code>Laminas\Paginator</code> and <code>Laminas\Paginator\Adapter\LaminasDb</code>; be sure to select the option for either
<code>config/application.config.php</code> or <code>config/modules.config.php</code>; since you are installing more than one
package, you can answer "y" to the "Remember this
option for other packages of the same type" prompt such that the same option is applied to both components.</p>
<blockquote>
<h3 id="manual-configuration">Manual configuration</h3>
<p>If you are not using laminas-component-installer, you will need to setup
configuration manually. You can do this in one of two ways:</p>
<ul>
<li>Register the <code>Laminas\Paginator</code> module in either
<li>Register the <code>Laminas\Paginator</code> and <code>Laminas\Paginator\Adapter\LaminasDb</code> modules in either
<code>config/application.config.php</code> or <code>config/modules.config.php</code>. Make sure
you put it towards the top of the module list, before any modules you have
defined or third party modules you are using.</li>
Expand All @@ -727,16 +731,18 @@ <h3 id="manual-configuration">Manual configuration</h3>
<pre class="highlight"><code class="language-php">&lt;?php

use Laminas\Paginator\ConfigProvider;
use Laminas\Paginator\Adapter\LaminasDb\ConfigProvider as LaminasDbAdapterConfigProvider;

return [
'service_manager' =&gt; (new ConfigProvider())-&gt;getDependencyConfig(),
'paginators' =&gt; (new LaminasDbAdapterConfigProvider())-&gt;getPaginatorConfig(),
];</code></pre>
</blockquote>
<p>Once installed, our application is now aware of laminas-paginator, and even has
<p>Once installed, our application is now aware of <code>laminas-paginator</code> and its data source adapters, and even has
some default factories in place, which we will now make use of.</p>
<h2 id="modifying-the-albumtable">Modifying the AlbumTable</h2>
<p>In order to let laminas-paginator handle our database queries automatically for us,
we will be using the <a href="https://docs.laminas.dev/laminas-paginator/usage/#the-dbselect-adapter">DbSelect pagination adapter</a>
we will be using the <a href="https://docs.laminas.dev/laminas-paginator-adapter-laminasdb/">DbSelect pagination adapter</a>
This will automatically manipulate and run a <code>Laminas\Db\Sql\Select</code> object to
include the correct <code>LIMIT</code> and <code>WHERE</code> clauses so that it returns only the
configured amount of data for the given page. Let's modify the <code>fetchAll</code> method
Expand All @@ -747,8 +753,9 @@ <h2 id="modifying-the-albumtable">Modifying the AlbumTable</h2>
use Laminas\Db\ResultSet\ResultSet;
use Laminas\Db\Sql\Select;
use Laminas\Db\TableGateway\TableGatewayInterface;
use Laminas\Paginator\Adapter\DbSelect;
use Laminas\Paginator\Adapter\LaminasDb\DbSelect;
use Laminas\Paginator\Paginator;
use RuntimeException;

class AlbumTable
{
Expand Down Expand Up @@ -787,7 +794,7 @@ <h2 id="modifying-the-albumtable">Modifying the AlbumTable</h2>

/* ... */
}</code></pre>
<p>This will return a fully configured <code>Paginator</code> instance. We've already told the
<p>This will return a fully configured <code>Paginator</code> instance using a <code>DbSelect</code> adapter. We've already told the
<code>DbSelect</code> adapter to use our created <code>Select</code> object, to use the adapter that
the <code>TableGateway</code> object uses, and also how to hydrate the result into a
<code>Album</code> entity in the same fashion as the <code>TableGateway</code> does. This means that
Expand Down
2 changes: 1 addition & 1 deletion search/search_index.json

Large diffs are not rendered by default.

Binary file modified sitemap.xml.gz
Binary file not shown.
Loading

0 comments on commit b35a5ac

Please sign in to comment.