jsantari Posted August 5, 2013 Posted August 5, 2013 I've got some front end code that I want to load a RSS feed using the MarkupLoadRSS module. I can get it to work from my template but I want to use it to load dynamically from a function I have. Inside the function it does not see the $modules object when trying to do a get for the module. How should I reference the $modules object within my function?
adrian Posted August 5, 2013 Posted August 5, 2013 Inside functions you need to use: wire('modules')-> Same goes for wire('pages') etc. This is due to variable scope issues: http://php.net/manual/en/language.variables.scope.php If you are ever writing a long function where one of the PW variables is used many times, you can always define it at the top of the function: eg: $modules = wire('modules'); 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now