Opened 23 months ago

Last modified 18 months ago

#12800 assigned Question/How do I...?

Need help with civievent template

Reported by: Liz Mestres Owned by: Jamie McClelland
Priority: Medium Component: Tech
Keywords: Cc:
Sensitive: no

Description

Hi, I need help editing the eventinfo.tpl for the full event page. Jamie helped me by providing code (below) for the dates on our regular programs and it works perfectly. But now we also need to We have a different date format for our tours which last several days. For example, right now the our next trip is - "June 18th, 2017 12:00 AM to 12:00 AM" and it should be "June 18, 2017 - [or to] July 1, 2017. I was able to change it in the views listing because I could make a view that filtered just for the "Educational Travel" event type. But I don't know how to alter the eventinfo.tpl. Here's what we have right now:

{if $event.event_end_date && $event.event_end_date != $event.event_start_date}

  {ts}to{/ts}   {* Only show end time if end date = start date, otherwise show full end date and time *} {if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}

<abbr class="dtend" title="{$event.event_end_date|crmDate:0:1}">

{$event.event_end_date|crmDate:0:1}

</abbr>

{else}

<abbr class="views-field-start-date dtend" title="{$event.event_end_date|crmDate:0:1}">

{$event.event_end_date|crmDate:0:1}

</abbr>

{/if}

{/if}

Change History (6)

comment:1 Changed 23 months ago by JaimeV

Owner: set to Jamie McClelland
Status: newassigned

Let's get jamie's help with this.

comment:2 Changed 23 months ago by Jamie McClelland

Hi Liz - can you paste in a link to the page that is showing one of the events the wrong way?

jamie

comment:3 in reply to:  2 Changed 23 months ago by Liz Mestres

Replying to https://id.mayfirst.org/jamie:

Hi Liz - can you paste in a link to the page that is showing one of the events the wrong way?

jamie

Yes, here is a link: https://globaljusticecenter.org/civicrm/event/info?reset=1&id=129

This is what should be June 18, 2017 - [or to] July 1, 2017.

comment:4 Changed 23 months ago by Jamie McClelland

Hi Liz - Using a custom .tpl file in CiviCRM is not recommended anymore.

The reason is because it is difficult to maintain as you upgrade CiviCRM.

When you copy a .tpl file and modify it, your copied (and modified) file will be used even after you upgrade and the original gets updated.

In the case of the EventInfo.tpl - the original file has been updated (and now displays dataes the way you want). So, I've moved your edited version out of the way and now you are seeing the version that ships with the version of CiviCRM that you are using. There are a number of additional changes as well.

I noticed that you have a lot of tpl files overridden. I would strongly suggest that you that you move all the folders and files that are currently in your templates directory (web/sites/default/files/civicrms/templates) out of the way and then review how your site works.

If you have pages that you still want to tweak, let's discuss and perhaps we can find ways to tweak them that don't require you to override the tpl file.

comment:5 Changed 23 months ago by Liz Mestres

Hi Jamie, Sorry, but this doesn't solve the problem on a couple of levels.

  1. The custom template rearranges the custom fields which we want to have at the top of the page and, for some reason, allows me to theme them. When you restore the original, the custom fields are at the bottom of the field and are displayed in a very unattractive table.
  2. The restored original still shows the time which we don't want for tours and do want for talks.

I put the override back in for now. What I'm looking for is two varieties of date display:

Tours - only month, day year for both start date and end date , (example page not working: https://globaljusticecenter.org/civicrm/event/info?reset=1&id=129)

Talks and Films - month, day, year and time (example: https://globaljusticecenter.org/civicrm/event/info?id=167&reset=1 We get what we need just by not entering the enddate.

I think the script you wrote years ago for the Brecht Forum that is in the template was intended to show only the time for the enddate so that you could have a class on M, D, Y - from 7:30pm to 9:30pm.

I could be wrong, but I don't believe that any other template files are overridden. I think I just copied them to the custom directory but didn't change them.

Since events are our main activity, this is the only template that needs to be customized.

comment:6 Changed 18 months ago by Liz Mestres

I still need help on this. I'm now adding more tours and need a better display.

Please login to add comments to this ticket.

Note: See TracTickets for help on using tickets.