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
- Lorne,Couture: developer
- Ezmeralda,Hepsibah: doctor
- Candy,Pauly: police officer
- Coral,Jaylene: worker
- Phylis,Beebe: worker
- Ellette,Erskine: worker
- Annora,Redmond: police officer
- Robbi,Viddah: worker
- Arlena,Goerke: firefighter
- Cacilie,Kannry: developer
- Pierette,Isacco: doctor
- Janenna,Tatianas: doctor
- Merci,Gombach: police officer
- Philis,Ethban: doctor
- Alexine,Craggie: doctor
- Madelle,Keily: police officer
- Renae,Ingra: developer
- Eadie,Byrne: police officer
- Nerta,Moseley: police officer
- Merci,Katrine: developer
---
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)#1736 (20) {
[120]=>
array(6) {
["id"]=>
string(3) "120"
["firstname"]=>
string(5) "Lorne"
["lastname"]=>
string(7) "Couture"
["email"]=>
string(23) "Lorne.Couture@gmail.com"
["profession"]=>
string(9) "developer"
["ordering"]=>
int(1)
}
[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(2)
}
[122]=>
array(6) {
["id"]=>
string(3) "122"
["firstname"]=>
string(5) "Candy"
["lastname"]=>
string(5) "Pauly"
["email"]=>
string(21) "Candy.Pauly@gmail.com"
["profession"]=>
string(14) "police officer"
["ordering"]=>
int(3)
}
[123]=>
array(6) {
["id"]=>
string(3) "123"
["firstname"]=>
string(5) "Coral"
["lastname"]=>
string(7) "Jaylene"
["email"]=>
string(23) "Coral.Jaylene@gmail.com"
["profession"]=>
string(6) "worker"
["ordering"]=>
int(4)
}
[124]=>
array(6) {
["id"]=>
string(3) "124"
["firstname"]=>
string(6) "Phylis"
["lastname"]=>
string(5) "Beebe"
["email"]=>
string(22) "Phylis.Beebe@gmail.com"
["profession"]=>
string(6) "worker"
["ordering"]=>
int(5)
}
[125]=>
array(6) {
["id"]=>
string(3) "125"
["firstname"]=>
string(7) "Ellette"
["lastname"]=>
string(7) "Erskine"
["email"]=>
string(25) "Ellette.Erskine@gmail.com"
["profession"]=>
string(6) "worker"
["ordering"]=>
int(6)
}
[126]=>
array(6) {
["id"]=>
string(3) "126"
["firstname"]=>
string(6) "Annora"
["lastname"]=>
string(7) "Redmond"
["email"]=>
string(24) "Annora.Redmond@gmail.com"
["profession"]=>
string(14) "police officer"
["ordering"]=>
int(7)
}
[127]=>
array(6) {
["id"]=>
string(3) "127"
["firstname"]=>
string(5) "Robbi"
["lastname"]=>
string(6) "Viddah"
["email"]=>
string(22) "Robbi.Viddah@gmail.com"
["profession"]=>
string(6) "worker"
["ordering"]=>
int(8)
}
[128]=>
array(6) {
["id"]=>
string(3) "128"
["firstname"]=>
string(6) "Arlena"
["lastname"]=>
string(6) "Goerke"
["email"]=>
string(23) "Arlena.Goerke@gmail.com"
["profession"]=>
string(11) "firefighter"
["ordering"]=>
int(9)
}
[129]=>
array(6) {
["id"]=>
string(3) "129"
["firstname"]=>
string(7) "Cacilie"
["lastname"]=>
string(6) "Kannry"
["email"]=>
string(24) "Cacilie.Kannry@gmail.com"
["profession"]=>
string(9) "developer"
["ordering"]=>
int(10)
}
[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(11)
}
[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(12)
}
[132]=>
array(6) {
["id"]=>
string(3) "132"
["firstname"]=>
string(5) "Merci"
["lastname"]=>
string(7) "Gombach"
["email"]=>
string(23) "Merci.Gombach@gmail.com"
["profession"]=>
string(14) "police officer"
["ordering"]=>
int(13)
}
[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(14)
}
[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(15)
}
[135]=>
array(6) {
["id"]=>
string(3) "135"
["firstname"]=>
string(7) "Madelle"
["lastname"]=>
string(5) "Keily"
["email"]=>
string(23) "Madelle.Keily@gmail.com"
["profession"]=>
string(14) "police officer"
["ordering"]=>
int(16)
}
[136]=>
array(6) {
["id"]=>
string(3) "136"
["firstname"]=>
string(5) "Renae"
["lastname"]=>
string(5) "Ingra"
["email"]=>
string(21) "Renae.Ingra@gmail.com"
["profession"]=>
string(9) "developer"
["ordering"]=>
int(17)
}
[137]=>
array(6) {
["id"]=>
string(3) "137"
["firstname"]=>
string(5) "Eadie"
["lastname"]=>
string(5) "Byrne"
["email"]=>
string(21) "Eadie.Byrne@gmail.com"
["profession"]=>
string(14) "police officer"
["ordering"]=>
int(18)
}
[138]=>
array(6) {
["id"]=>
string(3) "138"
["firstname"]=>
string(5) "Nerta"
["lastname"]=>
string(7) "Moseley"
["email"]=>
string(23) "Nerta.Moseley@gmail.com"
["profession"]=>
string(14) "police officer"
["ordering"]=>
int(19)
}
[139]=>
array(6) {
["id"]=>
string(3) "139"
["firstname"]=>
string(5) "Merci"
["lastname"]=>
string(7) "Katrine"
["email"]=>
string(23) "Merci.Katrine@gmail.com"
["profession"]=>
string(9) "developer"
["ordering"]=>
int(20)
}
}