Skocz do zawartości
Hosting webh.pl - 20%

Własny content

Rekomendowane odpowiedzi

  • Odpowiedzi 132
  • Wyświetleń 33,3 tys.
  • Dodano
  • Ostatnia odpowiedź

Najlepsi użytkownicy w tym temacie

Popularne posty

  • RewriteEngine on RewriteRule ^bashu.html$ index.php?app=core&module=global&section=page

  • Dobra, bardzo proste.. Link do strony www.adresforum.pl/index.php?app=core&module=global&section=page ( można zmienić przy pomocy mod rewrite na przyjaźniejszą wersję ) Plik admin.zip Myś

  • Spróbuj takim ifem: <if test="$this->request['section']=='page'"> aktywna klasa </if> Tak, możesz zmienić section=page, ale potem również w nazwie klasy też to zmienić.

  • 1 miesiąc temu...
Opublikowano

No to mam problem, wgrałem plik lecz pod adresem

/index.php?app=core&module=global&section=page

Jest pusta biała strona.

ipbaddons.com

Opublikowano

Dlatego że kiedy Dawid udostępnił ten kod, prototyp metody sendOutput() był inny.

 

Zamień:

$this->registry->getClass('output')->sendOutput( array( 'TITLE' => $this->page_title, 'JS' => 0, 'NAV' => $this->nav ) );

Na:

$this->registry->getClass('output')->sendOutput();
Opublikowano

Proszę o pomoc. 

Nie pokazuje mi strony.

 

 
<?php
 
//-----------------------------------------------
// (DP30) Custom Page
//-----------------------------------------------
//-----------------------------------------------
// Application
//-----------------------------------------------
// Author: DawPi
// Site: http://www.ipslink.pl/
// Written on: 04 / 02 / 2010
//-----------------------------------------------
// Copyright (C) 2010 DawPi
// All Rights Reserved
//-----------------------------------------------  
 
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
 
class public_core_global_page extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry ) 
{
/* Make object */
$this->registry   =  $registry;
$this->DB         =  $this->registry->DB();
$this->settings   =& $this->registry->fetchSettings();
$this->request    =& $this->registry->fetchRequest();
$this->lang       =  $this->registry->getClass('class_localization');
$this->member     =  $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache      =  $this->registry->cache();
$this->caches     =& $this->registry->cache()->fetchCaches();
 
     //-----------------------------------------
     // What to do?
     //-----------------------------------------
     
     switch( $this->request['do'] )
     {
default:
$this->showPage();
     }
     
     //-----------------------------------------
     // If we have any HTML to print, do so...
     //-----------------------------------------
     
     $this->output .= "<div id='board_footer'><p id='copyright'>Powered by (DP30) Custom Page © ".date('Y')."  <a target='_blank' href='http://www.forum.invisionize.pl/'>DawPi</a></p></div>";
     
     $this->registry->getClass('output')->addContent( $this->output );
        
$this->registry->getClass('output')->sendOutput();
  }
  
/**
* Show custom page
*
* @access public
* @return string HTML Page
*/
  public function showPage()
  {
/* Set title */
 
$this->registry->output->setTitle( 'Custom Page by DawPi' );
 
/* Set navigation */
 
$this->registry->output->addNavigation( 'Nazwa strony w nawigacji', '' ); 
 
/* Add content */
 
$this->output = 'To jest treść testowej strony';
}
} // End of class
Opublikowano

Plik kodowany w UTF-8 bez BOM? Usuń ten pusty znak przed <?php.

 

 

Z tego co widze plik kodowany jest przez UTF-8

A nie wiem o jaki znak ci chodzi.

 

Czy możesz poprawić kod i wstawić poprawny w spoiler?

Byłbym bardzo wdzięczny.

Opublikowano

Zmieniłeś ?

class public_core_global_page extends ipsCommand

 

na

class public_core_global_bany extends ipsCommand

 

ipbaddons.com

Opublikowano

Mam kolejny problem 

bo jak dodaje swój kod to wywala mi błąd serwera.

 

 

<?php
 
//-----------------------------------------------
// (DP30) Custom Page
//-----------------------------------------------
//-----------------------------------------------
// Application
//-----------------------------------------------
// Author: DawPi
// Site: http://www.ipslink.pl/
// Written on: 04 / 02 / 2010
//-----------------------------------------------
// Copyright (C) 2010 DawPi
// All Rights Reserved
//-----------------------------------------------  
 
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make 
 
