Jump to content

Problem integrating airline stats into static website


ahughes3

Recommended Posts

Hi all,

I am hoping someone can help me figure something out.

I am trying to show "recent pilots" data on a static page on our airline website. I have added the codon.config.php at the start of the page and the pasted the code snippet from the tpl file "recentpilots" into my web page.

Nothing shows up. I am obviously inserting or referencing the code incorrectly but not being that clued up on php I can't see what's wrong myself.

Can anyone offer a helping hand to explain where I'm going wrong?

Code is below (this is not the whole page, just the part relating to the recent pilots)

<?php
include 'http://www.bluespiritva.co.uk/airline-operations/core/codon.config.php';
?>
<div class="column">
  <div id="featured">
    <h2>Newest Pilots</h2>
<?php
foreach($pilots as $pilot)
{
?>
<p><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></a></p>
<?php
}
?>
  </div>

Link to comment
Share on other sites

Hi all,

I am hoping someone can help me figure something out.

I am trying to show "recent pilots" data on a static page on our airline website. I have added the codon.config.php at the start of the page and the pasted the code snippet from the tpl file "recentpilots" into my web page.

Nothing shows up. I am obviously inserting or referencing the code incorrectly but not being that clued up on php I can't see what's wrong myself.

Can anyone offer a helping hand to explain where I'm going wrong?

Code is below (this is not the whole page, just the part relating to the recent pilots)

<?php
include 'http://www.bluespiritva.co.uk/airline-operations/core/codon.config.php';
?>
<div class="column">
 <div id="featured">
 <h2>Newest Pilots</h2>
<?php
foreach($pilots as $pilot)
{
?>
<p><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></a></p>
<?php
}
?>
 </div>

Hello sir,

Just to quickly confirm you want to show recent pilots on your website? If so find the code below:

<?php MainController::Run('Pilots', 'RecentFrontPage', 5); ?>

Where the 5 is change to how many you want to show.

Regards

Link to comment
Share on other sites

Hi Daniel,

Thanks for your reply. I took your code and placed it instead of the code I had like below but nothing shows up and it prevents the code further down the page from showing up either. Take a look at http://www.bluespiritva.co.uk/airline-flight-tracker.php and you'll see what I mean.

<?php
include 'http://www.bluespiritva.co.uk/airline-operations/core/codon.config.php';
?>
<div class="column">
  <div id="featured">
    <h2>Newest Pilots</h2>
<?php MainController::Run('Pilots', 'RecentFrontPage', 5); ?>
  </div>

Link to comment
Share on other sites

Hmm, when I add this code it, the whole sidebar breaks and I only see the first div. When I take the code out it all comes back ok. I've pasted the whole page coding just incase there is something else I'm missing.

<?php
include 'http://www.bluespiritva.co.uk/airline-operations/core/codon.config.php';
?>
<div class="column">
  <div id="featured">
    <h2>Newest Pilots</h2>
  </div>
  <div id="featured">
    <h2>Recent Forum Posts</h2>
    <?php
require_once('forum/config.php');
$link = mysql_connect($dbhost,$dbuser,$dbpasswd);
mysql_select_db($dbname, $link);
$result = mysql_query("SELECT * FROM `phpbb_posts` ORDER BY `post_id` DESC LIMIT 5", $link);

while($r = mysql_fetch_array($result))
{
	 echo "<a href=\"http://www.bluespiritva.co.uk/forum/viewtopic.php?f=7&t=76" . $r['post_id'] . "\">" . $r['post_subject'] . "</a><br />";
}
?></div>
  <div id="featured">
    <h2>Pilots on Teamspeak</h2>
	 <div id="ts3viewer_1020584" style="width:; background-color:;"> </div>
