0

I've looked at other questions/answers on this and none have seemed to work for me.

I have a PHP file that is loaded via AJAX. In that I have...

include('mods/math/include/geometry_styles.php');

The geometry_styles.php file basically looks like this...

<style>
.proof_ol_outdent {
    position: relative;
    margin-left: -18px; 
}
</style>

The .proof_ol_outdent style is not getting recognized by Firebug (or used, for that matter). I also don't seem to get any PHP errors if I mess with the path of the include(), which seems strange. If I change the include to require though, everything breaks.

However, I think that my path is correct because I have a DEFINES file which I also load using include and it's path is include('mods/math/include/geometry_defines.php');. The defines get loaded and used properly using that path.

I have no idea why this isn't working. Any help would be appreciated.

UPDATE: To answer a couple comment questions....

1.) AJAX is loading table rows that fit into <tbody id="problem_area"> </tbody>.

2.) There is a file called ajax_loading.php which loads the content of a user-specified file by id number. Like this: ajax_loading.php?problem_id=34

3.) If I browse directly to ajax_loading.php?problem_id=34 I don't get the <style></style> tags should be present.

gtilflm
  • 1,389
  • 1
  • 21
  • 51
  • A PHP include is used to include php script code so that it wil be executed as part of the script it is included in. Including a css style will not make that style be passed to the browser. See [tfm](http://php.net/manual/en/function.include.php) – RiggsFolly May 30 '15 at 16:54
  • @RiggsFolly `include` does not require the entire code to be PHP. In fact, only the code wrapped inside a PHP tag will be interpreted as PHP in an include. If the include contains HTML, CSS, or whatever, it will be output. – Alexander O'Mara May 30 '15 at 16:56
  • I deleted my answer, misunderstood your question. So, when you show source code, do you see there ``? If not, and if you change `include` for `require`, do you see any error? Which one? – pavel May 30 '15 at 17:06
  • OP, you say you are using AJAX to load this CSS, but then you are using `include(...)` to output the CSS. This is obviously PHP. Can you show the AJAX code? Also, as @panther asked, are you getting any error messages? If so, please show us that message. When you **include** a file that doesn't exist, you should get an error, but the script will **continue** executing. However, if you **require** a file that doesn't exist, you should get an error and the script should **stop** executing. – Spencer D May 30 '15 at 17:08
  • @panther and Spencer Doak: I've updated my original post which should clarify things. – gtilflm May 30 '15 at 17:15
  • @SpencerDoak: It's really strange, but I don't get a php error when I purposely mess with the `include` path. I don't know if that's part of this or not, but it's definitely not expected behavior. – gtilflm May 30 '15 at 17:18
  • @gtilflm, that is very strange. Are you sure PHP error reporting is enabled? Try adding: `ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(E_ALL);` (taken from [this answer](http://stackoverflow.com/a/21429652/2694511)). – Spencer D May 30 '15 at 17:33
  • include and require don't differ much other than the fact that with require the script stops if it is not found...Make sure the script gets "included" in the rendering of your page. – Daniel May 30 '15 at 17:34

1 Answers1

0

I've found an alternate way to get my CSS included. Therefore I'm closing this thread. My feeling is that since the data is being loaded via AJAX, that's causing some kind of problem. I don't know for sure though.

Thanks to all who commented and tried to help.

gtilflm
  • 1,389
  • 1
  • 21
  • 51