• Hi! I am not an PHP expert but managed to get the calendar displayed only when the user is in category 1 or the frontpage by using the following:
    <li id=”calendar”>
    <?php if (in_category(1)) get_calendar(); ?>

    I would like to know how I can change this to the following construction:
    IF in category 1
    LI
    command
    /LI
    END IF
    Thanks a lot for you help!!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • use
    echo “LI”;
    command;
    echo “/LI”;

    Thread Starter Michiel

    (@michiel)

    Hi Beel! Thanks a lot (again!). One question still… how do I handle the “” in PHP? I have now:
    <?php if (in_category(1))
    echo “<li id=””calendar””>”; ?>
    but it does not like the “”… I have been trying to find a solution on php.net but did not succeed yet… THANKS!

    Thread Starter Michiel

    (@michiel)

    Hi Beel! ok! I am not sure yet which key it is as I am working from a finnish keyboard but will check on Monday at work.
    I now tried this one (removed the “<? ?>” perhaps that works better to post it… php if (in_category(1)) echo “<li id=””calendar””>”;
    I still get the error : Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘,’ or ‘;’ in /home2/…/public_html/blog/index.php on line 112

    Thread Starter Michiel

    (@michiel)

    Beel, nevermind the above to posts…. IT WORKS ?? Thanks!!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP: IF statement around HTML’ is closed to new replies.