Erikdr Posted May 19, 2008 Share Posted May 19, 2008 Hello, I found this code somewhere and without modification it works perfect. It should with projecten.php?page=porto1 get index.php 'porto/porto1/index.php' and with projecten.php?page=porto2 the index from 'porto/porto2/index.php' Original code: <? $page = $_GET['page']; if (ereg('[A-Za-z0-9]',$page) ) { if (file_exists('include/'.$page.'.php')) { include('include/'.$page.'.php'); } else { include('include/main.php'); } } else { include('include/main.php'); }?> I tried this: <? $page = $_GET['page']; if (ereg('[A-Za-z0-9]',$page) ) { if (file_exists('porto/'.$page.'/index.php')) { include('porto/'.$page.'/index.php'); } else { include('porto/'.$page.'/index.php'); } } else { include('porto/'.$page.'/index.php'); }?> Im doing something wrong coss it doesnt work, but i dont get any errors either. Link to comment https://forums.phpfreaks.com/topic/106291-i-need-help-with-phppage/ Share on other sites More sharing options...
runnerjp Posted May 19, 2008 Share Posted May 19, 2008 why you calling it from page then/ index.php? Link to comment https://forums.phpfreaks.com/topic/106291-i-need-help-with-phppage/#findComment-544713 Share on other sites More sharing options...
Erikdr Posted May 19, 2008 Author Share Posted May 19, 2008 Im sorry runnerjp im not sure what u mean, im not a php expert :-) Link to comment https://forums.phpfreaks.com/topic/106291-i-need-help-with-phppage/#findComment-544725 Share on other sites More sharing options...
DarkWater Posted May 19, 2008 Share Posted May 19, 2008 Look at how it's done in the original. You need to include a main.php or something that gets loaded if you don't pass a $page parameter. Link to comment https://forums.phpfreaks.com/topic/106291-i-need-help-with-phppage/#findComment-544727 Share on other sites More sharing options...
runnerjp Posted May 19, 2008 Share Posted May 19, 2008 <? $page = $_GET['page']; if (ereg('[A-Za-z0-9]',$page) ) { if (file_exists('porto/'.$page.'/.php')) { include('porto/'.$page.'/.php'); } else { include('porto/'.$page.'/.php'); } } else { include('porto/index.php'); }?> Link to comment https://forums.phpfreaks.com/topic/106291-i-need-help-with-phppage/#findComment-544738 Share on other sites More sharing options...
Erikdr Posted May 19, 2008 Author Share Posted May 19, 2008 Now it goes directly to empty.php whatever I do. ??? <? $page = $_GET['page']; if (ereg('[A-Za-z0-9]',$page) ) { if (file_exists('porto/'.$page.'/index.php')) { include('porto/'.$page.'/index.php'); } else { include('empty.php'); } } else { include('empty.php'); }?> Link to comment https://forums.phpfreaks.com/topic/106291-i-need-help-with-phppage/#findComment-544740 Share on other sites More sharing options...
Erikdr Posted May 19, 2008 Author Share Posted May 19, 2008 Thnx for the help, but it seems i just should stay with plain html. It's all messed up now Im using this atm: <? $page = $_GET['page']; if (ereg('[A-Za-z0-9]',$page) ) { if (file_exists('porto/'.$page.'/index.php')) { include('porto/'.$page.'/index.php'); } else { include('porto/'.$page.'/index.php'); } } else { include('porto/empty.php'); }?> My main menu uses index.php?jongbouw=Projecten On that page "Projecten" I have a sub menu (projecten.php?page=porto1) with wich i want to load an index.php wich is stored in different folders. Every folder contains a image gallery but the image gallery uses .php?pg=2_p Now when the image gallery automaticly goes to the next image i dont get the image but empty.php So now i have 3 different .php?page=thingy's wich doesnt seem to work Link to comment https://forums.phpfreaks.com/topic/106291-i-need-help-with-phppage/#findComment-544746 Share on other sites More sharing options...
runnerjp Posted May 19, 2008 Share Posted May 19, 2008 try projecten.php?page=porto1/index.php Link to comment https://forums.phpfreaks.com/topic/106291-i-need-help-with-phppage/#findComment-544782 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.