Date Field Format

5 posts by 2 authors in: Forums > CMS Builder
Last Post: September 10, 2010   (RSS)

I have a newsletter section that I'm building, and I want to sort the archives into groups by year to make them easier to find and make the list easier to read (instead of one big giant list of links). Each year will have a heading that says "{year} Issues".

Pure HTML Static Demo Link: http://66.39.41.59/the-voice.php

What I want to know is how CMS Builder stores the date so that I can list the right issues under the right heading.

Thanks!
-----
~Jessica Sullivan, Crystal Realm Designs.

Re: [Jason] Date Field Format

Would this work also for a user defined date field? I'm going to be adding a lot of back issues, so the created date for the record will be different than the original published date.

Thanks! [laugh]
-----
~Jessica Sullivan, Crystal Realm Designs.

Re: [Duches77] Date Field Format

By Jason - September 10, 2010

Hi,

Yes, any date field you add in CMS Builder would be stored the same way, so you could just replace createdDate with the name of whichever date field you want.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Date Field Format

By JLynne77 - September 10, 2010 - edited: September 10, 2010

I've worked through it and found a way to display all the lists on the same page, which was my intitial desire instead of doing a seperate page for each year. I've now replaced my initial static demo page with one running using CMS Builder so you can see my progress (as you can see, I haven't entered all the issues yet as the static page at http://66.39.41.59/the-voice-old.php has much more listed).

My next step is keeping the 'Latest Issue' at the top of the page as it is now on http://66.39.41.59/the-voice.php without having that 'Latest Issue' record in the archive list below it as it currently shows. See below... I found a way to do this.

For anyone curious on how, I did the following (NEW VERSION BELOW):
<ul>
<?php foreach ($the_voiceRecords as $record): ?>
<?php if (date("Y", strtotime($record['date']))=="2010"): ?>
<li>
<a href="<?php echo $record['link'] ?>">
<?php echo $record['title'] ?>
</a>
</li>
<?php endif ?>
<?php endforeach ?>
</ul>


For keeping the Latest Issue out of the archive listing and at the top of the page, I used that "Latest Issue" record as a result and filter.
<p>Latest issue:
<?php foreach ($the_voiceRecords as $record): ?>
<?php if ($record['title']=="Latest Issue"): ?>
<a href="<?php echo $record['link'] ?>">
<?php echo date("F Y", strtotime($record['date'])) ?>
</a>
<?php endif ?>
<?php endforeach ?>
</p>

<ul>
<?php foreach ($the_voiceRecords as $record): ?>
<?php if (date("Y", strtotime($record['date']))=="2010"): ?>
<li>
<?php if ($record['title']!="Latest Issue"): ?>
<a href="<?php echo $record['link'] ?>">
<?php echo $record['title'] ?>
</a>
<?php endif ?>
</li>
<?php endif ?>
<?php endforeach ?>
</ul>


Thank you, Jason, for your help. :)
-----
~Jessica Sullivan, Crystal Realm Designs.