Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Index.php - temat wielokrotnie wałkowany
post 16.05.2004, 11:32:12
Post #1





Grupa:
Postów: 0
Pomógł:
Dołączył: --

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


Chciałbym, abyście przedstawili w tym temacie swoj kod php pliku index.php. Nie jest to nic nadzwyczajnego, gdyz kazdy index.php wyglada podobnie (kilka, kilkanascie linijek kodu), ale poczatkujacym takim jak ja zapewne ulatwi to poczatki. Komentarz mile widziany, z gory dziekuje!
Go to the top of the page
+Quote Post
Liko
post 16.05.2004, 11:36:18
Post #2





Grupa: Zarejestrowani
Postów: 436
Pomógł: 6
Dołączył: 8.11.2003
Skąd: Szczecin

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


yyy ? Chyba zartujesz. Jak mamy Ci przedstawić plik index.php ? Ja np. użuywam obiektów i się wogóle nie połapiesz. Co wogolę masz na myśli pisząc, że "Wszystkie index.php wyglądają podobnie" ? Tu się mylisz, ponieważ u każdego index.php przeważnie różni się i to bardzo. Podaj co chcesz to Ci wtedy napiszemy kod, pomożemy, opiszemy i wytłumaczymy.
Go to the top of the page
+Quote Post
cichy
post 16.05.2004, 11:36:55
Post #3





Grupa: Przyjaciele php.pl
Postów: 197
Pomógł: 0
Dołączył: 9.09.2003
Skąd: z Marsa

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


Jak dla mnie bezsensowny wątek.
Przecież każdy inaczej tworzy skrypty i u jednego w tym pliku może być cały kod a u drugiego może być tylko ładowanie innych plików.
I co mam wkleić 1000-2000 linii kodu żebyś zobaczył jak index wygląda?
Zastanów sie troche nad tym.

Pozdro
Go to the top of the page
+Quote Post
Chewolf
post 16.05.2004, 11:38:09
Post #4





Grupa: Zarejestrowani
Postów: 335
Pomógł: 0
Dołączył: 15.11.2003

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


Witay,
zapoznaj się z funkcją o nazwie : SZUKAJ
i wejdz na :
http://www.kess.snug.pl/artykuly.php3?show=4
http://www.kess.snug.pl/artykuly.php3?show=5
Temat do zamknięcia.
Go to the top of the page
+Quote Post
post 16.05.2004, 11:43:02
Post #5





Grupa:
Postów: 0
Pomógł:
Dołączył: --

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


Spokojnie, Simpson.

Mialem nadzieje, ze ktorys z uzytkownikow wytlumaczy jak najefektywniej rozplanowac plik index.php (a przeciez wiadomo, ze plik z kilka tysiecy linijek kodu mija sie z celem). Po prostu w pewnym momencie, poczatkujacy dochodza do wniosku, ze samo include menu nie wystarcza. Artykuly z phpflash tez juz powoli nie wystarczaja, ale zarazem pisanie obiektowe jest za trudne - trzeba to jakos pogodzic. Wiec moje pytanie: jak rozplanowac index.php ktory mialby wbudowane:
- obsluge linkow index.php?co=as (to akurat najmniejszy problem)
- pobieranie poszczegolnych modulow
- pobieranie stalych (logo, stopka itp)
- obsluga sesji na kazdej podstronie
- no i inne ciekawe elementy, ktore wy bardziej doswiadczeni programisci moglibyscie zaproponowac:) Mam nadzieje, ze juz sie rozumiemy.
Go to the top of the page
+Quote Post
cichy
post 16.05.2004, 11:43:39
Post #6





Grupa: Przyjaciele php.pl
Postów: 197
Pomógł: 0
Dołączył: 9.09.2003
Skąd: z Marsa

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


