LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 11-21-2008, 06:51 PM   #1
Russianspi
LQ Newbie
 
Registered: May 2007
Posts: 19

Rep: Reputation: 2
Apache2 includes directive for images, css, and js


Hi. So, I feel like I've been banging my head against a wall for the last few days, so I'll ask for some help. I have a whole mess of php based reports that I am trying to organize. These reports live on an apache2 server. There were originally 5 reports for some basic sales data for the company I work for. Well, 5 turned into 6, and the 12, and before I knew it (a year and a half later) there are hundreds of reports. Many of them share large bits of code, and quite a few of them are just duplicates of each other. Many others are outdated and no longer used. Along the way, we've started using a javascript calendar, company logos, css, etc. The trouble is, many of these are duplicated as well.

I have created a new virtual host, and I want to keep from duplicating content. I made directories for outside libraries (like my js calendar), includes (for my php bits that I want to keep from duplicating), images, and css. My goal is that my "reporting suite" be maintainable and portable (with as few changes as possible).

To cut my story down, I'll skip to the part where I created a php_value include_path "/path/to/application" in my virtualhost directive. My php include files load up fine relative to my include_path, html code in those files referencing javascript, css, and images all ignore this path. So, I wind up with broken images, no css, and no js? Is there a way to make all of this work?
 
Old 11-23-2008, 06:41 AM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
As far as I know images, css and js should be accessible by the browser (client) and therefore they should be in (a subdirectory of) the document root.
 
Old 11-24-2008, 11:50 AM   #3
Russianspi
LQ Newbie
 
Registered: May 2007
Posts: 19

Original Poster
Rep: Reputation: 2
Clarification

I realized after posting this (and seeing your reply) that this needs a little clarification from me. When my included php references js, css, and images, it seems to reference them relative to the main page (the one calling the included file). This doesn't work for me, because I need to be able to use these included files from anywhere in my "application". I can't seem to make fully qualified paths work for js/css (particularly css images). Am I missing something?
 
Old 11-24-2008, 11:06 PM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Use an absolute path in your pages

Code:
<head>
<title>Command Centre Incident Logging System - login</title>
<link rel="stylesheet" href="/css/btd2.css" type="text/css">
<link rel="stylesheet" href="/css/menu.css" type="text/css">
<script language="javascript" type="text/javascript" src="/js/datetimepicker.js"></script>
</head>
So your web structure will look something like:
Code:
http://reports
          |
          +----report1.php
          +----report2.php
          |
          +----css
          |     +----btd2.css
          |     +----menu.css
          |
          +----js
          |      +----datetimepicker.js
          |
          +----images
                +----image1.png
                +----image2.png
 
Old 11-25-2008, 02:30 PM   #5
Russianspi
LQ Newbie
 
Registered: May 2007
Posts: 19

Original Poster
Rep: Reputation: 2
Wow. Wim, that did it. I'm bummed I wasted a few days on a couple of leading slashes, but it's done. Thanks so much! You're a lifesaver. We can mark this one solved.
 
Old 11-25-2008, 09:39 PM   #6
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Glad I could help.

You can mark the thread as solved using tags (e.g. in your opening post)

WimS
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LQ Wiki Needs CSS Adjustment (includes detailed solution) ethridgela LQ Suggestions & Feedback 2 10-17-2008 02:00 PM
images and CSS rblampain General 2 02-28-2007 03:27 AM
How do CSS images load? MicahCarrick Programming 2 01-11-2007 12:37 PM
Universal webfile that includes images? everest Linux - Software 2 03-29-2006 11:45 AM
[SVN+Apache2] SVNParentPath directive Creak Linux - Software 2 07-05-2005 01:16 AM


All times are GMT -5. The time now is 05:17 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration