Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript][CSS][PHP]Przyjazne linki - nie widzi plików css i js
stepien
post
Post #1





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 19.07.2015

Ostrzeżenie: (0%)
-----


Witam.

Pisze stronę internetową i mam taki problem

htaccess

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]

Klasa root

<?php

class root {

public $class;
public $action;
public $params;


public function __construct() {

$routParts = explode("/", $_GET['url']);

$this->controller = 'c'.$routParts[0];
$this->action = isset($routParts[1]) ? $routParts[1] : "index";

array_shift($routParts);
array_shift($routParts);

$this->params = $routParts;;
}

public function run(){

$sys = new $this->controller();
$sys->{$this->action}($this->params);
}
}

?>


Linki:


news i news/add

Przy pliku new widziane są jc i css
Natomiast jak klikam news/add to nie dziwidzi js i css.
Jak to rozwiązać ten problem?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
trueblue
post
Post #2





Grupa: Zarejestrowani
Postów: 6 809
Pomógł: 1828
Dołączył: 11.03.2014

Ostrzeżenie: (0%)
-----


Cytat(stepien @ 7.08.2018, 17:07:38 ) *
<a href="news/add">Dodaj</a>

A powinno być

<a href="szkola2/news/add">Dodaj</a>

Dlaczego uważasz, że powinno być, skoro piszesz, że w adresie właśnie jest /szkola2/:

Cytat(stepien @ 7.08.2018, 17:07:38 ) *

?

Stronę uruchamiasz z katalogu /szkola2/, ścieżki masz względne, więc URL jest "sumą" adresu, z którego uruchamiasz i ścieżki względnej.
Tu akurat wszystko jest ok.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 27.12.2025 - 13:29