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

getting started with development

Discussion in 'XenForo Development Discussions' started by Live Free, Oct 10, 2013.

  1. Live Free

    Live Free Active Member

    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.
  2. AndyB

    AndyB Well-Known Member

    Could you provide a screen shot of what you would like to do.
  3. Live Free

    Live Free Active Member

    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.
  4. Jeremy

    Jeremy Well-Known Member

    Well, that will require JavaScript, how good are you at JavaScript?
  5. Live Free

    Live Free Active Member

    Not good. I'd basically be learning from scratch. Which I'm okay with, I'm pretty good at teaching myself.
  6. tyteen4a03

    tyteen4a03 Well-Known Member

    I think XenForo does this already (somewhere)?
  7. Live Free

    Live Free Active Member

    It doesn't. I asked before and was told I'd need an add-on and that one probably doesn't exist yet.
  8. tyteen4a03

    tyteen4a03 Well-Known Member


  9. Live Free

    Live Free Active Member

    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.
  10. AndyB

    AndyB Well-Known Member

    How far do you want to extend that function?
  11. Live Free

    Live Free Active Member

    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.
  12. AndyB

    AndyB Well-Known Member

    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.
  13. KenSmith

    KenSmith Active Member

    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.
    Live Free likes this.
  14. AndyB

    AndyB Well-Known Member

    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.

    Live Free likes this.
  15. Amaury

    Amaury Well-Known Member

    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."
  16. Live Free

    Live Free Active Member

    Yep. Don't use it, but I have it. Any program other than Dreamweaver you'd recommend? I'm not a fan.

    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?

    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.
  17. Amaury

    Amaury Well-Known Member

    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.
  18. AndyB

    AndyB Well-Known Member

    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.

Share This Page