sure you upgraded all the relevant files.";
exit();
}
 
class public_core_global_bany extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry ) 
{
/* Make object */
$this->registry   =  $registry;
$this->DB         =  $this->registry->DB();
$this->settings   =& $this->registry->fetchSettings();
$this->request    =& $this->registry->fetchRequest();
$this->lang       =  $this->registry->getClass('class_localization');
$this->member     =  $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache      =  $this->registry->cache();
$this->caches     =& $this->registry->cache()->fetchCaches();
 
     //-----------------------------------------
     // What to do?
     //-----------------------------------------
     
     switch( $this->request['do'] )
     {
default:
$this->showPage();
     }
     
     //-----------------------------------------
     // If we have any HTML to print, do so...
     //-----------------------------------------
     
     $this->output .= "<div id='board_footer'><p id='copyright'>Powered by (DP30) Custom Page © ".date
 
('Y')."  <a target='_blank' href='http://www.forum.invisionize.pl/'>DawPi</a></p></div>";
     
     $this->registry->getClass('output')->addContent( $this->output );
        
$this->registry->getClass('output')->sendOutput();
  }
  
/**
* Show custom page
*
* @access public
* @return string HTML Page
*/
  public function showPage()
  {
/* Set title */
 
$this->registry->output->setTitle( 'FullGaming.pl - Lista banów' );
 
/* Set navigation */
 
$this->registry->output->addNavigation( 'BANY', '' ); 
 
/* Add content */
 
$this->output = '<?php
 
$link = mysql_connect('localhost','**********','*****');
if (!$link) {
        die('Could not connect to MySQL: ' . mysql_error());
}
 
$db_selected = mysql_select_db('****', $link);
 
$result_players = mysql_query("SELECT count(*) as liczba_zarejestrowanych FROM fg_Players");
$row_players = mysql_fetch_assoc($result_players);
 
$result_stats = mysql_query ("SELECT ovalue FROM fg_stats");
 
$array_stats = array();
$countrow=0;
while ($row_stats = mysql_fetch_array($result_stats)) {
        $array_stats[$countrow++]=$row_stats;
}
       
?>
<center> 
<b>Ogolnie:</b>
<br> Zarejestrowanych graczy na serwerze:
<?php echo $row_players['liczba_zarejestrowanych']; ?>
<?php  
echo "<br> Rekord graczy: " . $array_stats[0]['ovalue'] . "<br>";      
echo "Wejść na serwer: " . $array_stats[2]['ovalue'] . "<br>";
echo "Rozdanych kickow: " . $array_stats[3]['ovalue'] . "<br>";
echo "Rozdanych banow: " . $array_stats[4]['ovalue'] . "<br>";
echo "Wszystkich zabić: " . $array_stats[5]['ovalue'] . "<br>";
echo "Wszystkich śmierci: " . $array_stats[6]['ovalue'] . "<br>";
echo "Wszystkich samobójstw: " . $array_stats[7]['ovalue'] . "<br>";
?>
<br>
<br>
<br>
<b>Ilość graczy</b><br> <img src="http://www.game-state.eu/185.5.96.218:7777/stats.png"/> </center>';
}
} // End of class

Opublikowano

Czas się poduczyć podstaw.

  • Nie łącz się ponownie z bazą danych, użyj do tego API IPB.
  • Nie używaj echo tylko return.
  • HTML powinien być w szablonach, tam gdzie jego miejsce a nie pomieszany z PHP (dosłownie pomieszany!).
  • Przypisujesz do $this->output kod PHP, zdradzisz tajemnicę takiego działania?

Jeżeli sądziłeś że samo kopiuj/wklej będzie działać - MYLIŁEŚ SIĘ.

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Ostatnio przeglądający 0

  • Brak zarejestrowanych użytkowników przeglądających tę stronę.

Konto

Nawigacja

Szukaj

Szukaj

Skonfiguruj powiadomienia push w przeglądarce

Chrome (Android)
  1. Stuknij ikonę kłódki obok paska adresu.
  2. Stuknij Uprawnienia → Powiadomienia.
  3. Dostosuj swoje ustawienie.
Chrome (Komputer)
  1. Kliknij ikonę kłódki na pasku adresu.
  2. Wybierz Ustawienia witryny.
  3. Znajdź Powiadomienia i dostosuj swoje ustawienie.