0

我正在运行 WHILE 循环并从 mySQL 数据库中提取数据。

输出的源代码如下所示:

<li class='list-item'><a itemprop='url' href=/new-years-eve-gossip-bar><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 04:00:00:4:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/15-4-gossip-bar-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Gossip Bar & Restaurant</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>733 9th Avenue</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10019</span></div></h5><p itemprop='description' class='tagline'>Rated Best Bar In Times Square</p></strong><p itemprop='offers' class='price'>Starting at <b>$65 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/the-counter-times-square-new-years><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 01:00:00:1:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/5-4-the-counter-times-square-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>The Counter NYC</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>1451 Broadway</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Closest Venue To The Live Ball Drop</p></strong><p itemprop='offers' class='price'>Starting at <b>$195 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-dave-and-busters-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 01:00:00:1:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/7-4-dave-and-busters-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Dave and Busters</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>234 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Rated #1 NYC Mega-Entertainment Center in the Heart of Times Square</p></strong><p itemprop='offers' class='price'>Starting at <b>$65 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/times-square-family-pass><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 01:00:00:1:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/30-4-family-pass-times-square-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Times Square Family Pass</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>Times Square New York</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>The perfect ALL AGES option to be in Times Square with your Family and Friends</p></strong><p itemprop='offers' class='price'>Starting at <b>$95 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-ruby-tuesday><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 21:00:00T9:00PM><strong class='highlight'><b>December 31, 2013 at 9:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/6-4-ruby-tuesday-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Ruby Tuesday</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>585 7th Avenue</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Two-Level Restaurant Located 1 Block From The LIVE Ball Drop</p></strong><p itemprop='offers' class='price'>Starting at <b>$145 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-bowlmor-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 21:00:00T9:00PM><strong class='highlight'><b>December 31, 2013 at 9:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/13-4-bowlmor-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Bowlmor NYC</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>222 West 44th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Voted Best Entertainment Center For Times Square NYE 2014</p></strong><p itemprop='offers' class='price'>Starting at <b>$75 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-dallas-bbq><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 02:00:00:2:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/2-4-dallas-bbq-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Dallas BBQ</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>241 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>What better way to ring in the New Year than a slow cooked BBQ buffet!</p></strong><p itemprop='offers' class='price'>Starting at <b>$125 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-madame-tussauds><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/1-4-madame-tussauds-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Madame Tussauds NYC</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>234 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Biggest and Best Party in Times Square. Unique atmosphere and live attraction throughout the evening.</p></strong><p itemprop='offers' class='price'>Starting at <b>$85 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-amc-42-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/4-4-amc-42-times-square-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>AMC 42nd Street NYC</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>234 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Voted The #1 Party In Times Square with 6 Floors of Custom Nightclubs, Movies, Family Fun, and 7 Hour Open Bar!</p></strong><p itemprop='offers' class='price'>Starting at <b>$35 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-aspen-social-club><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 04:00:00:4:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/28-4-aspen-social-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Aspen Social</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>157 West 47th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Rated #1 Times Square's Most Fashionable NYC VIP Lounge for New Year's Eve 2014</p></strong><p itemprop='offers' class='price'>Starting at <b>$95 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-applebees-50th-street-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:30:00T7:30PM><strong class='highlight'><b>December 31, 2013 at 7:30PM</b></strong><meta itemprop='endDate' content=2014-01-01 00:00:00:12:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/19-4-applebees-50-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Applebee's 50th Street</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>205 West 50th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10019</span></div></h5><p itemprop='description' class='tagline'>Enjoy The Best Of Applebee's</p></strong><p itemprop='offers' class='price'>Starting at <b>$375 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-beer-authority><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 02:00:00:2:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/image_listing_315x215.jpg /><strong class='event-info'><h3 itemprop='name'>Beer Authority</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>300 West 40th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10018</span></div></h5><p itemprop='description' class='tagline'>Upscale Pub and Restaurant Right In The Heart of Times Square</p></strong><p itemprop='offers' class='price'>Starting at <b>$0 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-lucky-chengs-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:30:00T8:30PM><strong class='highlight'><b>December 31, 2013 at 8:30PM</b></strong><meta itemprop='endDate' content=2014-01-01 02:00:00:2:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/10-4-lucky-chengs-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Lucky Cheng's</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>240 West 52nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10019</span></div></h5><p itemprop='description' class='tagline'>Dance The Night Away At This Times Square Hot Spot</p></strong><p itemprop='offers' class='price'>Starting at <b>$75 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-chevys-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/3-4-chevys-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Chevy's NYC</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>259 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Voted Wildest Times Square Fiesta At Chevys NYE 2014</p></strong><p itemprop='offers' class='price'>Starting at <b>$55 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/times-square-all-access-pass><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/29-4-balldrop-pass-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>BallDrop Pass</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>Times Square NYC</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Multiple Parties at top bars, lounges, and restaurants in and around Times Square...all for ONE price</p></strong><p itemprop='offers' class='price'>Starting at <b>$225 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-times-scare><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 21:00:00T9:00PM><strong class='highlight'><b>December 31, 2013 at 9:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 01:00:00:1:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/11-4-times-scare-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Times Scare</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>669 8th Avenue</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Rated Most Original NYE Experience</p></strong><p itemprop='offers' class='price'>Starting at <b>$85 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-cellar-bar><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 21:00:00T9:00PM><strong class='highlight'><b>December 31, 2013 at 9:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 04:00:00:4:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/14-4-cellar-bar-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Cellar Bar</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>40 West 40th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10018</span></div></h5><p itemprop='description' class='tagline'>Voted #1 Most Fashionable Hotel Lounge in Midtown</p></strong><p itemprop='offers' class='price'>Starting at <b>$85 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-planet-hollywood-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 01:00:00:1:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/26-4-planet-hollywood-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Planet Hollywood </h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>1540 Broadway</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Experience the magic of Hollywood right here in NYC on the biggest night of the year!</p></strong><p itemprop='offers' class='price'>Starting at <b>$195 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-ripleys-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 01:00:00:1:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/9-4-ripleys-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Ripley's Believe It Or Not</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>234 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Premiere NYC Attraction. Home To Over 500 Fun, Outrageous and Amazing Exhibits</p></strong><p itemprop='offers' class='price'>Starting at <b>$235 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-applebees-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:30:00T7:30PM><strong class='highlight'><b>December 31, 2013 at 7:30PM</b></strong><meta itemprop='endDate' content=2014-01-01 00:00:00:12:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/8-4-applebees-42-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Applebee's 42nd</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>234 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Enjoy The Best Of Applebee's</p></strong><p itemprop='offers' class='price'>Starting at <b>$375 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-penthouse-760><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 04:00:00:4:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/46-4-penthouse-760-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Penthouse 760</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>760 Eighth Avenue</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>New Years Eve 2014 at Penthouse 760 in Times Square</p></strong><p itemprop='offers' class='price'>Starting at <b>$115 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-fashion-forty-lounge><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 04:00:00:4:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/12-4-fashion-40-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Fashion Forty Lounge</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>202 West 40th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Rated Trendiest Lounge In Times Square</p></strong><p itemprop='offers' class='price'>Starting at <b>$65 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-hurleys-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/18-4-hurleys-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Hurley's</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>232 West 48th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10019</span></div></h5><p itemprop='description' class='tagline'>Rustic Irish Pub In Times Square</p></strong><p itemprop='offers' class='price'>Starting at <b>$85 </b></p></div></a></li>

