0

I am using FlightPHP for a small simple website. I am using the views and the layouts to render the different web pages:

<?php
    require 'flight/Flight.php';

    Flight::route('/', function(){
        Flight::render('home','body');
        Flight::render('layout');
    });

    Flight::route('/eventos/',function(){
        Flight::render('eventos.php','body');
        Flight::render('layout');
    });

Flight::start();

The Home page renders correctly with all the css and javascript files, but when I click on a link to another webpage it renders it first rendering the view and on the bottom the layout. It renders the view outside the html tag so it renders all wrong. Any ideas? I can't find any example on how use flightphp. I have figured out how to use it by trail and error.

4

1 回答 1

0

That's because you're probably handling css and javascript with relative paths.

Add a trailing slash to the beginning of the css and js includes. It will work that way:

<script src="/assets/js/demo.js"></script>

<link href="/assets/css/demo.min.css" rel="stylesheet">
于 2014-11-23T19:13:19.683 回答