1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Is this right coding?

Discussion in 'PHP' started by tptnyc, Aug 29, 2008.

  1. #1
    Here is footer.php file and I guess it is not coded right by the developer. Can anyone see if it is ok and where is the errors in it?

    <?php
    // Footer
    ?>
    <div id="footer">
    <p>&copy; <?php echo $LovelyToys.com; ?> , © lovelytoys.com 2008<br/>
    All rights reserved | <a href="sitepolicy.html">Site policy</a> | <a href="resources.html">Resources</a> |<a href="aboutus.html">AboutUs</a> |
    <a href="contact.html">Contact</a> |<a href="sitemap.html">Site map</a>
    |</p>

    </div>

    </body>
    </html>

    <?php
    <a href="wodden_toys.html">Wooden Toys</a>|
    <a href="safe_toys.html">Safe Toys</a>|
    <a href="indoor_toys.html">Indoor Toys</a>|
    <a href="outdoor_toys.html">Outdoor Toys</a>|

    ?>
     
    tptnyc, Aug 29, 2008 IP
  2. Marc Fraser

    Marc Fraser Peon

    Messages:
    283
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What is $lovelyToys.com???? It doesnt seem to be declared... That may be ur problem!
     
    Marc Fraser, Aug 29, 2008 IP
  3. od3n

    od3n Active Member

    Messages:
    715
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    60
    #3
    just view it on dreamweaver and u can see the error.

    actually, what u want to display here?

    dis will show nothing in ur browser.

    what declaration u made here?

    comment used need to be started like dis :

     
    od3n, Aug 29, 2008 IP
  4. tptnyc

    tptnyc Peon

    Messages:
    764
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    So how it should be written, if you can suggest correction on this?
     
    tptnyc, Aug 29, 2008 IP
  5. Grit.

    Grit. Well-Known Member

    Messages:
    1,424
    Likes Received:
    22
    Best Answers:
    1
    Trophy Points:
    110
    #5
    actually, comments can be // in php. I use them in my code.
    I've also seen comments like <!-- but i can't remember the closig bit of it.
     
    Grit., Aug 29, 2008 IP
  6. Marc Fraser

    Marc Fraser Peon

    Messages:
    283
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    <!-- --> is for HTML.
     
    Marc Fraser, Aug 29, 2008 IP
  7. tptnyc

    tptnyc Peon

    Messages:
    764
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #7
    <?php
    <a href="wodden_toys.html">Wooden Toys</a>|
    <a href="safe_toys.html">Safe Toys</a>|
    <a href="indoor_toys.html">Indoor Toys</a>|
    <a href="outdoor_toys.html">Outdoor Toys</a>|

    ?>

    These are the footer links. You mean this can't be shown like this. How do I write them?
     
    tptnyc, Aug 29, 2008 IP
  8. Grit.

    Grit. Well-Known Member

    Messages:
    1,424
    Likes Received:
    22
    Best Answers:
    1
    Trophy Points:
    110
    #8
    You've got that in PHP tags... you need to put <?PHP
    echo '
    LINK1 stuff <BR>
    LINK 2 STUFF<BR>
    ...etc
    etc
    ';
    ?>

    just replace LINk1 stuff up to etc with your links, and PHP will then echo that out.

    Just clean up that code a lil bit ^^
     
    Grit., Aug 29, 2008 IP
  9. tptnyc

    tptnyc Peon

    Messages:
    764
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Alright, I made some corrections here and see if this is all ok? OR where else is the mistake?


    <?php
    // Footer
    ?>
    <div id="footer">
    <p>

    <?php echo $LovelyToys; ?> , © lovelytoys.com 2008<br/>
    All rights reserved | <a href="sitepolicy.html">Site policy</a> | <a href="resources.html">Resources</a> |<a href="aboutus.html">AboutUs</a> |
    <a href="contact.html">Contact</a> |<a href="sitemap.html">Site map</a>
    <p>
    <a href="wodden_toys.html">Wooden Toys</a>|
    <a href="safe_toys.html">Safe Toys</a>|
    <a href="indoor_toys.html">Indoor Toys</a>|
    <a href="outdoor_toys.html">Outdoor Toys</a>|

    </p>

    </div>

    </body>
    </html>
     
    tptnyc, Aug 29, 2008 IP
  10. Grit.

    Grit. Well-Known Member

    Messages:
    1,424
    Likes Received:
    22
    Best Answers:
    1
    Trophy Points:
    110
    #10
    Looks good. Though i've only skimmed it. Do you have a testing server on your PC? i'd advise XAMPP if you're on a windows machine, if not, just test it on your hosting to ensure, and if there's an error, it'll narrow down where the error is if there is one
     
    Grit., Aug 29, 2008 IP
  11. tptnyc

    tptnyc Peon

    Messages:
    764
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #11
    How about this top portion of footer.php, is all ok here?

    <?php
    // Footer
    ?>
    <div id="footer">
    <p>

    <?php echo $LovelyToys; ?> , © lovelytoys.com 2008<br/>
     
    tptnyc, Aug 29, 2008 IP
  12. Grit.

    Grit. Well-Known Member

    Messages:
    1,424
    Likes Received:
    22
    Best Answers:
    1
    Trophy Points:
    110
    #12
    yeah, i'm guessing $LovelyToys has been defined previously in the document, and the rest of the code looks sound to me ^^.
     
    Grit., Aug 29, 2008 IP
  13. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Unless the text to the left of
    © lovelytoys.com 2008
    changes, then theres no real reason why you would want the php there. something like

    <a href="http://www.lovelytoys.com/">Lovely Toys ©Copyright lovelytoys.com 2008</a><br />
    HTML:
    will work fine, and will then have a link to the home page too at the bottom of each page. Theres really no need for the
    <?php
    // FOOTER
    ?>
    PHP:
    If you do want something there, have
    <!-- Footer -->
    PHP:
    so that you can clearly see the divide in the HTML source

    Jay
     
    JAY6390, Aug 29, 2008 IP
  14. tptnyc

    tptnyc Peon

    Messages:
    764
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #14
    footer.php

    O boy! its still giving me error after all this.



    <div id="footer">
    <p>

    <a href="http://www.lovelytoys.com/">Lovely Toys ©Copyright lovelytoys.com 2008</a><br />
    All rights reserved |
    |<a href="aboutus.html">AboutUs</a> |
    <a href="contact.html">Contact</a> |
    </p>

    <p>

    <a href="indoor_toys.html">Indoor Toys</a>|
    <a href="outdoor_toys.html">Outdoor Toys</a>|

    </p>

    </div>

    </body>
    </html>
     
    tptnyc, Aug 29, 2008 IP
  15. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #15
    There's no errors there. The error must be coming from somewhere else
     
    JAY6390, Aug 29, 2008 IP
  16. Grit.

    Grit. Well-Known Member

    Messages:
    1,424
    Likes Received:
    22
    Best Answers:
    1
    Trophy Points:
    110
    #16
    what error are you getting? can you just write it out on here, so that we can help in more detail?
     
    Grit., Aug 29, 2008 IP
  17. pachecus

    pachecus Well-Known Member

    Messages:
    1,841
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    110
    #17
    That code should work fine, what error are you getting?
     
    pachecus, Aug 29, 2008 IP
  18. tptnyc

    tptnyc Peon

    Messages:
    764
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #18
    In the index.php when I place this footer includes as follows and its giving me error Line 154 or Line 150


    <div id="footer"/>
    <p>

    <? include('footer.php'); ?>

    </p>

    </div>


    </body>
    </html>
     
    tptnyc, Aug 29, 2008 IP
  19. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #19
    It could be that you are using the <? ?> short tags, but not very likely. try changing the <? to <?php. can you post your whole script?
     
    JAY6390, Aug 29, 2008 IP
  20. tptnyc

    tptnyc Peon

    Messages:
    764
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Well I tried this also the full tags.

    <div id="footer"/>


    <?php include("footer.php"); ?>


    </div>

    </body>
    </html>

    AND I still get following error in index.php

    Warning: main(footer.php) [function.main]: failed to open stream: No such file or directory in /home/pri/public_html/lovelytoys/index.php on line 155

    Warning: main() [function.include]: Failed opening 'footer.php' for inclusion (include_path='.:/usr/php4/lib/php:/usr/local/php4/lib/php')
     
    tptnyc, Aug 29, 2008 IP