简体   繁体   中英

PHP Parse error: syntax error, unexpected '<' at line 2

Unfortunately my start was not very good at the time. But this time I have PHP Code problem.

This code is available. In line 2 with "<" it means that it can not be parsed. What am I doing wrong?

<?php if (!wp_is_mobile()) {
   <div id="content">
                <!-- Posts anzeigen -->
                <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                    <!-- Datumsheader -->
                        <p class="dateheader"><?php the_date('l, j. F Y'); ?></p>
                    <!-- Posttitel -->
                        <a class="posttitle" href="<?php the_permalink() ?>">
                        <h2><?php the_title(); ?></h2>
                        </a>
                    <!-- Posttext -->
                        <div class="entry">
                            <?php the_content(); ?>
                        </div>
                        <p style="text-align:right;"><a href="<?php the_permalink(); ?>#comments" title="Kommentare zu '<?php the_title(); ?>'"><?php comments_number('Noch kein Kommentar','1 Kommentar','%Kommentare'); ?></a></p>
                        <hr class="postende" />
                <?php endwhile; ?>
                <!-- Posts anzeigen Ende-->

                <!-- aeltere und neuere Posts anzeigen / Seitennavigation -->
                    <p align="center">
                    <?php previous_posts_link('&laquo;Neuere Eintr&auml;ge') ?> | 
                    <?php next_posts_link('&Auml;ltere Eintr&auml;ge &raquo;') ?>
                    </p><!-- Seitennavigation Ende -->

            <?php endif; ?>
            <hr />
        </div>
            <div id="footer1">
                <div id="spalte1">
                    <h3>Suche</h3>
                    <p>
                    <form method="get" id="searchform" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                       <input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" />
                       <input type="submit" id="search_submit" value="Suchen" />
                    </form>
                    </p>
                    <h3>ganzjährige Blogprojekte</h3>
                    <p>
                        <a href="http://tweedandgreet.de/12coloursofhandmadefashion/" target="_blank">12 Colors of Handmade Fashion</a>  (jeden Monat eine Farbe, zu der genäht werden darf) <br />
                        <a href="http://die-photographin.de/2016/12/increase-creativity-challenge-2017/" target="_blank">Increase Infinity</a> (jeden Monat eine Farbe, zu der gebloggt werden soll)<br />
                        <a href="https://vom-landleben.de/blogprojekt/fotoprojekt17/" target="_blank">Fotoprojekt17</a> (jeden         Monat ein Thema, zu dem fotografiert werden kann)<br />
                        <a href="https://tonari.wordpress.com/category/rost-parade/" target="_blank">Fotoprojekt: Rostparade</a> (immer am letzten Tag des Monats Rostfotos online stellen) <br />
                        <a href="http://fuenfzig-millimeter.de/projekt-graustufe-allgemeine-informationen/" target="_blank">Fotoprojekt: Graustufen</a> (jeden Monat ein Thema, zu dem Schwarz-weiß-Fotos gemacht werden sollen)<br />
                        <a href="https://heutemachtderhimmelblau.com/bunt-ist-die-welt/" target="_blank">Fotoprojekt: Bunt ist die Welt</a> (Jeden Sonntag ein Thema, zu dem für fünf Tage fotografiert werden darf)<br />
                        <a href="http://kathastrophal.de/aus-diyyourcloset-wird-naehdirwas" target="_blank">Näh dir was</a> (Jeden Monat ein neues Nähthema, zu dem man etwas für sich nähen soll)<br />
                        <a href="http://www.whatinaloves.com/2017/01/bloggerproject-lets-cook-together-2017.html" target="_blank">Lets cook toghether</a> (Jeden Monat ein Thema, zu dem gekocht/gebacken und ab dem 10. Tag des Monats verlinkt werden darf)<br />
                        <a href="http://www.tastesheriff.com/die-gemuese-expedition/" target="_blank">Die Gemüse-Expedition</a> (Jeden Monat ein Gemüse, das in der Küche verarbeitet werden soll)<br />

                    </p>
                </div>
                <div id="spalte2">
                    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
                    <?php endif; ?>
                </div>
                <div id="clear"></div>
            </div>
        </div>

} ?><!-- Ende Destop -->
        <div id="sidebar">
            <?php get_sidebar(); ?><!-- sucht sidebar.php und fügt den Code hier ein -->
        </div>
        <div id="footer2"><?php get_footer(); ?><!-- sucht footer und fügt den Code hier ein --></div>
    </div>
</body>
</html>

Unfortunately I own hardly any programmer knowledge and the code output would like to realize a forum user with me.

I hope you can help me so.

Thanks in Advance.

You forgot to close the PHP tag at line 2 before you start the HTML again

<?php if (!wp_is_mobile()) { ?>

and you forgot to open the PHP tag at line 67 ...

<?php
} 
?><!-- Ende Destop -->

In order to avoid this, make sure you have a good PHP IDE that has an integrated code syntax checker. It will point out right away when something as fundamental is missing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM