How to resolve this...?


#1

I have a problem, which concerns several scripts I use (or the ones I want to use). All suffer from the same effect.

I use the $_GET command on my main page (layout.php) to get the appropiate pages to be displayed in the center.

(short version, but you get the idea)

<?php if ( isset($_GET['nieuws'])) {include('nieuws.php'); } else if ( isset($_GET['webwereld'])) {include('webwereld.php'); } else if ( isset($_GET['binnenland'])) {include('binnenland.php'); } else if ( isset($_GET['buitenland'])) {include('buitenland.php'); } else {include('domeinnaamcheck.php');} ?>

Anyways the problem I face now, with several scripts, are the ones who use some extended url.
E.g. scripts which add the following:

example.php?q=cat-view&category=testcat1

and

example.php?q=detail&id=1

Is it possible to use some kind of wildcard to make it still open in the layout where I desire with the $_GET command in PHP?

If it were fixed links, it would not be a problem. But since this new content gets added everytime, you probably can understand why this is a problem.

I understand I have to capture the query string?

I have found the following 2 strings which are used (I guess):

To view a category, the following string is used:

<a href="?q=cat-view&amp;category=<? echo"$record->category";?>"><? echo "$record->category";?></a> <font class="small">(<? echo $numentry[0]; ?>)

To view a specific item / question, this string is used:

<a href="?q=detail&amp;id=<? echo"$record->id";?>"><? echo "$record->title"; ?>

So how do I do this?

I hope you can understand, cause I am having a hard time to explain it the best I can and English is not my native language. :)

Regards,
HHawk


#2

I am not sure I understand, but I will take a stab at clarification.

Your code adds the variables for include pages in the query string, which you retrieve the the $_GET method and ALL of YOUR GETs are for Included pages. However, there are additional items in the query string that DO NOT have an included page (such as the category, etc…) BUT you need to include those pages that DO exists regardless whether there are additional items in the query string. Is this correct?

(basically ignore those items in the query string that DON’T have an include page)?

If this is the case, I would suggest that you parse each GET variable, and IF there is a page of the same name, (do a directory listing perhaps and compare) then include it otherwise ignore it.

Hope this helps.