Jump to content

$pilots_list doesn't work when function is called from a different location


WiltshireAirlines

Recommended Posts

I'm trying to copy over the pilots list page. I am copying from the original pilots list page to a new page which is located in the skin folder. I have copied and pasted successfully but the pilots list doesn't load anything. The if (!$pilots_list) {} statement returns true and the operation to load the pilots is canceled, meaning something is wrong with calling the method. I'm sure that this has something to do with moving the code.

Thanks in advance.

Link to comment
Share on other sites

$pilots_list is populated by the module, so you will need to ensure you're including the config file (you can find more about running pages outside of phpVMS elsewhere on the forums) and then you'll need to do $pilots_list = PilotData::getAllPilots() for example.

Link to comment
Share on other sites

I made those changes. First, the page was completely blank. I assumed an error so I deleted $pilots_list = PilotData::getAllPilots() and it said this:

Cannot redeclare codon_autoload() (previously declared in /home/vol9_4/byethost8.com/b8_14940267/htdocs/core/classes/autoload.php:42) in/home/vol9_4/byethost8.com/b8_14940267/htdocs/core/classes/autoload.php on line 69

Link to comment
Share on other sites

Is this external from phpVMS itself? Are you accessing it from site.com/lib/skins/page.php?

If you are you'll need to include the config:

include('/home/username/public_html/core/codon.config.php');

Then use:

$pilots = PilotData::getAllPilots();

Make sure the include() is the first thing on your page to avoid header errors.

Link to comment
Share on other sites

OK. Just did that, and it still gives me the same error as before:

Fatal error: Cannot redeclare codon_autoload() (previously declared in /home/vol9_4/byethost8.com/b8_14940267/htdocs/core/classes/autoload.php:42) in /home/vol9_4/byethost8.com/b8_14940267/htdocs/core/classes/autoload.php on line 69

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...