Hi everyone, this is a sorta modular system i made i need some feedback if it is any good? // Modules $modules = array( 'forum' => 'forum', 'viewforum' => 'viewforum', 'viewtopic' => 'viewtopic', 'register' => 'register', 'login' => 'login', 'usercp' => 'usercp', 'newtopic' => 'newtopic', 'newreply' => 'newreply', 'newpoll' => 'newpoll', 'editpost' => 'editpost', 'member' => 'member', 'members' => 'members' ); if (!isset($_GET['act'])) { $act = 'forum'; } else { $act = $_GET['act']; } // Include the current module if (in_array($act, $modules)) { include('modules/' . $act . '.php'); } else { die; } PHP:
Looks good.. A more elegant death with error message output would be nice though. Also, Google does not care for pages that are formed like index.php?page=calendar Better to rewrite your URLs if you plan to run your site from just one page.
Where does it say so? I have never heard of this. What makes it alergic to google? cud u please explain?
Their webmaster specs indicate the bot will not even crawl pages that have the "id=" in the query string. Personal experience with many clients running vBulletin portals has shown that the pages formed with index.php?page=modulename do not get crawled nearly as often as the more static-looking pages even if those modules are linked from every page on the site. Google knows it is a dynamically generated page and may be falling into a spam trap. Better to feed it static-looking URLs.
they say that their bots crawl dynamic urls (with parameters in them), but recommend to keep the number of parameters to a low. however, they say that googlebot wont crawl a parameter named id. this is specific to the 'id' and not to any other url parameters. u can make the id to i or even d or anything other than 'id' and it will get crawled. the problem with dynamic scripts is that most of them use session ids, and since the bot visits a page multiple times, what it see is multiple pages with same content and it raises a flag. there is no problem in using module=calender or something as parameters. if u use SEF URLs with .htm extension, the bot wont go much in to analysing the page it normally does for dynamic URLs like trying to get rid of sessions (just a try, i havent seen any of the session ids remved from indexing) or cookies or many things like that which it normally does before indexing a dynamic page, and it just index the page as it were a static html page. that is an advantage, faster indexing.
I'd tend to write the bottom part of the script like this $act = ( isset($_GET['act']))?$_GET['act']:'forum'; if ( !in_array($act, $modules)) $act = 'forum'; include('modules/' . $act . '.php'); PHP: but I also have a function called getGetVar, most systems have one and the bare bones of mine is function getGetVar($name, $default='') { global $_GET; $output= ( isset($_GET[$name]))?$_GET[$name]:$default; // check for sql hacks $output = replace_str( '/*','',$output); return $output; } PHP: and this would transform my example to $act = getGetVar('act','forum'); if ( !in_array($act, $modules)) $act = 'forum'; include('modules/' . $act . '.php'); PHP: and the user would never "die", they'd always go through to the forum if they chose something invalid.
I agree with you in theory. There is no theoretical problem with using page= in the URL string. All I can tell you is that, from personal experience, those pages are not crawled as frequently as they should be. My latest example is a client in the financial sector with a strong PR4 and top-10 rankings for his phrases. He has an economic calendar that is linked as the second menu item from every page on his site and updated multiple times per day. It took two weeks for Google to re-cache his calendar after I changed the page title and the calendar (and other page= dynamic pages) have NEVER inherited pagerank from the rest of his site. I've seen this more than a few times with sites running the various free vBulletin portals that use poorly formed URLs. I can PM the site if you'd like. I would simply avoid the problem and make friendly URLs. It takes 2 minutes with mod_rewrite, right?
If you are coding your own just make the url's look static, and redirect everything to the main page, there you get the variables and stuff, no need to mod_rewrite.