Variations of "else" statement

4 posts by 3 authors in: Forums > CMS Builder
Last Post: June 17, 2016   (RSS)

By degreesnorth - June 5, 2016

Hi Forum

Here's the scenario.  Some courses have dates, some don't.  And, others are online courses, so they don't need dates.  I am currently using the code as 

<?php foreach ($calendarRecords as $record): ?>


<?php echo date("D, F jS", strtotime($record['date'])) ?></div></div>

<?php endforeach ?>

<?php if (!$calendarRecords): ?>
Contact us for our next course dates<br/><br/>
<?php endif ?>

That's fine for the "no dates", but 

1) the date defaults to Wed, November 30th if there is no date selected 

2) how do I say that "if the online course is ticked"  <?php echo $record['online_course'] ?>  (checkbox), then ignore the dates and replace the "contact us for your next course" with "Start the course now"


Stuck!

Thanks

By Damon - June 7, 2016

Hi,

Can you reply with more code? I'm having trouble following what is needed.

It sounds like you want this:

  1. Course with course date
    - display course with course date
  2. Course without course date
    - display course with "Contact us for our next course dates"
  3. Course marked as online
    - display course with "Start the course now"

For this date issue:

the date defaults to Wed, November 30th if there is no date selected

Can you provide the steps that cause the default date to be Wed, November 30th?

Can you confirm the setup needed and provide more code details?

Thanks!

Cheers,
Damon Edis - interactivetools.com

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

By gregThomas - June 17, 2016

Hey degreesnorth, 

I understand what you're trying to achieve, but there are a couple of other things I need to know before I can provide sample code. I think it will be quicker for me to look at the structure of your DB directly, please could you fill out a second level support request for me?

http://www.interactivetools.com/support/email_support_form.php

and ensure to include the FTP details for the site so I can see how things are setup. 

Thank!

Greg

Greg Thomas







PHP Programmer - interactivetools.com