CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Displaying default text when there aren't any upcoming events
Pages: [1]

Author Topic: Displaying default text when there aren't any upcoming events  (Read 603 times)

smoo

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6
  • MySQL version: 5.0.77
  • PHP version: 5.2.9
Displaying default text when there aren't any upcoming events
February 09, 2011, 08:32:26 pm
Hi - complete newbie here - sorry.
I've looked on the wiki and in  the CiviCRM PDF(book), as well as searched here...

I'm using a block in Drupal to display CiviCRM events. (I'm not using the Drupal calendar for events at all, as I don't need Drupal's calendar for anything else.)

When there aren't any events scheduled I'd like to display a default message such as "No events currently scheduled".

Is there a way to do this?
I'm sure I've missed something obvious - any help appreciated.
Thanks

Rahul Bile

  • I post occasionally
  • **
  • Posts: 112
  • Karma: 16
  • impossible says, I M Possible
    • I AM POSSIBLE
Re: Displaying default text when there aren't any upcoming events
February 10, 2011, 03:08:45 am
smoo,

You may apply the below patch in templates/CRM/Block/Event.tpl at line no 29.

 ++templates/CRM/Block/Event.tpl

+ {if $eventBlock}
    {foreach from=$eventBlock item=ev}
    <p>
    <a href="{$ev.url}">{$ev.title}</a><br />
    {$ev.start_date|truncate:10:""|crmDate}<br />
    {assign var=evSummary value=$ev.summary|truncate:80:""}
    <em>{$evSummary}{if $ev.summary|count_characters:true GT 80}  (<a href="{$ev.url}">{ts}more{/ts}...     </a>){/if}</em>
    </p>
    {/foreach}
+{else}
+<p>
+No Events Available
+</p>
+{/if}
</div>
 

HTH

Rahul.
« Last Edit: February 10, 2011, 04:33:03 am by Rahul Bile »
Consider donating to CiviCRM if you use it. http://civicrm.org/donate

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Displaying default text when there aren't any upcoming events
February 10, 2011, 03:53:11 am
smoo :
Fixed for 3.4

Thanks for the patch Rahul :)

-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

smoo

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 3.3.3
  • CMS version: Drupal 6
  • MySQL version: 5.0.77
  • PHP version: 5.2.9
Re: Displaying default text when there aren't any upcoming events
February 10, 2011, 09:11:51 am
Super - thanks for that!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Displaying default text when there aren't any upcoming events

This forum was archived on 2017-11-26.