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:


  • Xylina,Ezar: doctor
  • Constance,Phi: police officer
  • Talya,Rooney: doctor
  • Ethel,Kronfeld: doctor
  • Fredericka,Sherfield: doctor
  • Emelina,Kress: police officer
  • Shel,Papageno: firefighter
  • Karolina,Bronk: worker
  • Aurore,Tatianas: worker
  • Merci,Quinn: firefighter
  • Brena,Corrine: worker
  • Grier,Rosette: firefighter
  • Augustine,Lanita: firefighter
  • Wanda,Barney: developer
  • Bee,Drisko: worker
  • Nita,Ivens: developer
  • Susette,Teryn: police officer
  • Netty,Seessel: police officer
  • Libbie,Solitta: doctor
  • Latisha,Goode: 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)#1727 (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)
  }
  [101]=>
  array(6) {
    ["id"]=>
    string(3) "101"
    ["firstname"]=>
    string(9) "Constance"
    ["lastname"]=>
    string(3) "Phi"
    ["email"]=>
    string(23) "Constance.Phi@gmail.com"
    ["profession"]=>
    string(14) "police officer"
    ["ordering"]=>
    int(2)
  }
  [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(3)
  }
  [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(4)
  }
  [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(5)
  }
  [105]=>
  array(6) {
    ["id"]=>
    string(3) "105"
    ["firstname"]=>
    string(7) "Emelina"
    ["lastname"]=>
    string(5) "Kress"
    ["email"]=>
    string(23) "Emelina.Kress@gmail.com"
    ["profession"]=>
    string(14) "police officer"
    ["ordering"]=>
    int(6)
  }
  [106]=>
  array(6) {
    ["id"]=>
    string(3) "106"
    ["firstname"]=>
    string(4) "Shel"
    ["lastname"]=>
    string(8) "Papageno"
    ["email"]=>
    string(23) "Shel.Papageno@gmail.com"
    ["profession"]=>
    string(11) "firefighter"
    ["ordering"]=>
    int(7)
  }
  [107]=>
  array(6) {
    ["id"]=>
    string(3) "107"
    ["firstname"]=>
    string(8) "Karolina"
    ["lastname"]=>
    string(5) "Bronk"
    ["email"]=>
    string(24) "Karolina.Bronk@gmail.com"
    ["profession"]=>
    string(6) "worker"
    ["ordering"]=>
    int(8)
  }
  [108]=>
  array(6) {
    ["id"]=>
    string(3) "108"
    ["firstname"]=>
    string(6) "Aurore"
    ["lastname"]=>
    string(8) "Tatianas"
    ["email"]=>
    string(25) "Aurore.Tatianas@gmail.com"
    ["profession"]=>
    string(6) "worker"
    ["ordering"]=>
    int(9)
  }
  [109]=>
  array(6) {
    ["id"]=>
    string(3) "109"
    ["firstname"]=>
    string(5) "Merci"
    ["lastname"]=>
    string(5) "Quinn"
    ["email"]=>
    string(21) "Merci.Quinn@gmail.com"
    ["profession"]=>
    string(11) "firefighter"
    ["ordering"]=>
    int(10)
  }
  [110]=>
  array(6) {
    ["id"]=>
    string(3) "110"
    ["firstname"]=>
    string(5) "Brena"
    ["lastname"]=>
    string(7) "Corrine"
    ["email"]=>
    string(23) "Brena.Corrine@gmail.com"
    ["profession"]=>
    string(6) "worker"
    ["ordering"]=>
    int(11)
  }
  [111]=>
  array(6) {
    ["id"]=>
    string(3) "111"
    ["firstname"]=>
    string(5) "Grier"
    ["lastname"]=>
    string(7) "Rosette"
    ["email"]=>
    string(23) "Grier.Rosette@gmail.com"
    ["profession"]=>
    string(11) "firefighter"
    ["ordering"]=>
    int(12)
  }
  [112]=>
  array(6) {
    ["id"]=>
    string(3) "112"
    ["firstname"]=>
    string(9) "Augustine"
    ["lastname"]=>
    string(6) "Lanita"
    ["email"]=>
    string(26) "Augustine.Lanita@gmail.com"
    ["profession"]=>
    string(11) "firefighter"
    ["ordering"]=>
    int(13)
  }
  [113]=>
  array(6) {
    ["id"]=>
    string(3) "113"
    ["firstname"]=>
    string(5) "Wanda"
    ["lastname"]=>
    string(6) "Barney"
    ["email"]=>
    string(22) "Wanda.Barney@gmail.com"
    ["profession"]=>
    string(9) "developer"
    ["ordering"]=>
    int(14)
  }
  [114]=>
  array(6) {
    ["id"]=>
    string(3) "114"
    ["firstname"]=>
    string(3) "Bee"
    ["lastname"]=>
    string(6) "Drisko"
    ["email"]=>
    string(20) "Bee.Drisko@gmail.com"
    ["profession"]=>
    string(6) "worker"
    ["ordering"]=>
    int(15)
  }
  [115]=>
  array(6) {
    ["id"]=>
    string(3) "115"
    ["firstname"]=>
    string(4) "Nita"
    ["lastname"]=>
    string(5) "Ivens"
    ["email"]=>
    string(20) "Nita.Ivens@gmail.com"
    ["profession"]=>
    string(9) "developer"
    ["ordering"]=>
    int(16)
  }
  [116]=>
  array(6) {
    ["id"]=>
    string(3) "116"
    ["firstname"]=>
    string(7) "Susette"
    ["lastname"]=>
    string(5) "Teryn"
    ["email"]=>
    string(23) "Susette.Teryn@gmail.com"
    ["profession"]=>
    string(14) "police officer"
    ["ordering"]=>
    int(17)
  }
  [117]=>
  array(6) {
    ["id"]=>
    string(3) "117"
    ["firstname"]=>
    string(5) "Netty"
    ["lastname"]=>
    string(7) "Seessel"
    ["email"]=>
    string(23) "Netty.Seessel@gmail.com"
    ["profession"]=>
    string(14) "police officer"
    ["ordering"]=>
    int(18)
  }
  [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(19)
  }
  [119]=>
  array(6) {
    ["id"]=>
    string(3) "119"
    ["firstname"]=>
    string(7) "Latisha"
    ["lastname"]=>
    string(5) "Goode"
    ["email"]=>
    string(23) "Latisha.Goode@gmail.com"
    ["profession"]=>
    string(14) "police officer"
    ["ordering"]=>
    int(20)
  }
}