Jump to content

autoload "isn't"


Gazley
 Share

Recommended Posts

HI there,

I've just created a new module with autoload set true, in a new install of ProcessWire in a new version of Mamp using PHP 5.5.10.

The problem I'm having is that when I reference wire('ModuleName'), I'm getting nothing back (it's null). If I say $modules->get('ModuleName'), I get a reference to the module.

I get the same problem using the 'Helloworld' module supplied with ProcessWire.

Any ideas what the issue might be? Is anyone using PHP 5.5.10 - maybe this is a problem?

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

wire('ModuleName') is not a syntax that ProcessWire uses. You can just retrieve API variables from wire(), like pages, page, user, session, etc. To retrieve a module, you would use $modules->get('ModuleName'); 

It's true that some autoload modules might set their own API variables that can be accessed with wire(), but most don't. One example of an autoload module that does that is LanguageSupport.module, which sets a 'languages' API variable that can be accessed via wire('languages'). 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...