amelierosalyn

Skip navigation

All posts tagged with "PHP"

You don't need to ConvertToPHP just to use includes

I have seen countless threads on the various forums from people who are asking for help because their member lists don't show in whatever popular fanlisting script they're currently using. When asked for their code, 9 times out of 10 it looks like this:

<?php
include('header.inc');
if(!$_SERVER['QUERY_STRING']) { ?>

Here are all my members!!!!
[Insert member list code here]

<? } include('footer.inc'); ?>

Can you spot what's wrong with that?

If you can't, here's the answer. Most fanlisting scripts use the query string (that's the bit that comes after a ? in a URL, such as country=USA in a URL like members.php?country=USA) to display members from different countries. The code there includes a line which says if (!$_SERVER['QUERY_STRING']) { which means "if there is no query string, do the following..." ... and the person has stuck their member code in the "do the following" bit (signified by the { and }). The members list WILL fail here, because it relies on the query string. If you tell the members to only show when there is no query string, it will break when you attempt to go to a country.

Now the reason this is happening so often is because it seems that people think "ooh I need a PHP page... How do I do that? Ah, NL-ConvertToPHP." This is wrong, people! All you need to have a "PHP page" is to give it a .php extension. If you want headers and footers (which NL-Convert uses as well), there are millions of tutorials on how to do this online. Don't assume that just because that script is called "ConvertToPHP" it is the be-all and end-all of how to make PHP pages.

Oh yeah, and I have internet again. Just in case anyone was wondering.

Older Entries