How would I change the "posted 1234 Days ago", to "posted on Dec 20, 2011" on Elgg 1.8? Thanks
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
function elgg_view_friendly_time($time) {
return elgg_view('output/friendlytime', array('time' => $time));
}
So, by modifying 'view/default/output/friendlytime.php'
Hey there, thatnks for the response. Do I replace everything with that line? I'm on Elgg 1.8.1, thanks
@Chris - look at the friendlytime.php file, you'll see how the output is calculated. You'll want to overwrite the view in a plugin with your new calculations, so copy the core file to <yourpluginname>/views/default/output/friendlytime.php and adjust the output to your needs.
Thanks for the info Matt, I'm a little skittish about trying to code my own plugin as I'm not familiar with php. Maybe I'll wait for someone who knows what they're doing to make a plugin.
This comment was removed by an administrator because it contained advertising.
Create a folder "myplugin" in mod/
Copy and edit a manifest files from any other plugin.
Create a folder called 'views', in there create a folder 'default', in there create a folder 'output', in there create a file 'friendlytime.php'.
Copy the following into friendlytime.php:
$friendly_time = date("M j, Y", ($vars['time']);
$timestamp = htmlspecialchars(date(elgg_echo('friendlytime:date_format'), $vars['time']));
echo "<acronym title=\"$timestamp\">$friendly_time</acronym>";
Activate your plugin. That should be it.
I would really suggest you take a look at Elgg documentation and start learning php. Before one 1 year ago, I haven't done any programming whatsoever.
Hey Ismayil,
I did everything you said and it's asking for a "start.php", so I created one and added the following code to it.
<?php
elgg_register_action("friendlytime/views/default/output/", dirname(__FILE__) . "/friendlytime/views/default/output/friendlytime.php");
?>
I did read some docs and this is what I came up with, when I activate the plugin I get a white page. I'm thinking the start.php is wrong.
no no. you don't need to register any actions in start.php
Just do this:
elgg_register_event_handler('init', 'system', 'myplugin_init');
function myplugin_init() {
}
You don't need anything else in there. In the future, if you would like to register actions or extend views, you can do it in your myplugin_init function. Otherwise, leave it blank for now.
I posted that code in start.php and got this error
Fatal Error.
Redirect could not be issued due to headers already being sent. Halting execution for security. Search http://docs.elgg.org/ for more information.
Make sure start.php starts with <?php (no spaces before)
Do not close start.php with ?>
- Previous
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- Next
You must log in to post replies.