Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Odnoszenie się do instancji obiektu w includowanym pliku
kyez
post 2.01.2015, 20:39:29
Post #1





Grupa: Zarejestrowani
Postów: 48
Pomógł: 0
Dołączył: 6.09.2011

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


Witajcie,

mam taki problem, jest sobie plik index.php w którym tworzę sobie obiekt $db i na nim wykonuję opercje bazodanowe.
zaraz pod nim includowany jest plik header.php w którym jest odwołanie do obiektu $db, no i to niestety nie trybi.

index.php
  1. <?php
  2. require_once "../init.php";
  3. require_once "../core/config.php";
  4.  
  5. $modules = new modules();
  6. $db = new db($configs['db_user'], $configs['db_pass'], $configs['db_server'], $configs['db_name']);
  7.  
  8. $modules->getHeader();
  9. $modules->getAdminHeader();
  10. $offers = $db->getAllOffers();
  11.  
  12. ?>



header.php
  1. <meta charset="UTF-8">
  2. <title><?php $db->getTitle();?></title>
  3. <link rel="stylesheet" type="text/css" href="">
  4. <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
  5. <!-- Latest compiled and minified CSS -->
  6. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
  7. <link rel="stylesheet" href="../css/dashboard.css">
  8. <!-- Optional theme -->
  9. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
  10.  
  11. <!-- Latest compiled and minified JavaScript -->
  12. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
  13.  
  14. function toggle(obj, e)
  15. {
  16. var elems = e.split(",");
  17. for(i=0;elems[i];i++)
  18. document.getElementById(elems[i]).style.display = (obj.checked==true)? 'block':'none';
  19. }
  20. </script>
  21.  
  22.  
  23. </head>
  24.  
  25.  


Dzięki i pozdrawiam.

Ten post edytował kyez 2.01.2015, 20:42:26
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 22.06.2025 - 23:57