Syntax problem

I’m stumped…what is the syntax problem on line 5??? Thanks!
[php]<?php
$month = new DateTime( ‘first day of this month’ );
echo ‘<ul>’;
for( $i=0; $i <12; $i++ ){
printf(
‘<li><a href="%s">%s</a></li>’,
eo_get_event_archive_link( $month->format(‘Y’), $month->format(‘m’) ),
$month->format(‘F Y’)
);
$month->modify(’+1 month’);
}
echo ‘</ul>’;
?>[/php]

Do you have &lt / &gt in your code? You should just change all of those to < >.

The output (echoes and prints) will work fine as is, but there is no need to write it like that and changing to use < > will make it way more readable. The PHP code however will not work at all with stuff like $i <12 and $month->>format(‘m’). That has to be converted.

I’m just curious what is your end goal? By that I mean what do you hope to accomplish as the end result? The reason I have asked these questions for maybe by answering them, we will be able to help you out better.

Thanks!
I don’t want to get into the whole code because it’s kind of irrelevant to the problem :slight_smile:
The fellow that developed the plugin I’m using passed along the snippet to me for use in a widget. I just need a couple of outside eyeballs to help with troubleshooting the syntax error. Basically PHP is expecting a ) instead of a ; on line five. I’ll give the first answer a tinker and see what happens :slight_smile:
Thanks again!

Lol! I’m really rusty…the problem was me copy pasting the code from the email instead of the developer’s original post where the code is properly displayed. Thanks for triggering my brain :slight_smile:

I do love these kind of replies, makes me giggle every time i see such a statement…

Sponsor our Newsletter | Privacy Policy | Terms of Service