Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Hi,
I am new to CouchCMS but it is working great and generally makes sense.
I am trying to add this CMS to our football clubs website (whilst revamping) and have hit a small roadblock.

Basically I'm wanting to display our current fixtures in groups by month (both previous and future). Hopefully there will be a screenshot of the static site attached.

Image

I have created 2 file one called new-fixture which has the fixture date, teams, competition etc.. and another file called fixtures which loops through the cloned page outputting the content. The is fine except for the previously mention grouping by month.

How would I go about trying to achieve this? Is it done on output or do I need to modify the new-fixture template?
NOTE: Creation date is no good as fixtures are listed long before they are played.

Code below for the new-fixture and fixtures files

Code: Select all
<?php require_once("./admin/cms.php"); ?>
<cms:template title="New Fixture" clonable="1" order="asc">
  <cms:editable name="fixture_date" type="datetime" label="Date of Fixture" />
  <cms:editable name="fixture_type"
              label="Fixture Competition"
                description="Select one from these"
                opt_values="Highland League | Highland League Cup | Menzies Distribution North of Scotland Cup |
                          Scottish Cup | Friendly"
              type="dropdown" />
  <cms:editable name="home_team"
              label="Home Team"
                description="Select one from these"
                opt_values="Nairn County | Brora Rangers | Buckie Thistle | Clachnacuddin | Cove Rangers |
                          Deveronvale | Formartine United | Forres Mechanics | Fort William | Fraserburgh |
                            Huntly | Inverurie Locos | Keith | Lossiemouth | Rothes | Strathspey Thistle |
                            Turriff United | Wick Academy"
                type="dropdown" />
  <cms:editable name="away_team"
              label="Away Team"
                description="Select one from these"
                opt_values="Nairn County | Brora Rangers | Buckie Thistle | Clachnacuddin | Cove Rangers |
                          Deveronvale | Formartine United | Forres Mechanics | Fort William | Fraserburgh |
                            Huntly | Inverurie Locos | Keith | Lossiemouth | Rothes | Strathspey Thistle |
                            Turriff United | Wick Academy"
                type="dropdown" />
  <cms:editable name="match_sponsor" type="text" label="Match Sponsor" />
  <cms:editable name="ball_sponsor" type="text" label="Ball Sponsor" />
  <cms:editable name="kickoff" type="text" label="Kickoff Time" />
</cms:template>

<!doctype html>
<html lang="en">
</html>
<?php COUCH::invoke(); ?>


Fixtures 'loop'
Code: Select all
<div class="fixture-list">
          <cms:pages masterpage="new-fixture.php" order="asc">
            <!--Group fixtures by month.-->
            <div class="month"><h4><cms:date fixture_date format="F" /></h4></div>
            <ul>
              <li>
                <!--Display the date of the fixture-->
                <div class="cell"><span><cms:date fixture_date format="jS F" /></span></div>
                <!--Display the Home Team, Away Team and result (if any)-->
                <div class="cell">
                  <span><cms:show home_team /></span>
                  <span class="score"></span>
                  <span><cms:show away_team /></span>
                </div>
                <!--Display the competition the fixture is for-->
                <div class="cell"><span><cms:show fixture_type /></span></div>
              </li>
            </ul>
          </cms:pages>
        </div>


Any help/advice greatly appreciated.
Hi,
Creation date is no good as fixtures are listed long before they are played.

Using the system publish_date is actually the preferred way of handling dates for events. Future dates is not a problem at all and such pages can be listed by setting the 'show_future_entries' parameter of <cms:pages> to '1'.

Assuming you use publish_date for the events, we can then use <cms:archives> to list the months and nest <cms:pages> within to list the pages belonging to that period.

As a concrete example, I think you'll find the following thread useful -
viewtopic.php?f=2&t=11052

Please make sure to use the 'show_future_entries' parameter with both <cms:archives> and <cms:pages>.
Let us know if you need help with anything.
Thanks for the reply. I've tried grouping this way but it is only grouping on December since this is when I have created these pages. This works as designed I suspect but I struggling to get my head round how I get mine to group when the published date will never be the date the game was agreed to be played. I've put the code below that I'm currently using.

As I say if I output k_archive_date it appears ok but with an undesired result and if I group by kickoff (date) it doesn't appear at all. I'm sure its just me being an idiot, Code:

Code: Select all
<cms:archives masterpage="new-fixture.php"
                      show_future_entries="1"
                        type="monthly">
            <!--Group fixtures by month.-->
            <cms:capture>
              <div class="month">
                <h4><cms:date kickoff format="F" /></h4>
              </div>
            </cms:capture>
            <cms:pages masterpage="new-fixture.php"
                     start_on=k_archive_date
                       stop_before=k_next_archive_date
                       orderby="publish_date"
                       order="asc"
                       show_future_entries="1">
              <ul>
                <li>
                  <div class="cell"><span><cms:date kickoff format="jS F" /></span></div>
                  <div class="cell">
                    <span><cms:show home_team /></span>
                    <span>vs</span>
                    <span><cms:show away_team /></span>
                  </div>
                  <div class="cell"></div>
                </li>
              </ul>
            </cms:pages>
          </cms:archives>


Also a quick question but different topic, Is it possible to allow the client to add values to a dropdown menu as opposed to being confined to the hard coded one?

Many Thanks
3 posts Page 1 of 1

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 3 guests