unkwntech Posted September 3, 2008 Share Posted September 3, 2008 I'm not sure what I am doing wrong with this one. I have index.php: <?php error_reporting(E_ALL); ini_set('display_errors', true); ?> <?php require 'database.config.php'; require 'uriParser.php'; $loadStartTime = microtime(); ?> //HTML here <tr> <td background="http://beta.phpsnipz.com/images/bodyTop.png"><font color="#FFFFFF"><?php echo $page['title']; ?></font></td> </tr> <tr> <td background="http://beta.phpsnipz.com/images/bodyCenter.png"><font color="#FFFFFF"><?php echo $page['content']; ?></font></p></td> </tr> uriParsers requires main.inc.php which defines 2 variables $page['title'] = 'Test Title' and $page['content'] = 'This is my test content' When the page is viewed all that is outputted is 'W' for both title and content Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/ Share on other sites More sharing options...
Adam Posted September 3, 2008 Share Posted September 3, 2008 Could you output the code from uriParser.php and main.inc.php ? Obviouslly if the value of them is just W need to seem whats happening when they're set.. Adam Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/#findComment-633077 Share on other sites More sharing options...
unkwntech Posted September 3, 2008 Author Share Posted September 3, 2008 uriParser.php: <?php //$parts = '/test.php/users/view/0/unkwntech/'; $parts = $_SERVER['REQUEST_URI']; $parts = preg_replace('%\/index\.php%', '', $parts); $parts = preg_replace('%\/test\.php%', '', $parts); $parts = preg_split('%/%', $parts); foreach($parts as $part) { if(!(is_null($part) || strlen($part) < 1)) { $uriParts[] = $part; } } //echo "parts['0'] - " . print_r($uriParts); switch($uriParts['0']) { case 'users': require 'users.inc.php'; users($uriParts['1'], $uriParts['2']); break; case 'snipz': require 'snipz.inc.php'; snipz($uriParts['1'], $uriParts['2']); break; case 'admin'; require 'admin.inc.php'; admin($uriParts['1'], $uriParts['2'], $uriParts['3']); break; default: require 'main.inc.php'; break; } ?> main.inc.php: <?php $page['title'] = "Welcome to PHP Snipz -"; $page['content'] = "We are still building the site."; ?> main.inc.php is being included, no errors are being presented, and the variables are only being set staticly set for testing. Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/#findComment-633085 Share on other sites More sharing options...
unkwntech Posted September 3, 2008 Author Share Posted September 3, 2008 Sorry I know it's kinda' early to do this, but BUMP, I'm pulling my hair out here. Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/#findComment-633142 Share on other sites More sharing options...
unkwntech Posted September 4, 2008 Author Share Posted September 4, 2008 No help on this one guys? I'm having one hell of a time with it. Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/#findComment-633355 Share on other sites More sharing options...
Ken2k7 Posted September 4, 2008 Share Posted September 4, 2008 case 'admin'; Why is there a semi-colon there? Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/#findComment-633366 Share on other sites More sharing options...
unkwntech Posted September 4, 2008 Author Share Posted September 4, 2008 That was a typo in the code, I fixed it now and I am still getting the same results. Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/#findComment-633373 Share on other sites More sharing options...
Ken2k7 Posted September 4, 2008 Share Posted September 4, 2008 Are you sure you are referencing them correctly? Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/#findComment-633384 Share on other sites More sharing options...
unkwntech Posted September 4, 2008 Author Share Posted September 4, 2008 99% sure, all the associated code is posted above. Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/#findComment-633388 Share on other sites More sharing options...
Ken2k7 Posted September 4, 2008 Share Posted September 4, 2008 What if you tried to include the main.inc.php file directly onto the index.php? Would that work? Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/#findComment-633396 Share on other sites More sharing options...
unkwntech Posted September 4, 2008 Author Share Posted September 4, 2008 I was thinking something along the same lines and added a print_r($page); to the bottom of the uriParts.php and it is printing the correct items. Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/#findComment-633400 Share on other sites More sharing options...
Ken2k7 Posted September 4, 2008 Share Posted September 4, 2008 Is the background black color or a non-white color? Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/#findComment-633403 Share on other sites More sharing options...
unkwntech Posted September 4, 2008 Author Share Posted September 4, 2008 Yes but I viewed the source. And now I am seeing some more interesting errors. On line 2 of index.php I have $loadStartTime = microtime(); then on line 110 I have echo $loadEndTime - $loadStartTime; and I am getting Notice: index.php line 110 - Undefined variable: loadStartTime The uriParser.php does still contain print_r($page); Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/#findComment-633404 Share on other sites More sharing options...
unkwntech Posted September 4, 2008 Author Share Posted September 4, 2008 IDK why but it just started working? Thanks for the help. Quote Link to comment https://forums.phpfreaks.com/topic/122606-inproper-data-being-echoed/#findComment-633405 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.