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:


  • Sue,Elsinore: doctor
  • Brena,Azeria: developer
  • Ana,Mintz: doctor
  • Anthia,Margarete: firefighter
  • Kary,Magdalen: developer
  • Gusella,Skell: developer
  • Ardenia,Lalitta: worker
  • Fanchon,Taam: doctor
  • Laure,Agle: doctor
  • Claudina,Ammann: firefighter
  • Selia,Tatianas: firefighter
  • Karena,Shelba: doctor
  • Lita,Honoria: worker
  • Tamqrah,Alejoa: worker
  • Lorne,Kaja: firefighter
  • Ida,Old: police officer
  • Bertine,Justinn: police officer
  • Annabela,Alfons: worker
  • Fred,Hull: developer
  • Jaclyn,Eachern: police officer

    ---
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) {
  [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(1)
  }
  [141]=>
  array(6) {
    ["id"]=>
    string(3) "141"
    ["firstname"]=>
    string(5) "Brena"
    ["lastname"]=>
    string(6) "Azeria"
    ["email"]=>
    string(22) "Brena.Azeria@gmail.com"
    ["profession"]=>
    string(9) "developer"
    ["ordering"]=>
    int(2)
  }
  [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(3)
  }
  [143]=>
  array(6) {
    ["id"]=>
    string(3) "143"
    ["firstname"]=>
    string(6) "Anthia"
    ["lastname"]=>
    string(9) "Margarete"
    ["email"]=>
    string(26) "Anthia.Margarete@gmail.com"
    ["profession"]=>
    string(11) "firefighter"
    ["ordering"]=>
    int(4)
  }
  [144]=>
  array(6) {
    ["id"]=>
    string(3) "144"
    ["firstname"]=>
    string(4) "Kary"
    ["lastname"]=>
    string(8) "Magdalen"
    ["email"]=>
    string(23) "Kary.Magdalen@gmail.com"
    ["profession"]=>
    string(9) "developer"
    ["ordering"]=>
    int(5)
  }
  [145]=>
  array(6) {
    ["id"]=>
    string(3) "145"
    ["firstname"]=>
    string(7) "Gusella"
    ["lastname"]=>
    string(5) "Skell"
    ["email"]=>
    string(23) "Gusella.Skell@gmail.com"
    ["profession"]=>
    string(9) "developer"
    ["ordering"]=>
    int(6)
  }
  [146]=>
  array(6) {
    ["id"]=>
    string(3) "146"
    ["firstname"]=>
    string(7) "Ardenia"
    ["lastname"]=>
    string(7) "Lalitta"
    ["email"]=>
    string(25) "Ardenia.Lalitta@gmail.com"
    ["profession"]=>
    string(6) "worker"
    ["ordering"]=>
    int(7)
  }
  [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(8)
  }
  [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(9)
  }
  [149]=>
  array(6) {
    ["id"]=>
    string(3) "149"
    ["firstname"]=>
    string(8) "Claudina"
    ["lastname"]=>
    string(6) "Ammann"
    ["email"]=>
    string(25) "Claudina.Ammann@gmail.com"
    ["profession"]=>
    string(11) "firefighter"
    ["ordering"]=>
    int(10)
  }
  [150]=>
  array(6) {
    ["id"]=>
    string(3) "150"
    ["firstname"]=>
    string(5) "Selia"
    ["lastname"]=>
    string(8) "Tatianas"
    ["email"]=>
    string(24) "Selia.Tatianas@gmail.com"
    ["profession"]=>
    string(11) "firefighter"
    ["ordering"]=>
    int(11)
  }
  [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(12)
  }
  [152]=>
  array(6) {
    ["id"]=>
    string(3) "152"
    ["firstname"]=>
    string(4) "Lita"
    ["lastname"]=>
    string(7) "Honoria"
    ["email"]=>
    string(22) "Lita.Honoria@gmail.com"
    ["profession"]=>
    string(6) "worker"
    ["ordering"]=>
    int(13)
  }
  [153]=>
  array(6) {
    ["id"]=>
    string(3) "153"
    ["firstname"]=>
    string(7) "Tamqrah"
    ["lastname"]=>
    string(6) "Alejoa"
    ["email"]=>
    string(24) "Tamqrah.Alejoa@gmail.com"
    ["profession"]=>
    string(6) "worker"
    ["ordering"]=>
    int(14)
  }
  [154]=>
  array(6) {
    ["id"]=>
    string(3) "154"
    ["firstname"]=>
    string(5) "Lorne"
    ["lastname"]=>
    string(4) "Kaja"
    ["email"]=>
    string(20) "Lorne.Kaja@gmail.com"
    ["profession"]=>
    string(11) "firefighter"
    ["ordering"]=>
    int(15)
  }
  [155]=>
  array(6) {
    ["id"]=>
    string(3) "155"
    ["firstname"]=>
    string(3) "Ida"
    ["lastname"]=>
    string(3) "Old"
    ["email"]=>
    string(17) "Ida.Old@gmail.com"
    ["profession"]=>
    string(14) "police officer"
    ["ordering"]=>
    int(16)
  }
  [156]=>
  array(6) {
    ["id"]=>
    string(3) "156"
    ["firstname"]=>
    string(7) "Bertine"
    ["lastname"]=>
    string(7) "Justinn"
    ["email"]=>
    string(25) "Bertine.Justinn@gmail.com"
    ["profession"]=>
    string(14) "police officer"
    ["ordering"]=>
    int(17)
  }
  [157]=>
  array(6) {
    ["id"]=>
    string(3) "157"
    ["firstname"]=>
    string(8) "Annabela"
    ["lastname"]=>
    string(6) "Alfons"
    ["email"]=>
    string(25) "Annabela.Alfons@gmail.com"
    ["profession"]=>
    string(6) "worker"
    ["ordering"]=>
    int(18)
  }
  [158]=>
  array(6) {
    ["id"]=>
    string(3) "158"
    ["firstname"]=>
    string(4) "Fred"
    ["lastname"]=>
    string(4) "Hull"
    ["email"]=>
    string(19) "Fred.Hull@gmail.com"
    ["profession"]=>
    string(9) "developer"
    ["ordering"]=>
    int(19)
  }
  [159]=>
  array(6) {
    ["id"]=>
    string(3) "159"
    ["firstname"]=>
    string(6) "Jaclyn"
    ["lastname"]=>
    string(7) "Eachern"
    ["email"]=>
    string(24) "Jaclyn.Eachern@gmail.com"
    ["profession"]=>
    string(14) "police officer"
    ["ordering"]=>
    int(20)
  }
}