这一切都在一行乱七八糟的代码中。如何将循环分开,以便将所有内容都组织在 HTML 源代码中?

这是实际的 WHILE 循环:

    while ($row = mysql_fetch_array($result))
    {
        // VARIABLES

        $image_list     = $row['image_listing_315x215'];
        $date           = $row['start_date'];
        $startDate      = convertDate ($date);
        $startTime      = convertTime ($date);
        $endDate        = $row['end_date'];
        $endTime        = convertTime($endDate);
        $venueName      = $row['venue_name'];
        $venueName2     = $row['alt_venue_name'];
        $eventTag       = $row['event_tag'];
        $eventBlurb     = $row['event_blurb'];
        $venueAddress   = $row['venue_address1'];
        $venueCity      = $row['city_name'];
        $venueState     = $row['state_abb'];
        $venueZip       = $row['zip'];
        $lowestTicket   = $row['ticket_lowest'];
        $url            = $row['event_url'];

        echo "<li class='list-item'>";
        echo "<a itemprop='url' href=".$url.">"; 
        echo "<div itemscope itemtype='http://schema.org/Event'>"; 
        echo "<meta content=".$venueName2." is ".$eventTag.">"; 
        echo "<meta itemprop='startDate' content=".$startDate."T".$startTime."Q><strong class='highlight'><b>".$startDate." from ".$startTime." to ".convertTime($endDate)." </b></strong>";
        echo "<meta itemprop='endDate' content=".$endDate.":".$endTime.">";
        echo "<meta itemprop='duration' content='0000-00-00T07:00'>";
        echo "<img itempromp='image' src=". DIR_IMAGES . $image_list ." />";
        echo "<strong class='event-info'>";
        echo "<h3 itemprop='name'>".$venueName."</h3>";
        echo "<h5>"; 
        echo "<div itemscope itemtype='http://schema.org/PostalAddress'>";
        echo "<span itemprop='streetAddress'>".$venueAddress."</span>, "; 
        echo "<meta itemprop='addressLocality' content=".$venueCity.">";
        echo "<span itemprop='addressRegion'>".$venueState."</span>, ";
        echo "<span itemprop='postalCode'>".$venueZip."</span>"; 
        echo "<meta itemprop='addressCountry' content='USA'></div>";
        echo "</h5>";
        echo "<p itemprop='description' class='tagline'>".$eventBlurb."</p>";
        echo "</strong>";
        echo "<p itemprop='offers' class='price'>Starting at <b>$".$lowestTicket."</b></p>";
        echo "</div>";
        echo "</a>";
        echo "</li>";

    }