<script type="text/javascript" src="http://static.tsviewer.com/short_expire/js/ts3viewer_loader.js"></script>
<script type="text/javascript">
<!--
var ts3v_url_1 = "http://www.tsviewer.com/ts3viewer.php?ID=1020584&text=000000&text_size=12&text_family=1&js=1&text_s_weight=bold&text_s_style=normal&text_s_variant=normal&text_s_decoration=none&text_s_color_h=525284&text_s_weight_h=bold&text_s_style_h=normal&text_s_variant_h=normal&text_s_decoration_h=underline&text_i_weight=normal&text_i_style=normal&text_i_variant=normal&text_i_decoration=none&text_i_color_h=525284&text_i_weight_h=normal&text_i_style_h=normal&text_i_variant_h=normal&text_i_decoration_h=underline&text_c_weight=normal&text_c_style=normal&text_c_variant=normal&text_c_decoration=none&text_c_color_h=525284&text_c_weight_h=normal&text_c_style_h=normal&text_c_variant_h=normal&text_c_decoration_h=underline&text_u_weight=bold&text_u_style=normal&text_u_variant=normal&text_u_decoration=none&text_u_color_h=525284&text_u_weight_h=bold&text_u_style_h=normal&text_u_variant_h=normal&text_u_decoration_h=none";
ts3v_display.init(ts3v_url_1, 1020584, 100);
-->
</script>
  </div>
  <!-------------------------------------------------------->
  <div align="center">
<table class="qtable" width="200px" style="margin-left:-4px;">
<tbody>
<tr>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
	 <strong>Flights Today</strong>
	 </div></td><br />
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="center"><span class="label"><?php echo StatsData::totalflightstoday(); ?></span></div></td>
</tr>
<tr>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
	 <strong>Total Flights</strong>
	 </div></td>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="center"><span class="label"><?php echo StatsData::TotalFlights(); ?></span></div></td>
</tr>
<tr>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
	 <strong>Registrations Status</strong>
	 </div></td>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="center"><span class="success label">OPEN</span></div></td>
</tr>
<tr>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
	 <strong>Total Pilots</strong>
	 </div></td>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="center"><span class="label">375</span></div></td>
</tr>
<tr>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
	 <strong>Total Passengers Carried</strong>
	 </div></td>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left"><span class="label"><?php echo StatsData::TotalPaxCarried (); ?></span></div></td>
</tr><tr>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
	 <strong>Total Aircraft</strong>
	 </div></td>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left"><span class="label"><?php echo StatsData::TotalAircraftInFleet () ; ?></span></div></td>
</tr>
<tr>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
	 <strong>Total Schedules</strong>
	 </div></td>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left"><span class="label"><?php echo StatsData::TotalSchedules (); ?></span></div></td>
</tr>
<tr>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
	 <strong>Pending Applications</strong>
	 </div></td>
	 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left"><span class="alert label"><?php echo count(PilotData::GetPendingPilots())?></span></div></td>
  </tr></tbody></table></div>
  ----------------------------------------------------------->
  <div class="holder">
    <script type="text/javascript" src="http://jk.revolvermaps.com/r.js"></script><script type="text/javascript">rm_f1st('8','200','true','false','000000','afpo5r6m7b8','true','ff0000');</script><noscript><applet codebase="http://rk.revolvermaps.com/j" code="core.RE" width="260" height="260" align="absmiddle" archive="g.jar"><param name="cabbase" value="g.cab" /><param name="r" value="true" /><param name="n" value="false" /><param name="i" value="afpo5r6m7b8" /><param name="m" value="8" /><param name="s" value="200" /><param name="c" value="ff0000" /><param name="v" value="true" /><param name="b" value="000000" /><param name="rfc" value="true" /></applet></noscript>
  </div>
   </div>

Link to comment
Share on other sites

  • Moderators

That's why It's not showing since it's not linked or connected to "Maincontroller()" function. I suggest you create a module inside the system and copy your entire codes from .php to a .tpl. Then show the .tpl as a page. :D

Link to comment
Share on other sites

  • Members

Try this code

<?php
include($_SERVER['DOCUMENT_ROOT'].'test/phpvms/core/codon.config.php');
?>
<html>
<div class="column">
	 <div id="featured">
		 <h2>Newest Pilots</h2>
	 </div>
	 <div id="featured">
		 <h2>Recent Forum Posts</h2>
<?php
 /*require_once('forum/config.php');
 $link = mysql_connect($dbhost,$dbuser,$dbpasswd);
 mysql_select_db($dbname, $link);
 $result = mysql_query("SELECT * FROM `phpbb_posts` ORDER BY `post_id` DESC LIMIT 5", $link);
 while($r = mysql_fetch_array($result))
 {
	 echo "<a href=\"http://www.bluespiritva.co.uk/forum/viewtopic.php?f=7&t=76" . $r['post_id'] . "\">" . $r['post_subject'] . "</a><br />";
 }*/
