SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in

    Hi
    Having recently purchased one of the sitepoint books on CSS websites I am trying to change my site over to all css, but I have a problem with a bit of php used in my site. My test page is coming back with this error when I try to view it online.
    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in hhhhhhhhhhhhhhhhh_product11.htm on line 147

    let me explain the current site uses tables and images for the nav buttons, this has worked fine for a number of years using the code below. The first and last button in the nav button row vary depending on if the shopping basket has been used.

    example of code used for table site.

    <td width="100"><?php
    if (($ot_row_count>0) && ($gross_total>0)){
    echo "<td><a href='/".$_SESSION['SHOP_PAGES']."index.html'><img src='/pix/bb_shopentranceg.jpg' name='home' width='100' height='39' border='0'></a></td>";
    } else {
    echo "<td><a href='/index.html'><img src='/pix/bb_shopentranceg.jpg' name='home' width='100' height='39' border='0'></a></td>";
    }

    ?></td>
    <td><a href="/<?php echo $_SESSION['SHOP_PAGES']; ?>giftflowers.htm" target="_top" onClick="MM_nbGroup('down','group1','gifts','file:///C|/Documents%20and%20Settings/209171t/My%20Documents/pix/bb_giftandflowersg.jpg',1)" onMouseOver="MM_nbGroup('over','gifts','../pix/bb_giftandflowersg.jpg','',1)" onMouseOut="MM_nbGroup('out')"><img src="../pix/bb_giftandflowersg.jpg" alt="" name="gifts" width="100" height="39" border="0" onload=""></a></td>
    <td><a href="/<?php echo $_SESSION['SHOP_PAGES']; ?>sympathy.htm" target="_top" onClick="MM_nbGroup('down','group1','funeral','',1)" onMouseOver="MM_nbGroup('over','funeral','../pix/bb_funeralg.jpg','',1)" onMouseOut="MM_nbGroup('out')"><img src="../pix/bb_funeralg.jpg" alt="" name="funeral" width="100" height="39" border="0" onload=""></a></td>
    <td><a href="/<?php echo $_SESSION['SHOP_PAGES']; ?>seasonal.htm" target="_top" onClick="MM_nbGroup('down','group1','seasonal','',1)" onMouseOver="MM_nbGroup('over','seasonal','../pix/bb_seasonalg.jpg','',1)" onMouseOut="MM_nbGroup('out')"><img src="../pix/bb_seasonalg.jpg" alt="" name="seasonal" width="100" height="39" border="0" onload=""></a></td>
    <td><a href="/<?php echo $_SESSION['SHOP_PAGES']; ?>e_mail_form.htm" target="_top" onClick="MM_nbGroup('down','group1','contact','',1)" onMouseOver="MM_nbGroup('over','contact','../pix/bb_contactg.jpg','',1)" onMouseOut="MM_nbGroup('out')"><img src="../pix/bb_contactg.jpg" alt="" name="contact" width="100" height="39" border="0" onload=""></a></td>
    <td><a href="/<?php echo $_SESSION['SHOP_PAGES']; ?>aboutus.htm" target="_top" onClick="MM_nbGroup('down','group1','shop','',1)" onMouseOver="MM_nbGroup('over','shop','../pix/bb-shopdetailsg.jpg','',1)" onMouseOut="MM_nbGroup('out')"><img src="../pix/bb-shopdetailsg.jpg" alt="" name="shop" border="0" onload=""></a></td>
    <td width="100">
    <?php
    if (($ot_row_count>0) && ($gross_total>0)){
    echo "<a href='".review_basket."'><img src='/pix/bb-checkoutg.jpg' width='100' height='39' border='0'></a>";
    } else {
    echo "<a href='/".$_SESSION['SHOP_PAGES']."delivery.htm'><img src='/pix/bb_deliveryg.jpg' width='100' height='39' border='0'></a>";
    }

    ?></td>
    </tr>
    </table>


    --------------------------------------------------------------------------------

    The centre 5 buttons work fine it's only the first and last where the button shown is picked by the php code.I have tried to replace the double quotes with singles as in this below. this then works without any errors on line but the class=button does not work so the first and last button show just as text without the color background.

    if (($ot_row_count>0) && ($gross_total>0)){
    echo "<a href='/".$_SESSION['SHOP_PAGES']."index.html'><class='button' title=Home Page'>Shop Entrance</a>";
    } else {
    echo "<a href='/index.html'><class='button' title=Local Shop Entrance'>Local Entrance</a>";

    --------------------------------------------------------------------------------


    This is the code I am trying to use with the css nav buttons. but brings up the error
    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in hhhhhhhhhhhhhhhhh_product11.htm on line 147

    <div id="nav-buttons">
    <?php
    if (($ot_row_count>0) && ($gross_total>0)){
    echo "<a href='/".$_SESSION['SHOP_PAGES']."index.html' class="button" title="aaaa">Shop Entrance</a>"; this is row 147
    } else {
    echo "<a href='/index.html' class="button" title="bbbbb">Local Entrance</a>";
    }

    ?>

    <a href="/<?php echo $_SESSION['SHOP_PAGES']; ?>giftflowers.htm" target="_top" class="button"
    title="Gift Flowers ">Gift Flowers</a>
    <a href="/<?php echo $_SESSION['SHOP_PAGES']; ?>sympathy.htm" target="_top" class="button"
    title="Funeral Flowers ">Sympathy Flowers</a>
    <a href="/<?php echo $_SESSION['SHOP_PAGES']; ?>seasonal.htm" class="button"
    title="Our range of Seasonal Flowers">Seasonal Flowers</a>
    <a href="/<?php echo $_SESSION['SHOP_PAGES']; ?>e_mail_form.htm" class="button"
    title="How to contact us">Contact</a>
    <a href="/<?php echo $_SESSION['SHOP_PAGES']; ?>aboutus.htm" class="button"
    title="All about us">About Us</a>
    <?php

    if (($ot_row_count>0) && ($gross_total>0)){
    echo "<a href='".review_basket."' class="button" title="Go to our Check out to finish your purchase">Review Basket</a>";
    } else {
    echo "<a href='/".$_SESSION['SHOP_PAGES']."delivery.htm' class="button" title="This is Where we delivers to">Delivery Area</a>";
    }

    ?>

    </div>

    Can anyone please point me in the right direction to solve this problem, many thanks.

  2. #2
    SitePoint Evangelist -T-'s Avatar
    Join Date
    Jun 2002
    Posts
    444
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you want to use " inside echo you will have to escape them

    example:
    PHP Code:
    echo "<a href=\"".$_SESSION['SHOP_PAGES']."delivery.htm\" class=\"button\" title=\"This is Where we delivers to\">Delivery Area</a>"
    chrome is a wrapper that combines a browser with spyware

  3. #3
    SitePoint Member
    Join Date
    Apr 2008
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by -T- View Post
    if you want to use " inside echo you will have to escape them

    example:
    PHP Code:
    echo "<a href=\"".$_SESSION['SHOP_PAGES']."delivery.htm\" class=\"button\" title=\"This is Where we delivers to\">Delivery Area</a>"

    Many thanks for your help. Buttons now show on page without any errors.
    remus2


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •