Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Dynamiczne ścieżki do plików
Cliassi
post
Post #1





Grupa: Zarejestrowani
Postów: 142
Pomógł: 0
Dołączył: 29.04.2012

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


Witam,

Posiadam serwis zrobiony z rewrite'ami a index.php ma częściowo taki kod:

  1. $arrParams = array();
  2. $strDefaultPath = '/';
  3.  
  4.  
  5. $_SERVER['REQUEST_URI'] = isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : $strDefaultPath;
  6.  
  7. $arrParams =explode( '/', substr( $_SERVER['REQUEST_URI'], 1) );


moj problem polega na tym, że gdy wejdę na example.com/product/klawiatura_usb to wtedy linki do css(o dziwo się ładują) a js nie. mam ustawiony base url a gdy sprawdzam scieżkę do js to wychodzi example.com/product/js/plik_js.js

Wie ktoś jak dynamicznie generować scieżkę ?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
mis
post
Post #2





Grupa: Zarejestrowani
Postów: 71
Pomógł: 2
Dołączył: 25.04.2010

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


pokaż jak wczytujesz te pliki *.js oraz .htaccess
Go to the top of the page
+Quote Post
Cliassi
post
Post #3





Grupa: Zarejestrowani
Postów: 142
Pomógł: 0
Dołączył: 29.04.2012

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


struktura plików:

/view
/includes
/class


index.php (/view/index.php)

  1. include_once('layout/header.php');



header.php (/view/layout/header.php)
  1. <base href="http://eample.com/">
  2.  
  3. <!-- Stylesheets -->
  4. <link href="style/bootstrap.css" rel="stylesheet">
  5. <link rel="stylesheet" href="style/font-awesome.css">
  6. <link href="style/prettyPhoto.css" rel="stylesheet">
  7. <!-- Parallax slider -->
  8. <link rel="stylesheet" href="style/slider.css">
  9. <!-- Flexslider -->
  10. <link rel="stylesheet" href="style/flexslider.css">
  11.  
  12. <link href="style/style.css" rel="stylesheet">
  13.  
  14. <!-- Colors - Orange, Purple, Light Blue (lblue), Red, Green and Blue -->
  15. <link href="style/black.css" rel="stylesheet">
  16.  
  17. <script type="text/javascript" src="layout/whcookies.js"></script>



footer.php (/view/layout/footer.php)
  1. <!-- JS -->
  2. <script src="js/jquery.js"></script>
  3. <script src="js/bootstrap.js"></script>
  4. <script src="js/jquery.isotope.js"></script> <!-- Isotope for gallery -->
  5. <script src="js/jquery.prettyPhoto.js"></script> <!-- prettyPhoto for images -->
  6. <script src="js/jquery.cslider.js"></script> <!-- Parallax slider -->
  7. <script src="js/modernizr.custom.28468.js"></script>
  8. <script src="js/filter.js"></script> <!-- Filter for support page -->
  9. <script src="js/cycle.js"></script> <!-- Cycle slider -->
  10. <script src="js/jquery.flexslider-min.js"></script> <!-- Flex slider -->
  11.  
  12. <script src="js/easing.js"></script> <!-- Easing -->
  13. <script src="js/custom.js"></script>
  14. </body>
  15. </html>


Ten post edytował Cliassi 18.12.2013, 23:37:32
Go to the top of the page
+Quote Post
mis
post
Post #4





Grupa: Zarejestrowani
Postów: 71
Pomógł: 2
Dołączył: 25.04.2010

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


daj / przed każdym js:
  1. <script src="/js/custom.js"></script>
Go to the top of the page
+Quote Post

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: 24.08.2025 - 00:59