?>
</div>
	 <div id="featured">
		 <h2>Pilots on Teamspeak</h2>
			 <div id="ts3viewer_1020584" style="width:; background-color:;"> </div>
<script type="text/javascript" src="http://static.tsviewer.com/short_expire/js/ts3viewer_loader.js"></script>
<script type="text/javascript">
<!--
var ts3v_url_1 = "http://www.tsviewer.com/ts3viewer.php?ID=1020584&text=000000&text_size=12&text_family=1&js=1&text_s_weight=bold&text_s_style=normal&text_s_variant=normal&text_s_decoration=none&text_s_color_h=525284&text_s_weight_h=bold&text_s_style_h=normal&text_s_variant_h=normal&text_s_decoration_h=underline&text_i_weight=normal&text_i_style=normal&text_i_variant=normal&text_i_decoration=none&text_i_color_h=525284&text_i_weight_h=normal&text_i_style_h=normal&text_i_variant_h=normal&text_i_decoration_h=underline&text_c_weight=normal&text_c_style=normal&text_c_variant=normal&text_c_decoration=none&text_c_color_h=525284&text_c_weight_h=normal&text_c_style_h=normal&text_c_variant_h=normal&text_c_decoration_h=underline&text_u_weight=bold&text_u_style=normal&text_u_variant=normal&text_u_decoration=none&text_u_color_h=525284&text_u_weight_h=bold&text_u_style_h=normal&text_u_variant_h=normal&text_u_decoration_h=none";
ts3v_display.init(ts3v_url_1, 1020584, 100);
-->
</script>
	 </div>
	 <!-------------------------------------------------------->
	 <div align="center">
<table class="qtable" width="200px" style="margin-left:-4px;">
<tbody>
<tr>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
			 <strong>Flights Today</strong>
			 </div></td><br />
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="center"><span class="label"><?php echo StatsData::totalflightstoday(); ?></span></div></td>
</tr>
<tr>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
			 <strong>Total Flights</strong>
			 </div></td>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="center"><span class="label"><?php echo StatsData::TotalFlights(); ?></span></div></td>
</tr>
<tr>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
			 <strong>Registrations Status</strong>
			 </div></td>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="center"><span class="success label">OPEN</span></div></td>
</tr>
<tr>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
			 <strong>Total Pilots</strong>
			 </div></td>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="center"><span class="label">375</span></div></td>
</tr>
<tr>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
			 <strong>Total Passengers Carried</strong>
			 </div></td>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left"><span class="label"><?php echo StatsData::TotalPaxCarried (); ?></span></div></td>
</tr><tr>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
			 <strong>Total Aircraft</strong>
			 </div></td>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left"><span class="label"><?php echo StatsData::TotalAircraftInFleet () ; ?></span></div></td>
</tr>
<tr>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
			 <strong>Total Schedules</strong>
			 </div></td>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left"><span class="label"><?php echo StatsData::TotalSchedules (); ?></span></div></td>
</tr>
<tr>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left">
			 <strong>Pending Applications</strong>
			 </div></td>
			 <td style="border-bottom:1px dashed #CDCDCD;"><div align="left"><span class="alert label"><?php echo count(PilotData::GetPendingPilots())?></span></div></td>
	 </tr></tbody></table></div>
	 ----------------------------------------------------------->
	 <div class="holder">
		 <script type="text/javascript" src="http://jk.revolvermaps.com/r.js"></script><script type="text/javascript">rm_f1st('8','200','true','false','000000','afpo5r6m7b8','true','ff0000');</script><noscript><applet codebase="http://rk.revolvermaps.com/j" code="core.RE" width="260" height="260" align="absmiddle" archive="g.jar"><param name="cabbase" value="g.cab" /><param name="r" value="true" /><param name="n" value="false" /><param name="i" value="afpo5r6m7b8" /><param name="m" value="8" /><param name="s" value="200" /><param name="c" value="ff0000" /><param name="v" value="true" /><param name="b" value="000000" /><param name="rfc" value="true" /></applet></noscript>
	 </div>
 </div>
 </html>

On my setup this seems to be working i have a small doubt about the forum recent posts thats why i commented it out

