Kod
<?php
$path = ".";
$moje = "./inc/includ";
$rozsz=".html";
if($do == "search" or $dosearch == "yes"){ $subaction = "search"; $dosearch = "yes"; include("$path/search.php"); }
elseif($do == "archives"){ include("$path/show_archives.php"); }
elseif($do == "category"){ include("$path/show_news.php"); }
elseif($do == "news"){ include("$path/show_news.php"); }
elseif($do == "galeria"){ include("galeria.php"); }
elseif(file_exists("$moje/$do.php")){include("$moje/$do.php");}
else{include("$moje/main.php");}
?>
$path = ".";
$moje = "./inc/includ";
$rozsz=".html";
if($do == "search" or $dosearch == "yes"){ $subaction = "search"; $dosearch = "yes"; include("$path/search.php"); }
elseif($do == "archives"){ include("$path/show_archives.php"); }
elseif($do == "category"){ include("$path/show_news.php"); }
elseif($do == "news"){ include("$path/show_news.php"); }
elseif($do == "galeria"){ include("galeria.php"); }
elseif(file_exists("$moje/$do.php")){include("$moje/$do.php");}
else{include("$moje/main.php");}
?>
Potem w pliku show_cats.php
Kod
<?php
##############################
# Configuration
##############################
/* If it is set to FALSE, the categories wont be displayed
after a visitor click some category to see the news from it */
$display_categories_when_showing_news = TRUE;
##############################
# Main Code (Do not edit)
##############################
$cutepath = __FILE__;
$cutepath = preg_replace( "'\\\list_cats\.php'", "", $cutepath);
$cutepath = preg_replace( "'/list_cats\.php'", "", $cutepath);
include("$cutepath/inc/functions.inc.php");
if(($show_cat != "" and $display_categories_when_showing_news == TRUE) or $show_cat == ""){
$cat_lines = file("$cutepath/data/category.db.php") or die("Can not open $cutepath/data/category.db.php");
$all_news = file("$cutepath/data/news.txt") or die("Can not open $cutepath/data/news.txt");
foreach($cat_lines as $cat_line){
$cat_total_news = 0;
$cat_arr = explode("|", $cat_line);
foreach($all_news as $news_data){
$news_arr = explode("|", $news_data);
if($news_arr[6] == $cat_arr[0]){
$cat_total_news++;
}
}
echo "<a href=\"?category={$cat_arr[0]}\">{$cat_arr[1]}</a> ($cat_total_news)<br />";
}
}
if($show_cat != ""){
$category = $show_cat;
include("$cutepath/show_news.php");
}
?>
##############################
# Configuration
##############################
/* If it is set to FALSE, the categories wont be displayed
after a visitor click some category to see the news from it */
$display_categories_when_showing_news = TRUE;
##############################
# Main Code (Do not edit)
##############################
$cutepath = __FILE__;
$cutepath = preg_replace( "'\\\list_cats\.php'", "", $cutepath);
$cutepath = preg_replace( "'/list_cats\.php'", "", $cutepath);
include("$cutepath/inc/functions.inc.php");
if(($show_cat != "" and $display_categories_when_showing_news == TRUE) or $show_cat == ""){
$cat_lines = file("$cutepath/data/category.db.php") or die("Can not open $cutepath/data/category.db.php");
$all_news = file("$cutepath/data/news.txt") or die("Can not open $cutepath/data/news.txt");
foreach($cat_lines as $cat_line){
$cat_total_news = 0;
$cat_arr = explode("|", $cat_line);
foreach($all_news as $news_data){
$news_arr = explode("|", $news_data);
if($news_arr[6] == $cat_arr[0]){
$cat_total_news++;
}
}
echo "<a href=\"?category={$cat_arr[0]}\">{$cat_arr[1]}</a> ($cat_total_news)<br />";
}
}
if($show_cat != ""){
$category = $show_cat;
include("$cutepath/show_news.php");
}
?>
listuje sobie liste kategorii
i normalnie odwoluje sie do zmiennych za pomoca index.php?do=news
Tylko ze tu pojawia sie problem i przestaja dzialac linki "?category={tutaj_numer_kategorii}
Czy da rade jakos to naprawic??
Bo ja w pliku index.php zmienie linijke else{include("$moje/main.php");} na
else{include("$path/show_news.php");}
to wszystko dziala a ale chcialbym zeby wlasnie ta strona main.php byl includowany jako glowny
