Jump to content
GIGN Forum

Majas Lapa(index.php)


JAKuT
 Share

Recommended Posts

Un kādēļ mūsdienās vairs neviens switch'u neizmanto? :)

PHP

<?php

switch($_GET['kaka'])

    {

        

case?'main':?echo?draw_main();break;

        

case?'shop':?include("shop.php");break;

            

        default:

?echo?draw_main();break;

    }

?>

?kaka=shop

Link to comment
Share on other sites

a kaa tas izskatitos tiesi index.php??

Pie sita..

<div id="menu">

<ul>

<li><a id="selected" class="first" href="http://localhost/news.php">Новости</a></li>

<li><a href="http://localhost/forum/index.php">Форум</a></li>

<li><a href="http://localhost/files.php">Файлы</a></li>

<li><a href="http://localhost/ban/">Баны</a></li>

<li><a href="http://localhost/shop.php">SHOP</a></li>

<li><a class="last" href="http://localhost/donate.php">Пожертвование</a></li>

</ul>

</div

varetu apteikt??

Link to comment
Share on other sites

Kludu, izlaboju.. viss iet, tikaj tagad veel viena problema uzradas.. :)

kaa lai es uztaisu index.php

taa kad lai es uzrakstot http://domain.lv

lai man strada, tie include

tagad man izskatad index.php taa

<?php
switch($_GET['page'])
    {
        case 'news': include("news.php");break;
            
        default: include("index.php");break;
    }
?>

<?php
switch($_GET['page'])
    {
        case 'files': include("files.php");break;
            
        default: include("index.php");break;
    }
?>

<?php
switch($_GET['page'])
    {
        case 'shop': include("shop.php");break;
            
        default: include("index.php");break;
    }
?>

bet es gribu, lai kad uzrakstot, http://domain.lv man atveras lapa, ar jaunumiem! taka te.. http://naken.lv/

ieejot, viss ir normali, un strada ari sis links, index.php?page=files

Edited by JAKuT
Link to comment
Share on other sites

Pievienoju arī komentārus, citādi tu, manuprāt, neko nesaprati, jo atkārto vnk kodu, ko tev iedeva!

PHP

<?php

if(isset($_GET['page'])) // ja tiek padots get maniigais PAGE

{

switch(

$_GET['page']) // tad swichojam

    

{

        case 

'news': include("news.php");break; // ja get page ir news tad ielaadeejam news.php

    

case 'files': include("files.php");break; // ja get page ir files tad ielaadeejam files.php

        

case 'shop': include("shop.php");break;    // ja get page ir shop tad ielaadeejam shop.php

        

default: include("index.php");break; // ja nav neviens no ieprieks mineetiem, 

//tad kaa defultu uzraadam index.php

    

}

} else { 

// ja netiek padots get page uzraadam indeksu

include("index.php");

}

?>

Edited by duplets
Link to comment
Share on other sites

Es saskaros, ar jaunu problemu!

viss, strada! uzliku index.php faila so kodu

<?php
if(isset($_GET['page'])) // ja tiek padots get maniigais PAGE
{
switch($_GET['page']) // tad swichojam
    {
        case 'news': include("news.php");break; // ja get page ir news tad ielaadeejam news.php
    case 'files': include("files.php");break; // ja get page ir files tad ielaadeejam files.php
        case 'shop': include("shop.php");break;    // ja get page ir shop tad ielaadeejam shop.php
    case 'donate': include("donate.php");break;    // ja get page ir shop tad ielaadeejam donate.php
    case 'donates': include("donates.php");break;    // ja get page ir shop tad ielaadeejam donates.php
    case 'vipacc': include("vipacc.php");break;    // ja get page ir shop tad ielaadeejam vipacc.php
    case 'mvipacc': include("mvipacc.php");break;    // ja get page ir shop tad ielaadeejam mvipacc.php
        default: include("news.php");break; // ja nav neviens no ieprieks mineetiem, 
//tad kaa defultu uzraadam news.php
    }
} else { // ja netiek padots get page uzraadam indeksu
include("news.php");
}
?>

bet kad vins rakstot http://localhost parmet normali uz majas lapu, bet krievu valodas vieta visur ir Cetrsturisi!

un kad uzrakstu http://localhost/news.php tad rada viis noramli, krieviski. ko lai izdaru? charset=windows-1251

un pat caur Internet Explorer, spiezot Encoding-> stav UTF-8

gribu uzlikt Kirilica(windows) neliekas... ko lai dara?? :(

Edited by JAKuT
Link to comment
Share on other sites

Nu kads palidzes???

atkartosu jautajumu, pa jaunam.

Kapec, man neiet CHARSET? kad parliku, paskodetu majaslapu..

pirms tam ari bija paskodeta, viss gaja, tagad uztaisiju galigi citu, ar citu .css failu

Vairs, neiet ...

Krieviski nerada, cetrsturisi stav.

Mysql character set - cp1251

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>
  <title>Impulsive.lv :: Новости</title>
  <meta http-equiv="content-type" content="text/html; charset=windows-1251" />
  <meta name="description" content="Counter Strike 1.6 Impulsive.lv" />
  <meta name="keywords" content="cs,counter strike,counter strike server rent, cw" />
  <meta name="author" content="Impulsive.lv / Design by: JaKuT" />
  <link rel="shortcut icon" href="img/favicon.ico" />
  <link rel="stylesheet" href="css/style.css" type="text/css" />
</head>
<body>

un kad caur sito iet

<?php
if(isset($_GET['page'])) // ja tiek padots get maniigais PAGE
{
switch($_GET['page']) // tad swichojam
    {
        case 'news': include("news.php");break; // ja get page ir news tad ielaadeejam news.php
    case 'files': include("files.php");break; // ja get page ir files tad ielaadeejam files.php
        case 'shop': include("shop.php");break;    // ja get page ir shop tad ielaadeejam shop.php
    case 'donate': include("donate.php");break;    // ja get page ir shop tad ielaadeejam donate.php
    case 'donates': include("donates.php");break;    // ja get page ir shop tad ielaadeejam donates.php
    case 'vipacc': include("vipacc.php");break;    // ja get page ir shop tad ielaadeejam vipacc.php
    case 'mvipacc': include("mvipacc.php");break;    // ja get page ir shop tad ielaadeejam mvipacc.php
        default: include("news.php");break; // ja nav neviens no ieprieks mineetiem, 
//tad kaa defultu uzraadam news.php
    }
} else { // ja netiek padots get page uzraadam indeksu
include("news.php");
}
?>

tad vsp, neka nerada.. visur ir cetrsturisi, pat uz Menu Button!

Edited by JAKuT
Link to comment
Share on other sites

Es atradu, problemu..

Sitaja rindina bija kluda..

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xml:lang="RU" lang="RU" xmlns="http://www.w3.org/1999/xhtml">

RU vieta bija EN un tapec radija keburus.. es tik ne saprotu kapec.. :huh:

Link to comment
Share on other sites

  • 4 weeks later...

un kur man jaraksta :

<?

$allow = array("news", "shop", "blabla",...);

$file = "news.php";

if (isset($_GET["p"]))

if (in_array($_GET["p"], $allow))

$file = $_GET["p"] . ".php";

require_once( $file);

?>

Visus index.php vai ari katra faila ?

Link to comment
Share on other sites

nav vieglak tak es izdariju??

uztaisa, index.php un tur to kodu iebaz..

un uztaisa header uz news.php ... un viss nekur nekaa daudz nav jaraksta :)

P.S paldies, ieprieks jums, kas man palidzeja saprast

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...