only edit the include($_SERVER['DOCUMENT_ROOT'].'test/phpvms/core/codon.config.php');

to match your setup.

Link to comment
Share on other sites

  • Moderators

:). Okay create a folder and name it "name". Inside the folder create a file using notepad and name it "name.php". And now create a file and copy the entire page codes in it and name it "name.tpl". At last, write the following codes inside "name.php":


class Name extends CodonModule //Name can be any names.
{

   public function index()
   {
       $this->show('name.tpl');
   }
}

Upload folder "name" into your core/modules folder and "name.tpl" into your lib/skins/skinfolder.

Access the page by "http://www.yoursite.com/index.php/name" and you're done. :D

Link to comment
Share on other sites

Your include can't have http://... It needs to be relative or from the server root, so for example:

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

Or relative to the file you're working in:

include('../../test/core/codon.config.php');

That. The reason why is to add security to server files and to ensure that the Php script is not accessed outside of your domain. If such security measures was not taken then I can simply copy/paste your include and access your entire Database. Fortunately, the include function is scripted so that I cannot.

Link to comment
Share on other sites

@Parkho - I did what you suggested but it hasn't worked. All it does is show me the index page to my site with no css and no sidebar stats.

@Tom - I've tried this too by using airline-operations/core/codon.config.php (where "airline-operations" is my main phpvms install folder, one level down from my main domain)

I'm getting to the point where I've tried countless ways of writing, saving and testing and nothing seems to work. I find it hard to believe it's not possible given that there are much bigger and more complex sites than mine that pull data from tables contained at sub domain level.

Is there no one out there that can help me understand where I'm going wrong. I have teamviewer if someone feels up to helping me. (I can't believe I'm the only one in this situation)

Thanks

Link to comment
Share on other sites

  • Moderators

Okay! I created a new module and used your codes in the .tpl and changed some parts to work.

First off! the folder name of the module is case sensitive with the .php file inside meaning if the folder name is "Name" the .php file has to be the same as "Name.php"

Secondly, In your codes I saw you were trying to connect to DB, I got rid of that part and created a data class for you so you don't need to connect to DB any more.

Thirdly, I have attached the module with the tpl file and it's ready to be used.

Proof:

proof.png

NewPage_V1.0.zip

Link to comment
Share on other sites

Parkho, many thanks for the time you spent on putting this together for me. I have uploaded it into my php structure. I have a question for you......on your image, the data appears on a phpvms page. My situation is slightly different.

I have a website www.bluespiritva.co.uk and this is made up of a bunch on php pages with includes for the header, footer and sidebar. In a sub-domain (www.bluespiritva.co.uk/airline-operations) I have installed my phpvms site. So, whilst I can see it looks like you've got it working in phpvms, how would I call the page/data to a top level php page as an include. If you go take a look at my website and look at the sidebar you'll see what I mean. This is where I want the information to appear.

Also, on the www.goairuk.co.uk website, they are pulling through flight board data and all sorts into their top level domain. That's what I would like to achieve.