Przed zamknięciem dodam tylko tyle jeszcze:
Wejdź na http://www.hotscripts.com/php/Scripts_and_...rams/index.html
sciągnij wszsytkie skrypty jakie są dostępne i będziesz miał duuuużo plikow index.php do pooglądania winksmiley.jpg (a w niektóych może znajdziesz i komentarze)

Pozdro

PS. po krótkim namyśle doszedlem do wniosku że wkleje CI mój index.php

[php:1:e9ca87f43c]<?php

error_reporting(E_ALL);
Header("Content-type: text/html; charset=iso-8859-2");

require_once( './config.php' );
require_once( './engine/core'. phpExt );
require_once( './engine/input'. phpExt );
require_once( './engine/template'. phpExt );
require_once( './engine/time'. phpExt );
require_once( './engine/modules'. phpExt );
require_once( './engine/blocks'. phpExt );
require_once( './engine/permission'. phpExt );
require_once( './engine/session'. phpExt );
require_once( './db/'. DB_TYPE . phpExt );
require_once( './includes/functions.inc'. phpExt );
require_once( './includes/session_functions.inc'. phpExt );

$time = new time;
$time->start_timer();

$core = new core;
$core->proceed();
$core->session->SaveSess();

$time->end_timer();

?>[/php:1:e9ca87f43c]
Go to the top of the page
+Quote Post
party
post 16.05.2004, 11:51:13
Post #7





Grupa: Zarejestrowani
Postów: 131
Pomógł: 0
Dołączył: 19.08.2003
Skąd: Bydgoszcz

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


[php:1:f838806cd6]
<?php
define( 'IN_SCRIPT', 1 );

require_once( 'inc/classMain.php' );
require_once( 'inc/classOthers.php' );

$classOthers = new others( 'data/titles.txt' );
$classNotes = new notes( 'data/notki.txt', 5 );
$tpl = new templates;

$tpl -> assign( 'TYTUL', $classOthers -> randomTitle( ) );
$tpl -> assign( 'TRESC', $classNotes -> showNotes( ( !empty( $_GET['newsid'] ) ) ? $_GET['newsid'] : '' ) );
$tpl -> display( 'tpl/index.tpl' );

unset( $classOthers, $classNotes, $tpl );
?>[/php:1:f838806cd6]
Mój wygląda tak smile.gif


--------------------
Go to the top of the page
+Quote Post
jaco
post 16.05.2004, 12:04:46
Post #8





Grupa: Zarejestrowani
Postów: 115
Pomógł: 1
Dołączył: 15.01.2003

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


Oto moj:

[php:1:0f9ba1bb20]<?php
header('Location: start.php');
?>[/php:1:0f9ba1bb20]

tongue.gif
Go to the top of the page
+Quote Post
orson
post 16.05.2004, 14:25:27
Post #9





Grupa: Zarejestrowani
Postów: 548
Pomógł: 2
Dołączył: 19.07.2003

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


witam ...

@Simpson: wydaje mi sie ze wlaczanie timera przed includami albo jak najwczesniej bedzie chyba bardziej miarodajne ... po co go inicjalizowac po wykonaniu kodu ...

pozdrawiam


--------------------
Computer games don't affect kids; I mean if <span style="font-weight: bold;">Pac Man</span> affected us as kids,we would all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music.
Go to the top of the page
+Quote Post
e4you
post 16.05.2004, 14:57:30
Post #10





Grupa: Zarejestrowani
Postów: 186
Pomógł: 0
Dołączył: 10.03.2004
Skąd: K-ce

Ostrzeżenie: (50%)
XXX--


ja mam tak:

[php:1:820d4e6edc]<?php
setcookie("kto_o_z", "$mem", time()+3600*1);
setcookie("pp", "1", time()+3600*1);
session_start();
ob_start();
include("config.php");
include("tpl/db.php");
include("tpl/header.php");
if (( $akcja=='spis_p' ) || ( $option=='form' ) || ( $akcja=='spis_pGALERY' )){
$teble_sz="90%";
}else{
$teble_sz="720";
}
include("tpl/sk.php");

