Jump to content
php.lv forumi

Sorting...


KryPt0

Recommended Posts

Jaa man vajag lai es savaa lapaa varu sortot piem peec reiting u.t.t

Bet... nu to visu es maaku viss ir ok un iet, bet man parcik ir tas chalars ar tabulaam(ar ifreimiem man baigi chakareejaas i-explorers un citi never ifreimus valjaa(dazhi)) taadeelj man ir uztaisiita tabula un iekshaa tajkaa ir shaads kods:

<?php 
if ($go=='news') { include("news.php"); }
elseif ($go=='rules') { include("rules.php"); }
elseif ($go=='snews') { include("serv_news.php"); }
elseif ($go=='sinfo') { include("full_info.php"); }
elseif ($go=='register') { include("sign_up.php"); }
elseif ($go=='registerdone') { include("register_done.php"); }
elseif ($go=='pw') { include("change_password.php"); }
elseif ($go=='stats') { include("stat_adder.php"); }
elseif ($go=='statsdone') { include("statupgradedone.php"); }
elseif ($go=='lostpw') { include("getpwd.php"); }
elseif ($go=='pk') { include("clear_pk.php"); }
elseif ($go=='top15') { include("top15.php"); }
elseif ($go=='guilds') { include("guilds15.php"); }
elseif ($go=='ds') { include("ds.php"); }
elseif ($go=='online') { include("online.php"); }
elseif ($go=='client') { include("client.php"); }
elseif ($go=='patch') { include("patch.php"); }
else { include("home.php"); }
?>

nu re! kaa uzspiezhu uz linka manaa tabulaa atveraas lapa taada un taada jo links iet uz: index.php?go=news(pimeers) nu vot, bet ar statistiku kura ir top15, ja es iekshaa uzspiezhu lai SORTO peec Leveļa tad vinjsh visu pazaudee un neparaada man visu kam ir jaabuut(t.i. neparaada man manus navigationus u.t.t) tikai top15.php bez nekaa apkaart vienkaarshaak sakot neraada tajaa tabulaa kuraa ir visi go=='blah'...

links kursh izmaina sorting kartibu ir: top15.php?requested=<sheit atrodas pec ka requesto bez "<>"> liidz ar to tas no kaa es pa jaunam sortoju atveras pavisam varteikt jaunaa lapaa un apkaart nekaa nav tikai pats top15 =[

man vajag lai atveras manaa tabulaa un ja es taisu:

elseif ($go=='top15?requested=level' { include top15.php?requested=level }

tad nekaa neiet vispaar...

ja saprataat ko es gribu panaakt varat paliidzeet ?

iisaak sakot:

Man vajag kad es savaa tabulaa kuraa atrodas top15 uzspiezhu uz vaarda Experience(tas sortos peec experience daudzuma) tad sorto peec experiences un atver tajaa pashaa tabulaa...

un varbuut...

... ir iespeejams kaa ar iframe kad iedod tabulai "name" un linkaa raxta target="table name" ? vai ar id ? nu vai kkaa taa =]

 

Ceru ka saprataat =]]

Link to comment
Share on other sites

Man līdzīgi kā Delfīnam zuda sasaite ar tekstu bet ja sapratu tad visa problēma ir tikai tajā ka tu nezini ka mainīgos var padot vairākus atdalot ar &

 

Un precīzi kļuda ir te:

 

elseif ($go=='top15?requested=level' { include top15.php?requested=level }

 

kas ir nepareizi.

 

atstaaj tāpat elseif ($go=='top15') { include("top15.php"); }

 

JO ja tu vērsi savu index.php?go=top15&requsted=level tad jau automātiski includesies tavs top15.php un tam jau ar buus padots $_GET['requested'] (jeb $requested) mainīgais.

Link to comment
Share on other sites

Man līdzīgi kā Delfīnam zuda sasaite ar tekstu bet ja sapratu tad visa problēma ir tikai tajā ka tu nezini ka mainīgos var padot vairākus atdalot ar &

 

/SKIPOTS/

atstaaj tāpat elseif ($go=='top15') { include("top15.php"); }

 

JO ja tu vērsi savu index.php?go=top15&requsted=level tad jau automātiski includesies tavs top15.php un tam jau ar buus padots $_GET['requested'] (jeb $requested) mainīgais.

21944[/snapback]

 

to Roze: mjaa pasteidzies :)

to KryPt0: tieshi taa ja izmanto vienu failu (index.php) tad atceries ka var padot n mainiigos

un visus izmantot :)

arii incluudojamais fails izmantos TOS PASHUS mainigos.....

Fiziski includojamais fails kljuust par koda dalju - PHP sakumaa visu sakombinee,

peec tam parbauda sintaksi un TIKAI TAD izpilda :)

Edited by Grey_Wolf
Link to comment
Share on other sites

index.php?go=top15&requested=level

 

index.php

<?php

$sections = Array( 'home', 'top15', 'news' );
$go = $_GET['go'];

if ( in_array($go,$sections) )
{
   include $go.'.php';
}

?>

 

top15.php

<?php

$requested = trim( $_GET['requested'] );
if ($requested=='level')
{
   // do something
}

?>

Edited by Delfins
Link to comment
Share on other sites

index.php?go=top15&requested=level

 

index.php

<?php

$sections = Array( 'home', 'top15', 'news' );
$go = $_GET['go'];

if ( in_array($go,$sections) )
{
   include $go.'.php';
}

?>

21952[/snapback]

 

Viņam tur ir kaudze ar $go mainīgajiem, kam vērtība nesakrīt ar faila nosaukumu ..

 

<?php
$sections = array('news' => 'news.php',
'rules' => 'rules.php',
'snews' => 'serv_news.php',
'sinfo' => 'full_info.php',
'register' => 'sign_up.php',
'registerdone' => 'register_done.php',

// ...
);

$go = $_GET['go'];

if (isset($sections[$go])){
   include $go;
}

?>

Link to comment
Share on other sites

nu ja cilveeks raksta

<?php
if ($go=='news') { include("news.php"); }
elseif ($go=='rules') { include("rules.php"); }
elseif ($go=='snews') { include("serv_news.php"); }
elseif ($go=='sinfo') { include("full_info.php"); }
elseif ($go=='register') { include("sign_up.php"); }
elseif ($go=='registerdone') { include("register_done.php"); }
elseif ($go=='pw') { include("change_password.php"); }
elseif ($go=='stats') { include("stat_adder.php"); }
elseif ($go=='statsdone') { include("statupgradedone.php"); }
elseif ($go=='lostpw') { include("getpwd.php"); }
elseif ($go=='pk') { include("clear_pk.php"); }
elseif ($go=='top15') { include("top15.php"); }
elseif ($go=='guilds') { include("guilds15.php"); }
elseif ($go=='ds') { include("ds.php"); }
elseif ($go=='online') { include("online.php"); }
elseif ($go=='client') { include("client.php"); }
elseif ($go=='patch') { include("patch.php"); }
else { include("home.php"); }
?>

nav labaak switchu lietoto... ?

Link to comment
Share on other sites

×
×
  • Create New...