#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2001
    Location
    In a multi-cultural mess.
    Posts
    569
    Rep Power
    14

    Question require ("...css") OR <link href="...css" IF hidden directory


    My html pages were at
    /home/rtaylor/public_html/...

    I have recently moved them to
    /home/rtaylor/hidden_html/...

    /home/rtaylor/public_html/search.php4
    now contains a one line "shell"
    require ("../hidden_html/search.php4");

    This works OK if my stylesheet is accessed by
    require ("../hidden_html/com.css");

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

    However, I had been using
    <html><head>
    <link rel="stylesheet" href="com.css" type="text/css">

    When I switched, I tried

    <html><head>
    <link rel="stylesheet" href="../hidden_html/com.css" type="text/css">
    AND
    <link rel="stylesheet" href="html://www.isp.com/rtaylor/hidden_html/com.css" type="text/css">

    I get the 404 error message.
    I guess the browser can not access files outside the "public_html" directory.

    I can use the original line --
    <link rel="stylesheet" href="com.css" type="text/css">
    but it means my source is in 2 places -
    public_html for "com.css" and
    hidden_html for all the rest.

    Or I can use
    require ("../hidden_html/com.css");
    but I don't like it simply because all the style stuff shows via "View source".

    I started with a vague question.
    Now I have 2 options but don't like either.

    Is there a third way?

    Robert
    Robert
    ---
    If it's hard, it's probably wrong.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    New York
    Posts
    122
    Rep Power
    14
    Robert:

    First off, it sounds like any problems could be fixed by changing the permissions on the directory in question - although I think the purpose of a dir named "hidden..." is probably to be be restrictive.

    Secondly, If your html doc and your css doc are both in "hidden_html" (or did I misunderstand you?) why would you reference the css doc like this:

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

    rather than this:

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

    Lastly, I wouldn't worry too much about people snatching your css via view source, if that is your concern. Just how valuable can a stylesheet be?

    Hope this helps.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2001
    Location
    In a multi-cultural mess.
    Posts
    569
    Rep Power
    14
    szarecor,

    You are right on several counts --

    szarecor -- "I think the purpose of "hidden..." is probably to be be restrictive."
    Robert -- Right.
    ---------------
    szarecor -- "your html doc and your css doc are both in "hidden_html"
    Robert -- Right.
    ---------------
    szarecor -- "why would you reference the css doc like this:
    <link rel="stylesheet" href="../hidden_html/com.css" type="text/css">
    Robert -- Since public access starts in "public_html", I had to reference up 1 level,
    then down into "hidden_html". I guess the "pwd" points to "public_html"

    All my stuff is in "hidden_html" so I wanted my "css" stuff there also.
    However, in my ignorance, I didn't realize that a browser, like any stranger,
    can not normally access stuff outside of the "public_html" directory, thus,
    <link href="../hidden_html/com.css"
    can not work. So I switched to
    require ("../hidden_html/com.css");
    at the top of each php page.

    ----------------
    szarecor -- "Lastly, I wouldn't worry too much about people snatching your css
    via view source, if that is your concern. Just how valuable can a stylesheet be? "
    Robert -- Right, mine has no value. I am a rookie at style sheets.
    ( On reflection, they may be a source of personal embarassment )
    Seriously, I view source a lot, and just wanted the style sheet stuff out of sight.
    ---------------

    I guess I will use the include method; then all my source is in one place.

    Thanks for your post,

    Robert
    Robert
    ---
    If it's hard, it's probably wrong.

IMN logo majestic logo threadwatch logo seochat tools logo