template system.. rewrite/substr
Posted: Fri Sep 23, 2011 12:47 pm
Hi
First of all, just wanna say thanks for creating a site that ppl with no skills whatsoever can understand!
Now. As the newb i am i have some issues trying to add a news-script i downloaded to the basic template system im using from this site.
I've searched but i didn't find anything(dont really know what i exactly should search for, but i tried).
I will learn this sometime, but atm i'm helpin a friend starting his site and can't solve this quickly.
I also did the redirect in my root folder:
DirectoryIndex index.html index.php index2.php
RewriteRule ^([a-zA-Z_]+)/?$ index2.php?page=$1 [QSA]
RewriteRule ^([a-zA-Z_]+)/?$ index.php?page=$1 [QSA]
Ok, so the problem..
Basicly, i get to the page where it lists the headlines of the posts error-free.
Hovering the link shows "http://www.url.se/index2.php?a=1" and thats my problem, wich i think is cause the rewrites and cause i use:
I hope you understood my question(english isn't my native lang(doh)) and thanks for any help with my question.
First of all, just wanna say thanks for creating a site that ppl with no skills whatsoever can understand!
Now. As the newb i am i have some issues trying to add a news-script i downloaded to the basic template system im using from this site.
I've searched but i didn't find anything(dont really know what i exactly should search for, but i tried).
I will learn this sometime, but atm i'm helpin a friend starting his site and can't solve this quickly.
I also did the redirect in my root folder:
DirectoryIndex index.html index.php index2.php
RewriteRule ^([a-zA-Z_]+)/?$ index2.php?page=$1 [QSA]
RewriteRule ^([a-zA-Z_]+)/?$ index.php?page=$1 [QSA]
Ok, so the problem..
Basicly, i get to the page where it lists the headlines of the posts error-free.
Hovering the link shows "http://www.url.se/index2.php?a=1" and thats my problem, wich i think is cause the rewrites and cause i use:
if (empty($_GET['page'])){ header('Location: home'); die(); } $core_path = dirname(__FILE__); $pages = scandir("{$core_path}/pages"); unset($pages[0], $pages[1]); foreach ($pages as &$page){ $page = substr($page, 0, strpos($page, '.')); } if (in_array($_GET['page'], $pages)){ $include_file = "{$core_path}/pages/{$_GET['page']}.inc.php"; } else { $include_file = "{$core_path}/pages/home.inc.php"; }This is the $_GET['page']
else if ($_GET['page'] == "news"){ $contact = 'aButton'; $headline = 'Nytt hos oss'; }($contact & $headline is for css and title)
I hope you understood my question(english isn't my native lang(doh)) and thanks for any help with my question.