It was so much easier to do on FS Airlines and VAFS :(

I do appreciate your help Parkho and everyone else who's responded. :)

Link to comment
Share on other sites

  • 10 months later...

Ok so I'd like to kick this off again and to be honest I'm still don't have much idea how to do it. Let me try and explain and see how we get on.

I have an va website which is external to phpvms as follows:

http://www.virginatlanticvirtual.co.uk (main webste)

http://www.virginatlanticvirtual.co.uk/airline-operations/index.php (phpvms installation)

What I want to do is be able to show, booked flights, recent flights and active flights information on the external website homepage.

What I do know is that I need to make a connection to the database to retrieve the information stored. What I don't know is how I then setup the equivalent of a .tpl to show the right information on the external webpage. Basically I want the live flight boards type thing, but on my external website.

I am not a coder, so if anyone has some information or guidance that will help me, please offer it in laymans, idiot terms so I can follow :P

Thanks in advance for your support.

Link to comment
Share on other sites

  • Administrators

Your best bet is to connect to the codon.config.php file and then use the built in functions on your external page. Reading back through the posts I think it all boils down to not getting the connection set correctly. Use the absolute route to the file. Try creating a page and just connecting to the file and running a command like;

<?php MainController::Run('Pilots', 'RecentFrontPage', 5); ?>

do not add anything else to start, it should dump out the pilots list if you have the connection correct.

Link to comment
Share on other sites

We did Vangelis and if I'd had half a brain I would have remembered our session (in fact I think I remember a little, but I was hoping you'd have miraculously forgotten me and I could pretend like it never happened :rolleyes: then it wouldn't be half as embarrassing starting it again!)

So I will give your suggestion a go simpilot and see if I can get it showing up. Out of interest, does it matter that my website is built on wordpress? Not sure how php works in the normal pages and widgets. I suspect it might require a php page of its own which is then shortcoded in a wordpress page?

I'll post back in a bit if I can't crack it. Thanks as always chaps.

Link to comment
Share on other sites

Right so I may have made a bit of progress. I am using "shortcode exec php" which is a plugin for wordpress that allows you to enter php code (minus the php tags) and then execute it. You can then save it and it creates a shortcode to enter on a standard wordpress page.

The code I used is:

include($_SERVER['DOCUMENT_ROOT'].'/airline-operations/core/codon.config.php');

$con=mysqli_connect("localhost","spiritc1","H0llsh3l@3","spiritc1_phpvms");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

MainController::Run('Pilots', 'RecentFrontPage', 5);

mysqli_close($con);

This resulted in this output:

[url="http://www.virginatlanticvirtual.co.uk/airline-operations/index.php/profile/view/15"]VIR015 Jay Abbott[/url]
[url="http://www.virginatlanticvirtual.co.uk/airline-operations/index.php/profile/view/3"]VIR003 Macauley Grisedale[/url]
[url="http://www.virginatlanticvirtual.co.uk/airline-operations/index.php/profile/view/1"]VIR001 Andy Hughes[/url][live_boards_test]="HTML
[url="http://www.virginatlanticvirtual.co.uk/airline-operations/index.php/profile/view/16%22>"]http://www.virginatl...ofile/view/16">[/url]
VIR016 Aaron Sear </a>
</p>
<p>
<a href="[url="http://www.virginatlanticvirtual.co.uk/airline-operations/index.php/profile/view/15%22>"]http://www.virginatl...ofile/view/15">[/url]
VIR015 Jay Abbott </a>
</p>
<p>
<a href="[url="http://www.virginatlanticvirtual.co.uk/airline-operations/index.php/profile/view/3%22>"]http://www.virginatl...rofile/view/3">[/url]
VIR003 Macauley Grisedale </a>
</p>
<p>
<a href="[url="http://www.virginatlanticvirtual.co.uk/airline-operations/index.php/profile/view/1%22>"]http://www.virginatl...rofile/view/1">[/url]
VIR001 Andy Hughes </a>
</p>
[live_boards_test]="

I'm assuming this means that I connected fine to main controller and pulled results from the database, although it looks a right mess obviously.

Next challenge is to try it in a proper worpress page and see what it does.

Link to comment
Share on other sites

  • Administrators

You can remove

$con=mysqli_connect("localhost","spiritc1","H0llsh3l@3","spiritc1_phpvms");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

and

mysqli_close($con);

When you load the codon config file it is already making the database connection so another is not necessary.

The styling is coming from the template file that the list uses. frontpage_recentpilots.tpl

Link to comment
Share on other sites

I'm soooo not good at this coding lark and adding wordpress into the mix just makes it 10 times more complicated for me :wacko:

So, update. When I enter this code into the page:

<?php
include($_SERVER['DOCUMENT_ROOT'].'airline-operations/core/codon.config.php');
?>

Everything is ok and my page still has the sidebar and everything. But the page is blank, obviously. As soon as I enter the following code into the mix, it breaks my page and I lose my sidebar and widgets.

<?php MainController::Run('Pilots', 'RecentFrontPage', 5); ?>

I have no idea why. I get the connection to the database bit, but don't understand why the next bit breaks the page. Is it because of the template style it's trying to use?

Link to comment
Share on other sites

  • Members

from my experience with joomla i had the same problem whenever i made a module with some info from phpvms the site broke down most propably due the incompartibility of the 2 frameworks

what i have done is setted up my joomla site and then made the same templte for phpvms.

if you want you can have an idea at www.gsairways.gr

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...