Announcement

Collapse
No announcement yet.

Want to add date/time of ORIGINAL post in thread views

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Want to add date/time of ORIGINAL post in thread views

    When looking in a specific forum, the author's name appears under the thread title. I want to be able to make it look like:

    This is a test thread
    authorname - today 4:54 p.m.

    Like that. Can someone give me the correct template(s) and syntax for that addition?

    Thanks

  • #2
    The original start date of a thread is only available in the templates as a unix timestamp, not as a readable date. Custom code is required to parse the timestamp into a date for use in the templates, and so I recommend you post on www.vbulletin.org about this.

    Comment


    • #3
      I understand. But you guys do that in your individual posts. All I need to know is what to look for (code-wise) and in what template to look for it. I can take it from there.

      Comment


      • #4
        The variable for the timestamp that can be used in the threadbit template is $thread[dateline]. This variable would need to be used in the following PHP code within the files, like this:

        Code:
        // PARSE DATE AND TIME
        $thread[datelinedate] = vbdate($vboptions[dateformat], $thread[dateline]);
        $thread[datelinetime] = vbdate($vboptions[timeformat], $thread[dateline]);
        Then you will be able to use the two variables on the left in the templates.

        Comment


        • #5
          Thanks! Great start....

          Comment


          • #6
            Okay, in Threadbit, I've added the following at the beginning of the template:

            Code:
             $thread[datelinedate] = vbdate($vboptions[dateformat], $thread[dateline]);
              $thread[datelinetime] = vbdate($vboptions[timeformat], $thread[dateline]);
            I've also added the following code:

            after -

            Code:
             <span style="cursor:pointer" onclick="window.open('member.php?$session[sessionurl]u=$thread[postuserid]')">$thread[postusername]</span>
            I've added -

            Code:
               $thread[datelinedate]:$thread[datelinetime]
            But it gives me just ":" after the member name, with no data. I even attempted to put it inside the SPAN syntax, but the symptoms are the same. Can someone please tell me what I'm doing wrong?

            Thanks!

            Comment


            • #7
              bump for the day shift

              Comment


              • #8
                Originally posted by Dennis Olson
                Okay, in Threadbit, I've added the following at the beginning of the template:

                Code:
                $thread[datelinedate] = vbdate($vboptions[dateformat], $thread[dateline]);
                $thread[datelinetime] = vbdate($vboptions[timeformat], $thread[dateline]);
                Adding PHP to the templates isn't going to work. The templates will only parse html. You will need to modify the code in order to achieve this. Try asking over at vBulletin.org

                Comment


                • #9
                  I see. Is there ANY way to achieve the desired result WITHOUT code-mods? I would VERY much rather do the job through templates. I know what code to modify, and what to add, but don't want to, if at all possible.

                  Thoughts...?

                  Comment


                  • #10
                    I'm not aware there is a way of doing this through templates. One way or the other I think the code would need to be modified.

                    Comment


                    • #11
                      Crud. Thanks....

                      Comment


                      • #12
                        [ECON] Investors choose to ignore warnings
                        Posted by: Maher (09-15-2004 at 10:04 AM)

                        Done. Thanks for the information everyone.

                        Comment


                        • #13
                          It doesn't work for SEARCH however. I attempted to define the vars in functions_search.php' and then in 'search.php', but was unable to produce a meaningful value. (Whatever is going on in SEARCH is leaving the vars defind as null/zero, so I get the formatted date for 1969. )

                          What am I missing?

                          Comment


                          • #14
                            search.php likely uses different code to build the thread bits. So you would need to add the date code to the code for the search results as well.

                            I recommend you post on www.vbulletin.org for help with this.

                            Comment


                            • #15
                              Here's the answer (I'm only putting this here for my own reference later):

                              Find this in search.php:
                              Code:
                              $dataQuery = "
                              	 SELECT $previewfield
                              			 thread.threadid, thread.threadid AS postid, thread.title AS threadtitle, thread.iconid AS threadiconid,
                              			 thread.replycount, IF(thread.views=0, thread.replycount+1, thread.views) as views, thread.sticky,
                              And add this directly below it:
                              Code:
                              thread.dateline,

                              Comment

                              Loading...
                              Working...
                              X