50 users online (1 members and 49 guests)  


  Results 1 to 11 of 11

Related

  1. Replies: 0
  2. Inserting system calculator    Forum: HTML Forum
    Replies: 0
  3. Replies: 1
  4. Error inserting javascript into php    Forum: PHP Forum
    Replies: 14
  5. Inserting Html    Forum: HTML Forum
    Replies: 3
  1. #1
    msd_luke's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2008
    Location
    cornwall
    Posts
    11

    Exclamation inserting css into php pages?

    hi all,

    i am havig trouble inserting some css into a php page i have created,

    i currently have

    PHP Code:
                    $secIDs[$loopCount] = $hrefStart "=" $db_field['sectionID'] . ">" $db_field['sections'] . $hrefEnd "<BR>" "<div class="forumInfo">" $db_field['info'] . "</div>"
    and as you can see i am trying to apply my class (forumInfo) which is in the stylesheet, to the text which is stored in a varible, but when i display the php page the formatting hasnt happened, and i get an error

    Parse error: syntax error, unexpected T_STRING in C:\wamp\www\andrews site\forumTest.php on line 127

    ive added the stylesheet to the top of the php page

    <link rel="stylesheet" href="stylesheet.css" />


    but no joy, can anyone help please

    cheers

  2. #2
    vinyl-junkie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    721

    Re: inserting css into php pages?

    The error you're getting is due to some sort of syntax problem with your PHP code. When it isn't obvious to me just which statement it is complaining about, I put echo statements in the code until I pinpoint the statement it doesn't like, then look at the code very closely to see if I can tell what the problem is.

    If doing this still doesn't help, post all of your code, and highlight line 127 so we'll have something to go on and can try to help you further.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more

  3. #3
    msd_luke's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2008
    Location
    cornwall
    Posts
    11

    Re: inserting css into php pages?

    hi thanks for your reply, the error only occured after i inseted the "<div class="forumInfo">" </div>

    to this:

    PHP Code:
        $secIDs[$loopCount] = $hrefStart "=" $db_field['sectionID'] . ">" $db_field['sections'] . $hrefEnd "<BR>" "<div class="forumInfo">" $db_field['info'] . "</div>"
    everything was working fine, i just wanted to change the font colour/style etc so i tried to insert the css in to the above code, to do that but cant seem to do it.

    the line of the php code above is line 127 so its something to do with the css code within that code thats causing the problem.

    is the css sintax right?
    cheers

  4. #4
    vinyl-junkie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    721

    Re: inserting css into php pages?

    Change this part of your code:

    Code:
    "<div class="forumInfo">"
    to this:

    Code:
    '<div class="forumInfo">'
    That should correct the problem.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more

  5. #5
    msd_luke's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2008
    Location
    cornwall
    Posts
    11

    Re: inserting css into php pages?

    Quote Originally Posted by vinyl-junkie View Post
    Change this part of your code:

    Code:
    "<div class="forumInfo">"
    to this:

    Code:
    '<div class="forumInfo">'
    That should correct the problem.
    unfortunatly it didn't didnt recieve any error but the text didnt change either

    if i insert this:

    PHP Code:
                    $secIDs[$loopCount] = $hrefStart "=" $db_field['sectionID'] . ">" $db_field['sections'] . $hrefEnd "<BR>" "<h6>" $db_field['info'] . "</h6>"
    <h6> then it works, as does <h1>....<h5> but why wont one of my styles in a stylesheet

    cheers

  6. #6
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: inserting css into php pages?

    Looks like the problem is in your CSS code then. Check the HTML code on the rendered page and make sure it looks right. Then post the relative CSS code here.

  7. #7
    msd_luke's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2008
    Location
    cornwall
    Posts
    11

    Re: inserting css into php pages?

    ive run the php page in my local host and it looks ok but the font is not formatted as i want

    the css code i have used in my stylesheet.css is


    #forumInfo {
    font-family:Tahoma;
    font-size:8px;
    color:#FF0000;
    }


    and on my signup.php ive got:

    <link rel="stylesheet" href="stylesheet.css" type="text/css" />

    to "attach" the stylesheet

    hope this helps
    cheers

  8. #8
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: inserting css into php pages?

    First things first, you need to have multiple fonts listed in the event that the person visiting your site does not have the font you list installed. For example, this site uses the following:
    Code:
    font-family: tahoma, verdana, geneva, lucida, 'lucida grande', helvetica, sans-serif;
    I think that many is a little overkill, but you should at least include sans-serif or arial. Making that change may fix (or at least help) your font formatting.

    Most importantly, though you are using the wrong symbol in your CSS. Change it from: #forumInfo to: .forumInfo

    That change alone should resolve your primary issue.

  9. #9
    msd_luke's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2008
    Location
    cornwall
    Posts
    11

    Re: inserting css into php pages?

    thanks for your reply jthayne, so thats why there is often a list of fonts i usually delete them all apart from 1 basically because i didnt know why they were there... oops lol

    ive changed the # to a . but it didnt make any difference, im currently validating my page and that will hopefully sort things out

    cheers
    Luke

  10. #10
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: inserting css into php pages?

    The reason I had you change the # to a . is because the # refers to an id while the . refers to a class. You do need to be careful about using them as an id can only be used once on a page, and has a higher priority than classes.

    Validating your page nearly always helps too.

  11. #11
    msd_luke's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2008
    Location
    cornwall
    Posts
    11

    Re: inserting css into php pages?

    cheers jthayne, i was aware of the two differences but couldnt remember which was which

    cheers



Tags for this Thread