Skip to content
This repository has been archived by the owner on Apr 10, 2018. It is now read-only.

jmleroux/jmlzf-helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jmlzf-helpers

A collection of helpers for Zend Framework 2

Latest Stable Version Build Status Coverage Status

CurrentRoute

This helper gives access to the matched route in the view. Useful for adding query params for example.

Usage
<?php echo $this->currentRoute(); ?>

QueryParams

This helper provides access to the query parameters as an associative array.

Usage
<?php $queryParams = $this->queryParams(); ?>

<?php // do something with $queryParams ?>

Sortable

This helper add or replace query parameters for sorting purpose.

Usage
<table>
  <thead>
    <th>
      <a href="<?php echo $this->sortable('id'); ?>">ID</a>
    </th>
    <th>
      <a href="<?php echo $this->sortable('label'); ?>">Label</a>
    </th>
  </thead>
  <tbody>
  // table cells
  </tbody>
</table>

<?php // here goes the pagination control (with a paginate helper to come) ?>

Ouput :

<table>
  <thead>
    <th>
      <a href="http://example.com/?sort=id&direction=asc">ID</a>
    </th>
    <th>
      <a href="http://example.com/?sort=label&direction=asc">Label</a>
    </th>
  </thead>
  <tbody>
  // table cells
  </tbody>
</table>

If you click on the ID column, the next output will be

<table>
  <thead>
    <th>
      <a href="http://example.com/?sort=id&direction=desc">ID</a>
    </th>
    <th>
      <a href="http://example.com/?sort=label&direction=asc">Label</a>
    </th>
  </thead>
  <tbody>
  // table cells
  </tbody>
</table>

Maybe i'll wrap this one in another helper to be able to generate a class for the th element.

About

[DISCONTINUED] A collection of helpers for Zend Framework 2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages