Building Your PHP Rest Service (step 3)
In the article for step 2, we continued building building our Representational State Transfer (REST) service by looking at files located in the objects directory. Next, we will look at the shared directory. Our final project, located at https://winehopper.app does not use this directory. Shared will contain a file such as utilities.php which contains a getPaging function which is shared among all WordPress PHP theme pages. That function is shown below. <?php class Utilities{ public function getPaging($page, $total_rows, $records_per_page, $page_url){ // paging array $paging_arr=array(); // button for first page $paging_arr["first"] = $page>1 ? "{$page_url}page=1" : ""; // count all products in the database to calculate total pages $total_pages = ceil($total_rows / $records_per_page); // range of links to show $range = 2; // display links to 'range of pages' around 'current…






