Jump to content

I need help with .php?page=


Erikdr

Recommended Posts

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

<? $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');
                }?>

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');
               }?>

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 :P

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.