Results 1 to 22 of 22

Thread: CSS and PHP (Resolved)

  1. #1

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372

    CSS and PHP (Resolved)

    Hi, need a little help.

    I have a website using both HTML and PHP. To control the layout of the pages I've used css and a container table, being 100% in height, so that the copyright bar and links are always positioned at the bottom of the page. This works fine in the HTML pages, but I can't get it to work with the PHP.

    You can see what I mean here: http://www.globalfreelancers.com/index.php

    http://www.globalfreelancers.com/abo...eelancers.html

    Is this a problem with php or have I just missed something? It's driving me nuts.
    Last edited by GingerNut; Jun 21st, 2004 at 07:37 AM.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  2. #2
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Nope, there should be no difference at all. Can you post the PHP for the footer area or the table? I guess my question is, what are you using PHP for? Maybe the problem lies there. I've looked at your css file and there doesn't seem to be a problem with that.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  3. #3

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    Here's the header:
    Code:
    <table border="0" cellspacing="0" cellpadding="0" class="container">
      <tr>
        <td height="160" valign="top">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="header">
      <tr> 
        <td width="255" rowspan="2"><a href="http://www.globalfreelancers.com" title="Global Freelancers"><img src="images/gf_logo.gif" alt="Global Freelancers" width="255" height="131" border="0"></a></td>
        <td width="540"><div align="center" class="header"> <br>
            The Search Directory of Freelance Professionals</div></td>
      </tr>
      <tr>
        <td valign="bottom">
    <div align="center">
            <table width="400" border="0" cellspacing="0" cellpadding="0" class="search">
              <tr>
                <td><form action='./<? echo $PHP_SELF; ?>?action=searchform1' method='post'>
                  Search Global Freelancers<br> <input type='text' size='46px' name='search'> 
                    &nbsp; <input name="submit" type='submit' onClick="remove_XS_whitespace(search);mystring.select();return false" value='search'>
                </form></td>
              </tr>
            </table>
            <br>
          </div></td>
      </tr>
    </table>
    <table border="0" cellspacing="0" cellpadding="0" class="bar">
      <tr> 
        <td><a href='<? echo "$siteurl1"; ?>' class="bar" title="Global Freelancers Home"><? echo "$sitename1"; ?></a> 
          | <a href="howto-suggest-site.html" class="bar" title="How to Suggest a Site">How 
          to Suggest a Site</a> | <a href='<? echo "$siteurl3"; ?>' class="bar" title="Search Global Freelancers"><? echo "$sitename3"; ?></a></td>
        <td><div align="right"><a href='<? echo "$siteurl2"; ?>' class="bar" title="Suggest a Site"><? echo "$sitename2"; ?></a></div></td>
      </tr>
    </table>
    <table border="0" cellspacing="0" cellpadding="0" class="bluebar">
          <tr>
            <td></td>
          </tr>
    </table>
    <BR>
    <table border="0" cellpadding="0" cellspacing="0" class="main">
    <tr>
      <td valign='top' width='100%'>
    And this is the footer:

    Code:
    </td>
    </tr>
    </table>
    
    <table class="copyright"><tr>
          <td align='left'>Copyright © 2004 <a href="http://www.globalfreelancers.com" class="copyright" title="Global Freelancers">Global 
            Freelancers</a></td>
          <td align='right'>Powered By - <a href='http://www3.sympatico.ca/zunic/' target='_blank' class="copyright">Links 
            Caffe</a> Copyright © 2000-2004 gonafish.COM</td>
        </tr></table>
    
    <table border='0' cellpadding='0' cellspacing='0' class="footer">
        <tr>
          <td><div align="center"><a href='about-global-freelancers.html' title="About Global Freelancers" class="footer">About 
              Global Freelancers</a> | <a href='privacy.html' title="Privacy Policy" class="footer">Privacy 
              Policy </a> | <a href='terms.html' title="Terms of Service" class="footer">Terms 
              of Service</a> | <a href='contact.html' title="Contact Global Freelancers" class="footer">Contact 
              Global Freelancers</a></div></td>
        </tr></table>
    </td>
      </tr>
    </table>
    </body></html>
    The php is for the directory.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  4. #4
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Alright... do a test. Save your html file (the one without php) as a php file, but without any php commands. See if that creates the same results.

    BTW, what browser are you using and what version of php?
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  5. #5

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    Hi, just uploaded a php version of the about page: http://www.globalfreelancers.com/abo...reelancers.php
    Worked fine.

    I'm using Firefox, and as far as I know it's PHP 4
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  6. #6

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    I've just tried giving the footer an absolute position in css but that didn't work either. I also tried relative, no joy. I'm starting to pull my hair out here.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  7. #7
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Ok, so the php extension doesn't destroy the CSS. Post a php file on the site with only the following:
    PHP Code:
    <? phpinfo(); ?>
    That will show you what version you are using.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  8. #8
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Ok, wait wait wait.

    You're doing a lot of this:
    PHP Code:
    echo "$varname"
    That isn't going to do anything for you.

    1) Where are these variables being defined?

    2) to echo a var name, you want to do this:
    PHP Code:
    echo $varname
    Putting it in quotes makes it a string, and it won't print out a variable.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  9. #9

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    http://www.globalfreelancers.com/info.php

    I actually bought the php script and have had to make a load of changes already, it was a bit of a mess. Unfortunately I don't know enough about PHP to totally fix it up.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  10. #10
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Ok... well, is there a script that is creating all those variables on the same page as what you're displaying the links in? Otherwise, you're attempting to use global variables, which are not turned on by default in 4.3.2 (your version).
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  11. #11

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    There are three files 1) index.php 2) header.inc.php and 3) paramlinks.inc.php

    I'll attach the files, might be easier.
    Attached Files Attached Files
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  12. #12

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    header
    Attached Files Attached Files
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  13. #13

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    paramlinks
    Attached Files Attached Files
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  14. #14
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Ok, so they're not global vars. Everything is created within the file. Have you tried removing the quotes from the echos to see if that makes any difference? (I don't think it will, but that is still going to give you incorrect output).
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  15. #15
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    the only reason a php file wouldn't render the same as a html file is that the php isn't putting out the same data.

    ober0330: echo "$varname"; and echo $varname; both produce the same result in PHP as does echo '$varname';.... trust me, I do this all the time.

    *slaps GingerNut for using tables to control layout!* - but I nderstand sometimes it's easier.

    GingerNut: You're mixing your eggs here.... use CSS or don't. When you do stuff like htis:
    Code:
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="header">
    All of the attributes in that tag override what's in the CSS. Everytime. All of that needs to be in the CSS (or not, if you don't want it.) If it's a stlying attribute, take it out of the HTML and put it into the appropriate spot in the CSS.

    For the record, I think the footer needs to float to the bottom (sounds odd, but that's how it is.).... maybe this will be of some use: http://www.w3schools.com/css/css_positioning.asp

    TG

    edit: try absolute:bottom; in the footer wrapper CSS definition.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  16. #16

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    Problem solved. I forgot to valign the bar, it should have been <td valign="bottom">

    techgnome, I've been using tables for years and it's hard to move away from them. I really should though. As for the table attributes and css, the site was thrown together rather quickly but I'll clean it up over the weekend.

    Thanks for all the help, next time I'll pay more attention to what I'm doing.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  17. #17
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    ober0330: echo "$varname"; and echo $varname; both produce the same result in PHP as does echo '$varname';.... trust me, I do this all the time.
    "$varname" and $varname are the same (though the first is slower), but '$varname' is not. Stuff inside '' isn't parsed, unlike stuff inside "".
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  18. #18

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    Originally posted by CornedBee
    "$varname" and $varname are the same (though the first is slower), but '$varname' is not. Stuff inside '' isn't parsed, unlike stuff inside "".
    Why doesn't it work the same?
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  19. #19
    Junior Member
    Join Date
    Apr 2004
    Location
    Stockholm, Sweden
    Posts
    29
    PHP Code:
    echo $varname
    That tells the PHP interpreter to print out the contents of $varname. That part should be easy enough to understand.

    PHP Code:
    echo "$varname"
    This will tell the PHP interpreter to 'evaluate the contents of the double-quotes enclosed string and print this out'. Meaning it will print out any text in there, as well as evaluate (print the contents) of any variables contained therein.

    PHP Code:
    echo '$varname'
    This however, tells the PHP interpreter that 'this is a string, print it out literally'.
    So it would print the string $varname, not the contents of $varname.
    If there is a way to solve your problems, there is no need to worry; if there is no way to solve your problems, there is no point to worry.

  20. #20

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    I see, thanks.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  21. #21
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    KTottE also implied the reason why the second is slower than the first. The string has to be parsed in addition to the normal code.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  22. #22
    Junior Member
    Join Date
    Apr 2004
    Location
    Stockholm, Sweden
    Posts
    29
    Yes, and:

    PHP Code:
    echo 'string'
    will be faster than

    PHP Code:
    echo "string"
    But this is only apparent when you're doing large scale echo statements.
    If there is a way to solve your problems, there is no need to worry; if there is no way to solve your problems, there is no point to worry.

Posting Permissions

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



Click Here to Expand Forum to Full Width