php - Concrete5 package helper - How to fix Fatal error: Call to undefined method NavigationHelper::getURLSegment() error? -
sorry, we've looked @ million answers either don't understand them or don't apply.
navigation helper:
we have concrete5 package , have created helper file at: /packages/package-name/helpers/navigation.php
it contains following:
<?php defined('c5_execute') or die('access denied') ?> <?php class navigationhelper { // url segments public function geturlsegments() { return explode("/", parse_url($_server['request_uri'], php_url_path)); } // specific url segment public function geturlsegment($n) { $segs = $this->geturlsegments(); return count($segs) > 0 && count($segs) >= ($n-1)?$segs[$n]:''; } }
loading helper
then have element file load package helper this:
$navhelper = loader::helper('navigation','package-name');
calling method
but when try call method this:
if ($navhelper->geturlsegment(1) == 'whats-on') { echo "what's on"; }
we see:
fatal error: call undefined method navigationhelper::geturlsegment()
we've been starring @ method , package names hour missing basic - missing?
any appreciated.
cheers
ben
for else having problem, custom tool files can't have same file name c5 tools.
navigation.php
being used c5 changing file name of custom file made work.
Comments
Post a Comment