• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

getting started with development

Live Free

Active member
#1
Okay, let me preface this by saying I'm a total newbie as far as development goes. I know basic html/css, limited php, and took a java class five years ago... but essentially I'm a newb. I'd like to get started developing my own add-ons for xenforo. Browsing the tutorials it's kind of intimidating... I don't know where to start.

Could someone recommend how to get started and let me know what the basics I need to know are? What are the primary elements at play?

The first add-on I'd like to develop involved changing the timestap of the most recent posts on the forum index page, making the time more detailed for longer periods, which seems like an easy enough place to start before I move on to some more advanced add-ons.
 

Live Free

Active member
#3
Could you provide a screen shot of what you would like to do.
Screen Shot 2013-10-09 at 10.22.09 PM.png

I'd like to change it from Today at 6:32 a.m. to 16 hours ago, etc.

That said, I also want to get an understanding of developing for XF and be able to develop other add-ons. This is just where I'd like to start.
 

Live Free

Active member
#11
At least up to 24 hours. If it was 23 hours ago, it needs to say 23 hours ago, rather than today at XX time. It should say XX minutes ago up to 59 minutes.
 

AndyB

Well-known member
#12
Do you have a program like Dreamweaver so you can search the source code? You will want to look for the code that deals with creating the variables used to display the last post time.
 

KenSmith

Active member
#13
The code that does this is in js/xenforo/full/xenforo.js
Search for the phrase a_moment_ago and you'll be in the neighborhood.

Your board is probably using the minified version at js/xenforo/xenforo.js though.
 

AndyB

Well-known member
#14
The code that does this is in js/xenforo/full/xenforo.js
Search for the phrase a_moment_ago and you'll be in the neighborhood.

Your board is probably using the minified version at js/xenforo/xenforo.js though.
Ken brings up a good point. You will want to look at the full directory and realize that changes there won't take effect. Here are instructions to have your forum run the full version of the .js files.

http://xenforo.com/community/resources/how-to-run-uncompressed-javascript-files.2206/
 

Amaury

Well-known member
#15
The problem is it only shows detailed times like that for the first X minutes (not sure what number). I want to extend that functionality.
It extends to 60 minutes. Personally, I'm fine with that. Seeing something like "6 hours and 23 minutes ago" would look weird

After 60 minutes, it's Today / Yesterday / [Day] at. After a week it just changes to the date, but you can hover over the date if you're interested in seeing the time. For example, hovering over Andy's above post of 21 minutes ago, I see "Oct 10, 2013 at 12:20 PM."
 

Live Free

Active member
#16
Do you have a program like Dreamweaver so you can search the source code? You will want to look for the code that deals with creating the variables used to display the last post time.
Yep. Don't use it, but I have it. Any program other than Dreamweaver you'd recommend? I'm not a fan.

The code that does this is in js/xenforo/full/xenforo.js
Search for the phrase a_moment_ago and you'll be in the neighborhood.

Your board is probably using the minified version at js/xenforo/xenforo.js though.
Ken brings up a good point. You will want to look at the full directory and realize that changes there won't take effect. Here are instructions to have your forum run the full version of the .js files.

http://xenforo.com/community/resources/how-to-run-uncompressed-javascript-files.2206/
Thanks guys. It'll take me a while to figure this out but this is a good starting place. Any tips for where to get started for development knowledge in general? Or should I just start here and re-evaluate once I get this down?

It extends to 60 minutes. Personally, I'm fine with that. Seeing something like "6 hours and 23 minutes ago" would look weird

After 60 minutes, it's Today / Yesterday / [Day] at. After a week it just changes to the date, but you can hover over the date if you're interested in seeing the time. For example, hovering over Andy's above post of 21 minutes ago, I see "Oct 10, 2013 at 12:20 PM."
I figured after 1 or 2 hours, instead of minutes, it'd say just the hours, not hours and minutes. My board rarely has no posts in a forum for over 24 hours, and certainly not 48, so that's not really a concern.

The reason I want to do this is because I personally believe that it makes your forums seem more active. I'm firmly convinced of this, and my members complained when it shows the time posted instead of how long ago in hours. Hours are easier to gauge how recent the post is at a quick glance.

My hypothesis is that by increasing the perception the board is more active through the change I'm after, it might just make members post more. Plus, both my members and myself prefer it in the way I described above.
 

Amaury

Well-known member
#17
The reason I want to do this is because I personally believe that it makes your forums seem more active. I'm firmly convinced of this, and my members complained when it shows the time posted instead of how long ago in hours. Hours are easier to gauge how recent the post is at a quick glance.

My hypothesis is that by increasing the perception the board is more active through the change I'm after, it might just make members post more. Plus, both my members and myself prefer it in the way I described above.
Hm. I'm the opposite. I prefer yesterday / today (like vBulletin's default) more over relative because I find it easier to tell the difference.

For example, if it's 3:30 PM, and I see a post from 3:20 PM, then I'll know it was 10 minutes ago. However, relative doesn't take seconds into account. So it could be 3:30 PM and I see a post that was posted 10 minutes ago, but when I hover it, I'd see 3:19 PM, making me think 11 minutes ago.
 

AndyB

Well-known member
#18
Yep. Don't use it, but I have it. Any program other than Dreamweaver you'd recommend? I'm not a fan.
I've been using Dreamweaver for many years, love it. It takes some getting used to and there are several things you need to do to get the workspace proper for coding.

Programming takes lots of time. If you don't plan on spending many hours per day learning how to code, you will never learn how to do it. There are no short cuts.