Can't run task when there is constructor

by Alex Mehan   Last Updated July 12, 2018 01:10 AM

I am building a component which will act as a API for a front end and was curious about something. For example if I call the url it will work without any problem. This is all in my components main controller.php file. However I want to add a constructor to define class variables to use throughout my various functions (tasks). If I then try to run a task, it will give me a 404 error saying the task can't be found. If I remove the constructor it works again.

So I guess my question is can I run a task with a constructor in the controller.php file or is it because I am targeting a specific task it won't run, which seems odd to me.

Related Questions

Make a checkbox group disappear

Updated March 21, 2017 23:10 PM

Using CodeMirror editor in custom component

Updated October 09, 2016 09:04 AM

Different views on routher.php (Joomla! 3.6.4)

Updated February 05, 2018 23:10 PM

Custom form field not working on server

Updated April 26, 2017 10:10 AM