SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2011
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Link header: syntax question

    Hello,


    PHP Code:
    <?php header('Link: <'.getPath('css').'some/more/stuff'.$var.'style.css>;rel=stylesheet'); ?>
    Doesn't work... I tried with double quotes, no success. How would you do it?



    On a related note: can you include .js files using header()?

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,095
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    the header function is for sending HTTP headers, not for HTML headers

    PHP Code:
    <link rel="stylesheet" type="text/css" href="<?php echo getPath('css'); ?>some/more/stuff<?php echo $var?>style.css">
    (or /> instead of > at the end if you want XHMTL)
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2011
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can replace HTML headers with HTTP headers for .css files.

    My only problem is with the syntax.

  4. #4
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,095
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by rhgiant View Post
    You can replace HTML headers with HTTP headers for .css files.

    My only problem is with the syntax.
    Wait, what? Are you sure about that? I've never heard about it, and google doesn't show much useful info either.

    I do know that you can use the header function to let a PHP file act as though it's a CSS file, but that's something else
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy


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
  •