I'm new to coding and mostly self-taught through W3Schools and such, so bear with me.
I have a VPS that uses a Linux system. I'm creating a website for a tabletop RPG. My webpage files are mostly written in html, but are .php files since I want to use a little bit of that (mostly the "include" function, which is the source of my issue). Because of Linux, when I upload these files to the server, I go into the "home" folder, then a folder named after my username, then the "public_html" folder, so if I'm understanding the terminology correctly, I should refer to public_html as the "root directory."
So in that root directory, I have various folders and the aforementioned .php files which create the structure of my site, and all of that works fine; the site is viewable online and all. For my webpages, I use the include function to, well, include things like the header, footer, and sidebar on each page, which works fine.
In the root directory, I made a folder called "obj". This contains a large number of small .php files that are not full webpages, but rather each merely contain a set of variables that represent character stats for the RPG. So for example, one such file, called "obj.StickmanSoldier.php", has the following contents:
<?php include 'class.Character.php';
$stickmansoldier = new Character();
$stickmansoldier->name = array('Stickman Soldier','Standard Stickman Soldier');
$stickmansoldier->affinity = 'Ice';
$stickmansoldier->xp = 19;
$stickmansoldier->hp = 20;
$stickmansoldier->vp = 20;
$stickmansoldier->mp = 5;
$stickmansoldier->attack = 2;
$stickmansoldier->strength = 4;
$stickmansoldier->handeye = 5;
$stickmansoldier->platform = 3;
$stickmansoldier->weight = 3;
$stickmansoldier->icemod = '+2';
?>
I guess for clarification, that "class.Character.php" file looks like this:
<?php class Character {
public $name='???';
public $player='Maestro';
public $affinity='Earth';
public $level=0;
public $xp=0;
public $hp=1;
public $badge_hp=1;
public $current_hp=0;
public $vp=0;
public $badge_vp=0;
public $current_vp=0;
public $mp=0;
public $badge_mp=0;
public $current_mp=0;
public $status='Normal';
public $bal=0.00;
public $attack=1;
public $magic=1;
public $defense=0;
public $brain=1;
public $strength=1;
public $handeye=1;
public $platform=1;
public $knowledge=1;
public $clever=1;
public $charisma=1;
public $weight=1;
public $ap=0;
public $earthmod='--';
public $icemod='--';
public $watermod='--';
public $windmod='--';
public $firemod='--';
public $thundermod='--';
public $poisonmod='--';
public $plantmod='--';
} ?>
So in a webpage file, I can use <?php include 'obj.StickmanSoldier.php';?>
to call these stats and then use other code (like php's "echo") to display them on that page. If the page is down in a subfolder, it might instead look something like <?php include '../../obj.StickmanSoldier.php';?>
, but you get the idea. It's the same include method that I'm using for the header and footer and stuff, and it works fine for those. It also works fine when I call one of these stat files.
One.
If I include more than one of these stat files on the same webpage, then all of a sudden, all code on the page after the second include stops working, giving me a mostly blank page. Or a half-blank page if I put the include halfway down.
Now, when I say "the second include," that's ignoring the includes for the header and footer stuff, because those are there, the same as they are on all the other site pages. And if I only include one of the stat files from the obj folder, then everything works fine; I can display those stats in various forms by using the variables defined in that stat file. But when I try to include multiple stat files in the same webpage file... it does this shit.
I've checked for typos, and I've switched around which stat files I'm including, so it's not a problem with one particular stat file. There are 983 files in the obj folder, so... I'm hoping I don't have to edit all of them. But it doesn't seem like the contents are the problem. Something is just going screwy with the include function.
I haven't created a php.ini file, so if I have one, it's just the default one that came with my server. I also only named the stat files "obj.Whatever.php" because I saw somebody doing that somewhere; the "obj." part serves no function for anything I'm doing, so I can change the names if I need to, if for some reason the extra dot is causing the problem. But none of these explanations make sense given that some of the includes do work.
My site is at http://arpeggiosystem.com/ ; it's incomplete, so some of the links are broken and stuff, but if you want to see the result of this include-induced semi-blank page phenomenon I'm describing, go to http://arpeggiosystem.com/default/enemy/stick.php
EDIT: Ohhhhh... is it because all of the stat files use the include function to call the class file? Does it not like that that gets called more than once on the same page?