Fetches a table from Google Sheet
Data coming from https://docs.google.com/spreadsheets/d/e/2PACX-1vTEbblQfWW2ZjGlt1bXO59yixftz9Ok1dnDuCMIOYyk-Gow4mkxolXOsj_iECGDKHq9j1xNHQcdC8lw/pub
Filtering works particularly well with webservices (or single database database tables). Examples:
- https://pages.joomlacustomfields.org/gsheet2?filter[profession]=jedi
- https://pages.joomlacustomfields.org/gsheet2?filter[profession]=doctor
- https://pages.joomlacustomfields.org/gsheet2?filter[profession]=police%20officer
- Xylina,Ezar: doctor
- Talya,Rooney: doctor
- Ethel,Kronfeld: doctor
- Fredericka,Sherfield: doctor
- Libbie,Solitta: doctor
- Ezmeralda,Hepsibah: doctor
- Pierette,Isacco: doctor
- Janenna,Tatianas: doctor
- Philis,Ethban: doctor
- Alexine,Craggie: doctor
- Sue,Elsinore: doctor
- Ana,Mintz: doctor
- Fanchon,Taam: doctor
- Laure,Agle: doctor
- Karena,Shelba: doctor
- Rivalee,Aprile: doctor
- Hannis,Kare: doctor
- Mallory,Therine: doctor
- Beatriz,Dorine: doctor
- Alisha,Millda: doctor
---
title: Google Sheet
@collection:
model: webservice
config:
url: https://docs.google.com/spreadsheets/d/e/2PACX-1vTEbblQfWW2ZjGlt1bXO59yixftz9Ok1dnDuCMIOYyk-Gow4mkxolXOsj_iECGDKHq9j1xNHQcdC8lw/pub?output=csv
state:
limit: 20
@process:
filters: highlight
---
<style>
/* adding some quick styling for the automatic Pagination made by Pages */
ul.k-pagination__pages {
display: flex;
justify-content: space-between;
list-style-type: none;
}
/* just removing the icon-next icon coming along with Protostar */
ul.k-pagination__pages li.icon-next:before { content:unset;}
</style>
<h2>Fetches a table from Google Sheet</h2>
<p>Data coming from <a target="_blank" href="https://docs.google.com/spreadsheets/d/e/2PACX-1vTEbblQfWW2ZjGlt1bXO59yixftz9Ok1dnDuCMIOYyk-Gow4mkxolXOsj_iECGDKHq9j1xNHQcdC8lw/pub">https://docs.google.com/spreadsheets/d/e/2PACX-1vTEbblQfWW2ZjGlt1bXO59yixftz9Ok1dnDuCMIOYyk-Gow4mkxolXOsj_iECGDKHq9j1xNHQcdC8lw/pub</a></p>
<p>Filtering works particularly well with webservices (or single database database tables). Examples:</p>
<ul>
<li><a href="https://pages.joomlacustomfields.org/gsheet2?filter[profession]=jedi">https://pages.joomlacustomfields.org/gsheet2?filter[profession]=jedi</a></li>
<li><a href="https://pages.joomlacustomfields.org/gsheet2?filter[profession]=doctor">https://pages.joomlacustomfields.org/gsheet2?filter[profession]=doctor</a></li>
<li><a href="https://pages.joomlacustomfields.org/gsheet2?filter[profession]=police%20officer">https://pages.joomlacustomfields.org/gsheet2?filter[profession]=police%20officer</a></li>
</ul>
<hr>
<div class="well">
<ul>
<? foreach(collection() as $person) : ?>
<li>
<?= $person->firstname ?>,<?= $person->lastname ?>: <?= $person->profession ?>
</li>
<? endforeach; ?>
</ul>
<?= helper('paginator.pagination') ?>
</div>
<hr>
<?= source('/gsheet2') ?>
<hr>
<h3>See hereafter the var_dump(collection())</h3>
<pre><code><?= var_dump(collection()); ?></code></pre>
See hereafter the var_dump(collection())
object(ComPagesModelEntityItems)#1743 (20) {
[100]=>
array(6) {
["id"]=>
string(3) "100"
["firstname"]=>
string(6) "Xylina"
["lastname"]=>
string(4) "Ezar"
["email"]=>
string(21) "Xylina.Ezar@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(1)
}
[102]=>
array(6) {
["id"]=>
string(3) "102"
["firstname"]=>
string(5) "Talya"
["lastname"]=>
string(6) "Rooney"
["email"]=>
string(22) "Talya.Rooney@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(2)
}
[103]=>
array(6) {
["id"]=>
string(3) "103"
["firstname"]=>
string(5) "Ethel"
["lastname"]=>
string(8) "Kronfeld"
["email"]=>
string(24) "Ethel.Kronfeld@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(3)
}
[104]=>
array(6) {
["id"]=>
string(3) "104"
["firstname"]=>
string(10) "Fredericka"
["lastname"]=>
string(9) "Sherfield"
["email"]=>
string(30) "Fredericka.Sherfield@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(4)
}
[118]=>
array(6) {
["id"]=>
string(3) "118"
["firstname"]=>
string(6) "Libbie"
["lastname"]=>
string(7) "Solitta"
["email"]=>
string(24) "Libbie.Solitta@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(5)
}
[121]=>
array(6) {
["id"]=>
string(3) "121"
["firstname"]=>
string(9) "Ezmeralda"
["lastname"]=>
string(8) "Hepsibah"
["email"]=>
string(28) "Ezmeralda.Hepsibah@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(6)
}
[130]=>
array(6) {
["id"]=>
string(3) "130"
["firstname"]=>
string(8) "Pierette"
["lastname"]=>
string(6) "Isacco"
["email"]=>
string(25) "Pierette.Isacco@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(7)
}
[131]=>
array(6) {
["id"]=>
string(3) "131"
["firstname"]=>
string(7) "Janenna"
["lastname"]=>
string(8) "Tatianas"
["email"]=>
string(26) "Janenna.Tatianas@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(8)
}
[133]=>
array(6) {
["id"]=>
string(3) "133"
["firstname"]=>
string(6) "Philis"
["lastname"]=>
string(6) "Ethban"
["email"]=>
string(23) "Philis.Ethban@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(9)
}
[134]=>
array(6) {
["id"]=>
string(3) "134"
["firstname"]=>
string(7) "Alexine"
["lastname"]=>
string(7) "Craggie"
["email"]=>
string(25) "Alexine.Craggie@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(10)
}
[140]=>
array(6) {
["id"]=>
string(3) "140"
["firstname"]=>
string(3) "Sue"
["lastname"]=>
string(8) "Elsinore"
["email"]=>
string(22) "Sue.Elsinore@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(11)
}
[142]=>
array(6) {
["id"]=>
string(3) "142"
["firstname"]=>
string(3) "Ana"
["lastname"]=>
string(5) "Mintz"
["email"]=>
string(19) "Ana.Mintz@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(12)
}
[147]=>
array(6) {
["id"]=>
string(3) "147"
["firstname"]=>
string(7) "Fanchon"
["lastname"]=>
string(4) "Taam"
["email"]=>
string(22) "Fanchon.Taam@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(13)
}
[148]=>
array(6) {
["id"]=>
string(3) "148"
["firstname"]=>
string(5) "Laure"
["lastname"]=>
string(4) "Agle"
["email"]=>
string(20) "Laure.Agle@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(14)
}
[151]=>
array(6) {
["id"]=>
string(3) "151"
["firstname"]=>
string(6) "Karena"
["lastname"]=>
string(6) "Shelba"
["email"]=>
string(23) "Karena.Shelba@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(15)
}
[166]=>
array(6) {
["id"]=>
string(3) "166"
["firstname"]=>
string(7) "Rivalee"
["lastname"]=>
string(6) "Aprile"
["email"]=>
string(24) "Rivalee.Aprile@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(16)
}
[169]=>
array(6) {
["id"]=>
string(3) "169"
["firstname"]=>
string(6) "Hannis"
["lastname"]=>
string(4) "Kare"
["email"]=>
string(21) "Hannis.Kare@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(17)
}
[174]=>
array(6) {
["id"]=>
string(3) "174"
["firstname"]=>
string(7) "Mallory"
["lastname"]=>
string(7) "Therine"
["email"]=>
string(25) "Mallory.Therine@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(18)
}
[177]=>
array(6) {
["id"]=>
string(3) "177"
["firstname"]=>
string(7) "Beatriz"
["lastname"]=>
string(6) "Dorine"
["email"]=>
string(24) "Beatriz.Dorine@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(19)
}
[178]=>
array(6) {
["id"]=>
string(3) "178"
["firstname"]=>
string(6) "Alisha"
["lastname"]=>
string(6) "Millda"
["email"]=>
string(23) "Alisha.Millda@gmail.com"
["profession"]=>
string(6) "doctor"
["ordering"]=>
int(20)
}
}