Dynamic CSS/JS Files Not Working |
[eluser]Bluemill Media[/eluser]
Hi Everybody, I'm working on a dropship ecommerce platform, and have a section of the site where I need to enable members to create templates for their stores. I'm using Smarty to parse template data. Also, because of the way my software is setup, I'm using controllers and views to dynamically generate CSS, JS, Images, etc. However, firebug reports all of my external files as 404s, and none of my styles or scripts are applied/executed, but I can access my CSS and JS files directly with no problem. Here is my htaccess: Code: RewriteEngine on My Controller: Code: <?php home.tpl (Main view file) Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> main.css Code: body { Firebug Header Info: Code: Response Headers Any help is greatly appreciated. (Please let me know if you need more information, and what exactly you need.)
[eluser]Bluemill Media[/eluser]
Hey all, I still haven't had any luck figuring this out. It's getting pretty 'hot' over here, so I figured I'd bump the thread. Anybody got anything?
[eluser]Randy Casburn[/eluser]
Hi Blue -- Here something to start with... In your constructor function the first thing I noticed was the global keywork...(yuck) but I'll get over that ;-) Code: global $wpdb, $UserTools, $StoreTools; Then later it dawned on me that in the index method you're attempting to use $StoreTools in on Object construct... Code: $StoreInfo = $this->StoreTools->store_info_slug($StoreSlug); If this is truly a PHP object, you'll need to either grab and instance of it or clone it before you can call it's methods. Check out the HTML source of the page and you may see the PHP error there. Also, turn on logging in CI while you're developing and dump the logs. That's helpful too. I hope this get's you started or at least is a little helpful. Randy
[eluser]Bluemill Media[/eluser]
Thanks Randy I'm actually grabbing the instance of the $StoreTools object elsewhere in the project (From outside of CodeIgniter...I know, ugh...but there is a method to my madness ). I can access and use the methods from the object just fine...the problem is that my external files aren't being applied. So, this leads me to believe that the problem is either somewhere in my .htaccess or in relation to caching. The former seems to be supported by the fact that I'm able to get the files to work great if I reference them directly (i.e. /system/app-shop/views/Red/styles/main.css)...with the Dynamic option (/shop/lorren/styles/main.css) firebug gives me a 404 error in the net panel. The problem there is I need the app to appear to provide host-level domain functionality.
[eluser]Randy Casburn[/eluser]
I just helped someone else through a similar problem with dynamic images. As it turned out, each time that person undid their tweaks to CI (read custom code) everything worked perfectly. Do you have any customizations in the Core? Are there any other "things" that are working inconsistently? Not sanely? That seem remotely related? Do all the controllers work normally given you .htaccess configuration, etc. Grasping at straws. The only thing the CI Loader class does when it loads up the View file to serve it up is ensure that it exists. If it doesn't, it invokes the exception handler and posts a nasty message saying the file could not be found. Have you checked your CI log files? Randy
[eluser]Bluemill Media[/eluser]
I actually haven't thought to check the log files yet... Go figure, lol...that's clumsy me. Anyhow, I'm heading out for the night but will post back more tomorrow after I've done that. (Don't want to leave you hanging.) Thanks again! P.S. Yes, everything else is working great. And no, I don't have any mods to the core...just simple mods to some error files to display more user friendly messages and the smarty library add-on.
[eluser]Randy Casburn[/eluser]
[quote author="Bluemill Media" date="1217318768"]Thanks Randy The former seems to be supported by the fact that I'm able to get the files to work great if I reference them directly (i.e. /system/app-shop/views/Red/styles/main.css)...with the Dynamic option (/shop/lorren/styles/main.css) firebug gives me a 404 error in the net panel. The problem there is I need the app to appear to provide host-level domain functionality.[/quote] duh...this just dawned on me. Something was bugging me about this paragraph and I couldn't pinpoint what it was. You're examples that work and don't work are both relying on the URI class while your application is relying on URL parameters and $_GET retrievals. Perhaps you should investigate that inconsistency. Maybe that will help you track it down more quickly with the help of the log files. Randy
[eluser]Bluemill Media[/eluser]
Hey Randy, Sorry, been busy for a few days. Anyhow, neither example (working or non-working) is relying on the URI class. In fact, I've set CI to use QueryStrings and am using mod_rewrite for the pretty URLs. (I think this is more efficient) - /system/app-shop/views/Red/styles/main.css - is an absolute path to the physical file - /shop/lorren/styles/main.css - is using basic mod_rewrite (included in my first post) Anyhow, thanks for your help! I'm still working on this, and I'll post back here as I figure things out.
[eluser]Randy Casburn[/eluser]
[quote author="Bluemill Media" date="1217480320"] - /system/app-shop/views/Red/styles/main.css - is an absolute path to the physical file - /shop/lorren/styles/main.css - is using basic mod_rewrite (included in my first post) [/quote] Yea I knew you were using Query strings, that was quite evident. I misunderstood what you meant by "access them directly" then. Thanks for clarifying.That really had me perplexed. So by "access them them directly" means this works: <link href="/shop/{$StoreInfo.Slug}/styles/main.css" rel="stylesheet" type="text/css" /> and this doesn't: $this->load->view($Theme->Name.'/styles/'.$_GET['i']); give a url such as http://dev.petecommerce.com/index.php?c=...i=main.css Right? Randy
[eluser]Bluemill Media[/eluser]
This does not work: <link href="/shop/{$StoreInfo.Slug}/styles/main.css" rel="stylesheet" type="text/css" /> This does work: <link href="/system/app-shop/Red/styles/main.css" rel="stylesheet" type="text/css" /> (Please note that {$StoreInfo.Slug} outputs as the name of the user, e.g. 'lorren'. Regarding the query based URL, I've tried that during debugging and it didn't give me a solution. Also, keep in mind that these URLs are going to be used by store owners/template designers, so the URLs need to be pretty and user-friendly. Also, it's important to note that in using the developer toolbar I can 'CSS > View CSS' and it takes me directly to the stylesheet with all styles displayed, but they're just not being applied. Simplified: I'm pointing to the correct file with every URL type...the browser just isn't reading the styles in the file through...to make matters even more odd, Firebug reports the pages as 404s in the NET panel... I'm at a total loss. |
Welcome Guest, Not a member yet? Register Sign In |