kodlovac;10941179 wrote:theres no html code
While amusing as a comment in the matrix (There is no spoon), trust me: There is indeed html code.
kodlovac;10941179 wrote:, this part generates links
$pages = array(
"file1"=>"Index",
"file2"=>"Page 2",
"file3"=>"Page 3",
"file4"=>"Page 4",
"file5"=>"Contact",
);
No it doesn't. It creates an associative array and assigns it to $pages.
If this is used in combination with the code in the first post, $page has a default value of startpage.html (and .html is a good hint, albeit certainly no guarantee, as to what's found inside this file: html code).
kodlovac;10941179 wrote:
if(preg_match('/[-_a-z0-9]+$/i', $page)){
exit;
}
include "index.html";
But there is a . in startpage.html, so this regexp fails, and index.html is displayed instead. If this is the behaviour you want, you should still consider achieving it in a less roundabout way.
This part generates html code. Well, unless you set the content type header to text/plain, in which case it's just plain text. But then, you'd not see digits 1 through 5, you'd see the actual markup as well.
kodlovac;10941179 wrote:
foreach($pages as $k => $v){
if($page == $k){
$str .="<li class=\"selected\"><a href=\"index.php?str=$k\">$v</a></li>\n";
}else{
$str .="<li class=\"unselected\"><a href=\"index.php?str=$k\">$v</a></li>\n";
You are missing opening and closing ul tags. Other than that, you just have to change li's display type or make it float, since the default display value for li is block.