Run prettier on all *.md files
``` prettier '{app,source}/**/**.md' --write ```
This commit is contained in:
parent
a3ceeaf0f3
commit
85a10c545b
170 changed files with 5127 additions and 2282 deletions
|
@ -5,7 +5,14 @@ excerpt: The missing code to get totals of galleries and photos.
|
|||
tags:
|
||||
- drupal
|
||||
---
|
||||
Today, I realised that I hadn't published the code that I used to create the total figures of galleries and photos at the top of the gallery (I said at the end of [Part 2](/blog/create-better-photo-gallery-drupal-part-2/ "Create a Better Photo Gallery in Drupal - Part 2") that I'd include it in [Part 3](/blog/create-better-photo-gallery-drupal-part-3/ "Create a Better Photo Gallery in Drupal - Part 3"), but I forgot). So, here it is:
|
||||
|
||||
Today, I realised that I hadn't published the code that I used to create the
|
||||
total figures of galleries and photos at the top of the gallery (I said at the
|
||||
end of
|
||||
[Part 2](/blog/create-better-photo-gallery-drupal-part-2/ 'Create a Better Photo Gallery in Drupal - Part 2')
|
||||
that I'd include it in
|
||||
[Part 3](/blog/create-better-photo-gallery-drupal-part-3/ 'Create a Better Photo Gallery in Drupal - Part 3'),
|
||||
but I forgot). So, here it is:
|
||||
|
||||
```language-php
|
||||
<?php
|
||||
|
@ -19,12 +26,12 @@ while($gallery = db_fetch_array($galleries)) {
|
|||
$gallery_id = $gallery['nid'];
|
||||
$photos = $photos + db_result(db_query("SELECT COUNT(*) FROM node n, content_type_photo ctp WHERE n.status = 1 AND n.type = 'photo' AND ctp.field_gallery_nid = $gallery_id AND n.nid = ctp.nid"));
|
||||
}
|
||||
|
||||
|
||||
// Prints the output.
|
||||
print 'There ';
|
||||
if($photos == 1) {
|
||||
print 'is';
|
||||
}
|
||||
}
|
||||
else {
|
||||
print 'are';
|
||||
}
|
||||
|
@ -32,20 +39,20 @@ print ' currently ';
|
|||
print $photos . ' ';
|
||||
if($photos == 1) {
|
||||
print 'photo';
|
||||
}
|
||||
}
|
||||
else {
|
||||
print 'photos';
|
||||
}
|
||||
}
|
||||
print ' in ';
|
||||
|
||||
|
||||
// Counts the number of published galleries on the site.
|
||||
$galleries = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE TYPE = 'gallery' AND STATUS = 1"));
|
||||
|
||||
|
||||
// Prints the number of published galleries.
|
||||
print $galleries;
|
||||
if ($galleries == 1) {
|
||||
print ' gallery';
|
||||
}
|
||||
}
|
||||
else {
|
||||
print ' galleries';
|
||||
}
|
||||
|
@ -53,4 +60,5 @@ print '.';
|
|||
?>
|
||||
```
|
||||
|
||||
It was applied to the view as a header which had the input format set to PHP code.
|
||||
It was applied to the view as a header which had the input format set to PHP
|
||||
code.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue