Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
routing htaccess issue (with javascript)
  • Hi, I seem to be having a weird bug. I have a template controller which is extended by a common controller (for authentication purposes).
    I created a home controller extended by the common controller.
    The view for home/index is a simple holder for the javascript SVG.
    I also have a htaccess which removes the index (also configured in the config file).
    and I redirected my root to home/index (routing.php). So now I can access my page using 3 different urls (actually more, I know):
    domain.com/
    domain.com/home
    domain.com/index.php/home for some reason the SVG javascript only works in the last url (when including the index.php). Not in the first 2. To see the result check:
    http://www.scripttesting.com/mindmapping/ (home/, index.php/home/)
  • Have you updated your config.php? Set your "base_url" to null, and "index_file" to false if you have a standard install and use a rewrite rule to remove your index.php from the URI.
  • This is my htaccess:
    <IfModule mod_rewrite.c>
        RewriteEngine on
    
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
    
        RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>
    

    my base url is set to null
    and index is set to false. but still the javascript doesnt seem to be called. fyi I'm using fuelphp 1.3 (if of any help)
  • FuelPHP doesn't do anything with javascript. So what is exactly the problem? Is your .js file not loaded? Is it loaded but it doesn't do what it should? What's in your view?
  • Well the problem is that my javascript works as intended when navigating to: http://scripttesting.com/mindmapping/index.php/home but not when I go to http://scripttesting.com/mindmapping/home
  • I understand that. But I'm not a psychic, I don't know what it's supposed to do, and what is "intended". Can you post your view and javascript code on http://scrp.at and tell us what it should do?
  • Im not sure what you mean by "I don't know what it's supposed to do". I added the working links in my previous posts.
    I might understand your statements wrong :) Its should generate the SVG as seen here:
    http://scripttesting.com/mindmapping/index.php/home But this is my 'home' view:
    http://scrp.at/bSV and here is my partial head code from the template:
    http://scrp.at/bSW So as you might have noticed, it doesnt work when i remove the index.php
  • If I load http://scripttesting.com/mindmapping/home with firebug open, the logs fills rapidly with messages like "NetworkError: 404 Not Found - http://scripttesting.com/assets/js/graphiti/src/shape/icon/Picker.js" I assume this is because the 'mindmapping' is missing from these URI's, which in turn means you're rewrite rules are wrong. I futher assume you have installed Fuel in it's entirely in your webservers docroot, and renamed 'public' to 'mindmapping'? Without special rewrite tricks your base_url does not contain the 'mindmapping' foldername, causing this issue. If you request using index.php in the URL, you're rewrite rules are bypassed and you don't have this error. Here are some tips on how you can get this non-standard setup to work properly.
  • Okay my bad... Sorry bout my attitude but found the issue. Apparently the path I gave to the graphitiPath was wrong.
    [removed]var graphitiPath = "../assets/js/graphiti/";[removed]
    

    doesnt seem to work cause of '../'
    So I changed it to
    [removed]var graphitiPath = "<?php echo Uri::create('assets/js/graphiti/'); ?>";[removed]
    

    The problem is also that my website resides in a subfolder on my test url. So when I get a decent url for my project I'll be checking more into the placement of my fuel/public folder. Thanks yet again! Regards

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion