PyroCMS: autoload.php not finding customized helpers

I know this question has probably been asked a hundred times, but I'm trying to call a helper I made up from autoload.php. I stored the helper file in shared_addons/helper. I called it new_helpers. The helpers file is:

<?php defined('BASEPATH') OR exit('No direct script access allowed.');

public function get_date($timestamp, $format) {
  list($date,$time) = explode("|", date("m/d/y|g:i A", $timestamp));
  $date = date($format, $date);
  return $date;
}
public function get_time($timestamp, $format) {
  list($date,$time) = explode("|", date("m/d/y|g:i A", $timestamp));
  $time = date($format, $time);
  return $time;
}

and in system/cms/config/autoload.php, I put:

$autoload['helper'] = array('new_helper');

However, I am still getting the error:

An Error Was Encountered [ 500 ]

Unable to load the requested file: helpers/new_helper.php

What am I doing wrong?

Answers


The helper file name should follow the template NAME_helper.php If you want to name your helper "pdf", for example, the file name would be pdf_helper.php.

You would then use the name WITHOUT the _helper suffix for loading/autoload. So $autoload['helper'] = 'pdf'.


Need Your Help

Amazon S3 Bucket and Folder Policy for IAM access?

amazon-s3 policy amazon-iam

Do you have a problem understanding S3 IAM Policies and Directives ? Can't quite wrap your head around their documentation ? I did.

System.OutOfMemoryException on Shared Hosting

.net asp.net-mvc-3 shared-hosting

I have a shared hosting site and on it I have 3 websites hosted. 2 domains and one sub domain.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.