if(file_exists("tresc/pl/$akcja$rozsz")){
include("tresc/pl/$akcja$rozsz");
}else{
include("tresc/pl/404$rozsz");
}
include("tpl/footer.php");
include"istat/stat.php";
$czas = explode(" ",microtime());
$koniec = $czas[1] + $czas[0];
$wynik = sprintf("%0.5f",$koniec-$poczatek);
echo "<font color=ffffff><br><center>Czas generowania strony w sekundach: $wynik</font> ";
ob_end_flush();
?>[/php:1:820d4e6edc]


--------------------
"Dla mnie SCHRANZ nigdy nie byl nazwą stulu muzycznego.A raczej określeniem przesterowaniem dzwięków. Czy nawet halasu... Sądzę, że wyroslo nowe pokolenie. które nie chce się identyfikować z techno z trance" - Chris Liebing

www.netklinik.
Go to the top of the page
+Quote Post
hwao
post 16.05.2004, 15:04:53
Post #11


Developer


Grupa: Moderatorzy
Postów: 2 844
Pomógł: 20
Dołączył: 25.11.2003
Skąd: Olkusz




Jak już kazdy wkleja to jes też dam smile.gif
[php:1:61c02f9e88]
<?php error_reporting( E_ALL );
ob_start();

require_once('./Config.php');
require_once('./Engine/Code.inc.php');
require_once('./Engine/Clock.inc.php');
require_once('./Engine/Error.inc.php');
require_once('./Engine/'.MYSQL_TYPE.'.inc.php');
require_once('./Engine/Config-MySQL.inc.php');
require_once('./Engine/Function.inc.php');
require_once('./Engine/Input.inc.php');
require_once('./Engine/Session.inc.php');
require_once('./Engine/Access.inc.php');
require_once('./Engine/Paging.inc.php');
require_once('./Engine/Template.inc.php');
require_once('./Engine/Engine.inc.php');

$GLOBALS['base'] = '0';
$GLOBALS['query'] = '0';
$session_lifetime = '3600';

$session = new Session($session_lifetime);



session_set_save_handler (
array(&$session, '_open'),
array(&$session, '_close'),
array(&$session, '_read'),
array(&$session, '_write'),
array(&$session, '_destroy'),
array(&$session, '_gc')
);

session_start();

$engine = new Engine;


// Sprawdza Versje php i jeżeli jest starsze niż 5.0.0 to odpala __destruct
$testVer = intval(str_replace('.', '', '5.0.0'));
$curVer = intval(str_replace('.', '', phpversion()));
if($curVer < $testVer) $engine -> __destruct();



ob_end_flush();
?>
[/php:1:61c02f9e88]
Go to the top of the page
+Quote Post
jaco
post 16.05.2004, 16:52:45
Post #12





Grupa: Zarejestrowani
Postów: 115
Pomógł: 1
Dołączył: 15.01.2003

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


To byl oczywscie zart z mojej strony, oto ten prawdziwy - u mnie index to tylko inicjator calej reszty...

[php:1:9c115055b0]<?php

include('config.php');

if($_GET['mod']=='')
$tpl->mod = $main->conf['default_module'];
else
$tpl->mod = $_GET['mod'];

$tpl->execute();

include('close.php');

?>[/php:1:9c115055b0]

Czy rozumiesz cokolwiek z tych indexow? Ja watpie, kazdy jest inny, kazdy robi co innego, kazdy ma za soba wiele kodu.
Go to the top of the page
+Quote Post
scanner
post 17.05.2004, 08:28:37
Post #13





Grupa: Zarząd
Postów: 3 503
Pomógł: 28
Dołączył: 17.10.2002
Skąd: Wrocław




To ja się wyłamię.
Nie mam pliku index.php
Mam co najwyżej "go.php", a wolę "go.to"


--------------------
scanner.info
Warto pamiętać: KISS, DRY
Go to the top of the page
+Quote Post

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: 25.04.2024 - 05:11