当我尝试将循环输出插入无序列表时,为什么会出现语法错误?

I am very new in PHP and WordPress development and I have the following problem trying to insert some HTML code into the posts loop.

I tried something like it:

<?php
if (have_posts()) :
    <ul>
    // Start the Loop.
    while (have_posts()) : the_post();

        /*
         * Include the post format-specific template for the content. If you want to
         * use this in a child theme, then include a file called called content-___.php
         * (where ___ is the post format) and that will be used instead.
         */

        <li>
        get_template_part('contentArchive', get_post_format());
        </li>

    endwhile;
    </ul>


    endwhile;
?>

As you can see I want an unordered list (the < ul>**tag) and into it I want put the one list element (the **< li> tag) for each interation of the while cycle but Aptana Studio give me a syntax error message on the < ul> and on the < li>

Why? Where is the problem? How can I fix it?

Tnx

If you aren't closing your PHP tags, you need to use echo calls to push output to the DOM.

<?php
if (have_posts()) :
    echo '<ul>';
    // Start the Loop.
    while (have_posts()) : the_post();

        /*
         * Include the post format-specific template for the content. If you want to
         * use this in a child theme, then include a file called called content-___.php
         * (where ___ is the post format) and that will be used instead.
         */

        echo '<li>';
        get_template_part('contentArchive', get_post_format());
        echo '</li>';

    endwhile;
    echo '</ul>';


    endwhile;
?>