4

3 回答 3

1

如果你echo "\n"会引入换行符。

于 2013-10-06T22:31:00.540 回答
1

添加\n到代码中的每一行,例如这样

echo "<h5>"."\n";

请注意\n,如果您使用双引号,则仅添加有效。

echo "\n"; // Adds a linebreak
echo '\n'; // Does not add a linebreak
于 2013-10-06T22:42:05.447 回答
1

创建有组织的输出的另一种方法:

while ($row = mysql_fetch_array($result))
{
    // VARIABLES

    $image_list     = $row['image_listing_315x215'];
    $date           = $row['start_date'];
    $startDate      = convertDate ($date);
    $startTime      = convertTime ($date);
    $endDate        = $row['end_date'];
    $endTime        = convertTime($endDate);
    $venueName      = $row['venue_name'];
    $venueName2     = $row['alt_venue_name'];
    $eventTag       = $row['event_tag'];
    $eventBlurb     = $row['event_blurb'];
    $venueAddress   = $row['venue_address1'];
    $venueCity      = $row['city_name'];
    $venueState     = $row['state_abb'];
    $venueZip       = $row['zip'];
    $lowestTicket   = $row['ticket_lowest'];
    $url            = $row['event_url'];

    ?> 
        <li class='list-item'>
            <a itemprop='url' href=<?php echo $url; ?>> 
                <div itemscope itemtype='http://schema.org/Event'> 
                    <meta content=<?php echo $venueName2; ?> is <?php echo $eventTag; ?>> 
                    <meta itemprop='startDate' content=<?php echo $startDate; ?>T<?php echo $startTime; ?>Q>
                    <strong class='highlight'>
                        <b><?php echo $startDate; ?> from <?php echo $startTime; ?> to <?php echo convertTime($endDate); ?> </b>
                    </strong>
                    <meta itemprop='endDate' content=<?php echo $endDate; ?>:<?php echo $endTime; ?>>
                    <meta itemprop='duration' content='0000-00-00T07:00'>
                    <img itempromp='image' src=<?php echo DIR_IMAGES . $image_list ; ?> />
                    <strong class='event-info'>
                        <h3 itemprop='name'><?php echo $venueName; ?></h3>
                        <h5> 
                            <div itemscope itemtype='http://schema.org/PostalAddress'>
                                <span itemprop='streetAddress'><?php echo $venueAddress; ?></span>,  
                                <meta itemprop='addressLocality' content=<?php echo $venueCity; ?>>
                                <span itemprop='addressRegion'><?php echo $venueState; ?></span>, 
                                <span itemprop='postalCode'><?php echo $venueZip; ?></span> 
                                <meta itemprop='addressCountry' content='USA'>
                            </div>
                        </h5>
                        <p itemprop='description' class='tagline'><?php echo $eventBlurb; ?></p>
                    </strong>
                    <p itemprop='offers' class='price'>Starting at <b>$<?php echo $lowestTicket; ?></b></p>
                </div>
            </a>
        </li>

    <?php } 

顺便说一句,该offers属性必须是要约而不是Starting at $***

于 2013-10-06T23:01:57.287 回答