Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
Update to V2
Browse files Browse the repository at this point in the history
Changes for clearer code and avoiding a potential problem when fetching the first text paragraph from blog posts
  • Loading branch information
raulg committed Jan 24, 2019
1 parent 8acc97b commit b47e1d2
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion app/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Prismic\LinkResolver;
use Prismic\Predicates;


require_once 'includes/http.php';

// Index page
Expand Down
2 changes: 1 addition & 1 deletion app/views/bloghome.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<div class="home">
<div class='blog-avatar' style='background-image: url("<?= $imageUrl ?>");'></div>
<h1 class='blog-title'><?= RichText::asHtml($bloghome->data->headline) ?></h1>
<h1 class='blog-title'><?= $title ?></h1>
<p class='blog-description'><?= RichText::asText($bloghome->data->description) ?></p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</div>

<h1 data-wio-id=<?= $post->id ?>>
<?= RichText::asHtml($post->data->title, $prismic->linkResolver) ?>
<?= $title ?>
</h1>
</div>

Expand Down
4 changes: 2 additions & 2 deletions app/views/slices/firstParagraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

// Get all the slices of the post
$slices = $post->data->body;
$firstParagraph = "";
$firstText = "";

// Loop through each slice to find the first text slice
foreach ($slices as $slice) {
if ($slice->slice_type == "text") {
$firstText = RichText::asHtml($slice->primary->text, $linkResolver);
$firstText = RichText::asText($slice->primary->text);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "PHP Quickstart",
"name": "PHP Blog Example",
"version": "2.0",
"require": {
"php": ">=7.1",
Expand Down

0 comments on commit b47e1d2

Please sign in to comment.