Results 1 to 9 of 9

Thread: creating calendar dates for news list [solved]

  1. #1
    User
    Join Date
    07-20-09.
    Location
    Middlesbrough - United Kingdom
    Posts
    95

    Default creating calendar dates for news list [solved]

    i recently put in a request to be able to create a calendar date and i was told that it is already possible in the newslist i just cant figure out how.

    leo give me a link to a typolight website where this is working... http://www.dbrand.info/.

    I have tried to re-create this i cant get it to work, i have seperated the author and comments from the info class in the template but when i try and format the date differently in the settings i get an error when i try to save news items.

    I changed the date format too d-M-Y and it did not like that.

    can someone please point me in the right direction as to how to do this...

    also how do i get the newslist to show only the date not the time?

    Thanks,
    Ste

  2. #2
    User
    Join Date
    06-27-09.
    Location
    Ljusne, Sweden
    Posts
    59

    Default Re: creating calendar dates for news list

    Edit the news list template of your choice and change...
    Code:
    <?php echo $this->date; ?>
    ...into...
    Code:
    <?php echo date("d M", $this->time); ?>
    ...which will output "06 Jun" for the 6th of June.

    Encapsulate it in its own

    or <div> class so that you can manipulate it to look the way you desire.

    More information on the Date() function in PHP and the different formatting codes can be found here http://php.net/manual/en/function.date.php

  3. #3
    User
    Join Date
    07-20-09.
    Location
    Middlesbrough - United Kingdom
    Posts
    95

    Default Re: creating calendar dates for news list

    great thanks. this helps loads :D

  4. #4
    User
    Join Date
    07-20-09.
    Location
    Middlesbrough - United Kingdom
    Posts
    95

    Default Re: creating calendar dates for news list

    when i use the code form above for some reason i am just getting the output of jan 1st everytime is there a way to make the date in the above code dynamic using the news item date..

    Code:
    <?php echo date("d M", $this->time); ?>

  5. #5
    User
    Join Date
    07-26-09.
    Posts
    175

    Default Re: creating calendar dates for news list

    You are getting 1st January because the $this->time equals 0. Try this code
    Code:
    <?php echo date("d M", $this->tstamp); ?>
    not sure if this works either :roll:

  6. #6
    User
    Join Date
    07-20-09.
    Location
    Middlesbrough - United Kingdom
    Posts
    95

    Default Re: creating calendar dates for news list

    hey thanks for the reply. that worked it is now outputting the date but how can i target the day, date and month separately in my CSS to display it like the dates on http://www.dbrand.info/.

    Ste

  7. #7
    User
    Join Date
    07-20-09.
    Location
    Middlesbrough - United Kingdom
    Posts
    95

    Default Re: creating calendar dates for news list [solved]

    I have managed to work it out.

    thanks SuperMatz and Tru for all of your help.

    anyone who is wondering this is one way to do it

    Code:
    <div class="day"><?php echo date("D", $this->tstamp); ?></div><div class="date"><?php echo date("d", $this->tstamp); ?></div><div class="month"><?php echo date("M", $this->tstamp); ?></div>
    Ste

  8. #8
    User
    Join Date
    07-20-09.
    Location
    Middlesbrough - United Kingdom
    Posts
    95

    Default Re: creating calendar dates for news list

    okay so the code i put in last echos the date that the news/event item was added. is there a way i can echo out the date from the news/event item instead?

    Thanks.
    Ste

  9. #9
    User
    Join Date
    07-20-09.
    Location
    Middlesbrough - United Kingdom
    Posts
    95

    Default Re: creating calendar dates for news list

    Sorry i keep posting in here however i have now fixed it here is the code if anyone wants to know...

    This is the code for the news

    Code:
    <div class="day"><?php echo date("D", $this->timestamp); ?></div><div class="date"><?php echo date("d", $this->timestamp); ?></div><div class="month"><?php echo date("M", $this->timestamp); ?></div>
    I used this code posted by qrczak to figure out what i needed to change, its like the print_r from the catalog but it works for news and events.

    Code:
    <pre><?php $this->showTemplateVars(); ?></pre>
    this is the code for events

    Code:
    <div class="day"><?php echo date("D", $this->startDate); ?></div><div class="date"><?php echo date("d", $this->startDate); ?></div><div class="month"><?php echo date("M", $this->startDate); ?></div>
    Ste

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •