Forgive me if I’ve created a thread someone’s already started, but I can’t find information about what I’m specifically looking for. Hopefully you guys can help!
If I understand correctly, phpVMS is supposed to be the full package - you upload it to the root of your website, customize the looks of it, and BAM! you’ve got yourself an operational virtual airline complete with everything a pilot or admin needs to keep it running. I love what I’ve seen so far because I know this is a powerful tool, and I didn’t even have to pay for it! But, I want to use phpVMS separately from my main site (if I’m saying that right). I have a look I’m going for, and I’m not sure I’m good enough to manipulate a skin to fit phpVMS. I want to use the pilot center, but I would also like to use information generated by phpVMS elsewhere.
So, what I’m wanting to do is bring elements and put them on various parts of my site, like what I’ve already done with the login feature on the main sidebar.
When you aren’t logged in to the Pilot Center, you get this:
And when you are logged in, this shows:
It works great. When you login, it takes you to the pilot center, which is what I want. But, as you navigate away from the pilot center onto the main part of the site, your information goes with you.
Now, instead of updating index.php every time I post a new news post or want to get a different message across the home page, I would like to post the News feature in phpVMS. I’ll admit real quick that I’m good at recognizing what code does what, and I can manipulate it to work properly, but I really don’t know squat, and the code is where I’m having the issue.
Here is what I used when I put in the pilot/login information:
-
Lines 3-9
<?php ob_start(); include_once realpath(dirname( __FILE__ )."/pilots/core/codon.config.php"); ?> -
Lines 169 - 218
<?php /* Quick example of how to see if they're logged in or not Only show this login form if they're logged in */ if(Auth::LoggedIn() == false) { ?><form name="loginform" action="http://simulatedvirgin.com/pilots/index.php/login" method="post"> <p></p> <p><br /> <strong>Pilot ID</strong> <em>or</em> <strong>Email</strong>:<br /> <input type="text" name="email" onClick="this.value=''" /> </p> <p> </p> <p> <strong>Password</strong>:<br /><input type="password" name="password" value="" /><br /><br /> <input type="hidden" name="remember" value="on" /> <input type="hidden" name="redir" value="index.php/profile" /> <input type="hidden" name="action" value="login" /> <input type="submit" name="submit" class="button" value="Log In" /> </p> </form> </div> <?php } /* End the Auth::LoggedIn() if */ else /* else - they're logged in, so show some info about the pilot, and a few links */ { /* Auth::$userinfo has the information about the user currently logged in We will use this next line - this gets their full pilot id, formatted properly */ $pilotid = PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid); ?> <img align="left" height="50px" width="50px" style="margin-right: 10px;" src="<?php echo PilotData::getPilotAvatar($pilotid);?>" /> <strong>Pilot ID: </strong> <?php echo $pilotid ; ?><br /> <strong>Rank: </strong><?php echo Auth::$userinfo->rank;?><br /> <strong>Total Flights: </strong><?php echo Auth::$userinfo->totalflights?> <br /> <strong>Total Hours: </strong><?php echo Auth::$userinfo->totalhours;?> <br /><br /><br /></div> <dl class="nav3-grid"> <dt><a href="<?php echo url('/pireps/new');?>">File a New PIREP</a></dt> <dt><a href="<?php echo url('/schedules/bids');?>">View My Bids</a></dt> <dt><a href="<?php echo url('/profile/');?>">View Pilot Center</a></dt> <dt><a href="http://simulatedvirgin.com/pilots/index.php/logout">Logout</a></dt> </dl> <?php } /* End the else */ ?>
Now, that works. But, when I add the following to the same page as to integrate the News feature, I get an error:
<? class News extends CodonModule
{
public function index()
{
$this->ShowNewsFront(5);
}
// This function gets called directly in the template
public function ShowNewsFront($count=5)
{
$sql='SELECT id, subject, body, postedby, UNIX_TIMESTAMP(postdate) AS postdate
FROM ' . TABLE_PREFIX .'news
ORDER BY postdate DESC
LIMIT '.$count;
$res = DB::get_results($sql);
if(!$res)
return;
foreach($res as $row)
{
//TODO: change the date format to a setting in panel
$this->set('subject', $row->subject);
$this->set('body', $row->body);
$this->set('postedby', $row->postedby);
$this->set('postdate', date(DATE_FORMAT, $row->postdate));
$this->show('news_newsitem.tpl');
}
}
} ?>
And the error is:
Fatal error: Cannot redeclare class News in /homepages/11/d329479458/htdocs/index.php on line 242
I’ll admit to copy and pasting. But, I’d like to know what exactly is going wrong… maybe it won’t work altogether? Anyway, here’s what the site looks like. The link is in my signature, but the look and circumstance may change.
Am I making sense? I know this is one little issue, but I see it repeating itself as the code all looks similar.
Thanks for your time!