Recent Topics

1 Apr 01, 2008 17:14    

My b2evolution Version: 2.x

How can I get this date format on my posts?

April 01st, 2008

3 Apr 02, 2008 08:48

Thanks!

After reading and some trial and error, I kinda figured it out

			

				$MainList->date_if_changed( array(
      				'before'      => ' ',
      				'after'       => ' ',
      				'date_format' => 'F  jS  Y',
  				) );

Is there anyway of having the date show on every post instead on only when it changes?

4 Apr 02, 2008 12:47

Hi Paulo,

		$Item->issue_date( array(
					'before'		=> '',
					'after'			=> '',
					'date_format'	=> 'Y-m-d',
				)
			);


This is a link to the manual for PHPs date() function: http://php.net/date with more information on how the change the output.

Good luck

5 Apr 02, 2008 16:48

I changed the code to this



				$MainList->issue_date( array(
      				'before'      => ' ',
      				'after'       => ' ',
      				'date_format' => 'F  jS  Y',
  				) );

Now I get this on my site

Fatal error: Call to undefined function: issue_date() in .../index.main.php

6 Apr 02, 2008 16:51

Hi paulo,

Do you run B2evo version 2.4?

Good luck

7 Apr 02, 2008 17:04

date_if_changed() is a function that $MainList knows what to do with. It will put a date on the page IF the next post is from a day different than the previous post. issue_date() is a function that $Item knows what to do with. It will put the date an Item was published on the page.

$MainList doesn't know what $Item knows, so when you took $Item's issue_date() and stuck it on $MainList you made $MainList cry.

Make sense? both of those functions understand what the php.net/date page talks about, but those functions can't go wherever you put them because the thing their called by has to know what the function does. So put your 'F jS Y' in "issue_date" on an $Item or "date_if_changed" on a $MainList - not "issue_date" on a $MainList.

8 Apr 02, 2008 17:07

        $Item->issue_date( array(
                    'before'        => '',
                    'after'            => '',
                    'date_format'    => 'F  jS  Y',
                )
            ); 


I missed that one. Thanks EdB.

9 Apr 02, 2008 17:10

Or

$MainList->date_if_changed( array(
                    'before'        => '',
                    'after'            => '',
                    'date_format'    => 'F  jS  Y',
                )
            );


Just don't put issue_date on $MainList because, as you've seen, it won't work.

10 Apr 02, 2008 17:59

Thank you for everyone's response.
I think I am up and running now.



				$Item->issue_date( array(
      				'before'      => ' ',
      				'after'       => ' ',
      				'date_format' => 'F  jS  Y',
  				) );


Form is loading...