DateHelper object loading empty
Permalink
concretee5.6.3.3
This is a real strange one. I am trying to use "$date = Loader::helper('date');".
After it loads, I am testing with the command "print_r($date);".
What is printed to the page is "DateHelper Object ()".
It appears that php is not extending class "DateHelper" to the core's class "Concrete5_Helper_Date". I double checked all files' permissions and they are correct. The first few times trying my controller code, I got an error message that "/path-to-site/concrete/helpers/'date'.php" could not be found. I tried removing the single quotes around 'date' but that caused another error down the line. I put the command back the way it should be with the quotes and then it loaded but it's loading empty.
Anyone have any ideas as to what could cause this?
Also, I checked the Apache error log and php isn't throwing any errors. (php.ini errors are turned on).
This is a real strange one. I am trying to use "$date = Loader::helper('date');".
After it loads, I am testing with the command "print_r($date);".
What is printed to the page is "DateHelper Object ()".
It appears that php is not extending class "DateHelper" to the core's class "Concrete5_Helper_Date". I double checked all files' permissions and they are correct. The first few times trying my controller code, I got an error message that "/path-to-site/concrete/helpers/'date'.php" could not be found. I tried removing the single quotes around 'date' but that caused another error down the line. I put the command back the way it should be with the quotes and then it loaded but it's loading empty.
Anyone have any ideas as to what could cause this?
Also, I checked the Apache error log and php isn't throwing any errors. (php.ini errors are turned on).
Can you check and make sure that you do not have a date.php in the root helpers folder? This almost looks like somebody created an override file incorrectly.
After checking this out I believe this is the normal behavior. If you try doing something like
Does it print out the current server date/time?
I don't quite understand what you are trying to do with the Date Helper but what you are seeing appears to be normal behavior, print_r does not print out the object's functions.
$date = Loader::helper('date'); echo $date->getLocalDateTime();
Does it print out the current server date/time?
I don't quite understand what you are trying to do with the Date Helper but what you are seeing appears to be normal behavior, print_r does not print out the object's functions.
Thanks for this.
I had moved on without fixing this because of time constraints and I will have to go back to this, maybe tomorrow, to check this out. What you are showing here looks like the proper commands to get the date from the date helper.
I will try;
$dt = Loader::helper('date');
$date = $dt->getLocalDateTime();
I had moved on without fixing this because of time constraints and I will have to go back to this, maybe tomorrow, to check this out. What you are showing here looks like the proper commands to get the date from the date helper.
I will try;
$dt = Loader::helper('date');
$date = $dt->getLocalDateTime();
I finally was able to get back to fixing this problem. My syntax was okay but it turns out from cutting and paisting "$date->getLocalDateTime(‘now’, ‘F d, Y’);" directly from the concrete5 information page, the single quotes turned out to be something other than single quotes that was causing my errors.