diff options
author | Nat Lasseter <Nat Lasseter nathan@bytemark.co.uk> | 2018-02-02 16:52:48 +0000 |
---|---|---|
committer | Nat Lasseter <Nat Lasseter nathan@bytemark.co.uk> | 2018-02-02 16:52:48 +0000 |
commit | b1e4faeb9eb3398fc8dee795b2203ae0c141bdfb (patch) | |
tree | 85999976090c5246a7acb45f8beb228b0faacdb9 | |
parent | 88fcd07560c4c19a7621e43ee00862a028423839 (diff) |
Add an option to show all of the routers (<1)
-rw-r--r-- | docs/configuration.md | 7 | ||||
-rw-r--r-- | index.php | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/docs/configuration.md b/docs/configuration.md index 8ef9df5..b29fb2c 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -70,6 +70,13 @@ $config['frontpage']['order'] = array('routers', 'commands', 'parameter', 'butto ``` Sets the order of the sections that are displayed. +```php +$config['frontpage']['router_count'] = 5; +``` +Sets the number of routers to show on the front page before the list scrolls. If +set to a positive integer, then that number of routers will be shown, otherwise +the list will show all routers. + ### Contact ```php @@ -40,10 +40,17 @@ final class LookingGlass { $this->doc = $config['doc']; } + private function router_count() { + if ($this->frontpage['router_count'] > 0) + return $this->frontpage['router_count']; + else + return count($this->routers); + } + private function render_routers() { print('<div class="form-group">'); print('<label for="routers">Router to use</label>'); - print('<select size="'.$this->frontpage['router_count'].'" class="form-control" name="routers" id="routers">'); + print('<select size="'.router_count().'" class="form-control" name="routers" id="routers">'); $first = true; foreach (array_keys($this->routers) as $router) { |