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
- Johan,Janssens: jedi
---
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)#1731 (1) {
[200]=>
array(6) {
["id"]=>
string(3) "200"
["firstname"]=>
string(5) "Johan"
["lastname"]=>
string(8) "Janssens"
["email"]=>
string(17) "johan@janssens.me"
["profession"]=>
string(4) "jedi"
["ordering"]=>
int(1)
}
}