WiltshireAirlines Posted June 7, 2014 Report Share Posted June 7, 2014 Hello everybody, I've noticed that a lot of VA's direct you to a management page, separate from the main site, when you log in. This page usually has a completely different template. I have the content all ready - I'm just not quite sure how to make a new page (just one page) with a separate template, but still be able to access the database in the very same way that I do on every other page (because I'm copying some code over). Thanks so much for the help in advance! Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted June 7, 2014 Moderators Report Share Posted June 7, 2014 Have you tried to use this? <?php require('codon.config.php directory'); // Call the phpVMS config file ?> Quote Link to comment Share on other sites More sharing options...
WiltshireAirlines Posted June 7, 2014 Author Report Share Posted June 7, 2014 I have no php knowledge whatsoever...would I put that code in the php code on the page I'm trying to add? Quote Link to comment Share on other sites More sharing options...
Shepred Posted June 7, 2014 Report Share Posted June 7, 2014 I have no php knowledge whatsoever...would I put that code in the php code on the page I'm trying to add? I haven't actually tried this myself, however, my guess would be: include the call for the phpVMS config at the beginning of either the index page, or each seperate page, where you wish to load phpVMS functions. I believe you will then be able to call phpVMS functions as usual. .. Again, haven't tried this myself. Quote Link to comment Share on other sites More sharing options...
WiltshireAirlines Posted June 7, 2014 Author Report Share Posted June 7, 2014 Thanks, I've done that...the page is completely blank, just a white page. Quote Link to comment Share on other sites More sharing options...
Shepred Posted June 7, 2014 Report Share Posted June 7, 2014 Thanks, I've done that...the page is completely blank, just a white page. Alright, have you included any call from phpVMS? For an example, add the above call and then try calling the airline name: <?php echo SITE_NAME; ?> Quote Link to comment Share on other sites More sharing options...
magicflyer Posted June 7, 2014 Report Share Posted June 7, 2014 (edited) Thanks, I've done that...the page is completely blank, just a white page. When you include the php file, be sure it is within the <body> tag, and not in the <head></head>. Edit after Tom's Comment: Also be sure to have it before any other content in the <body></body> tag. Edited June 7, 2014 by magicflyer Quote Link to comment Share on other sites More sharing options...
Tom Posted June 7, 2014 Report Share Posted June 7, 2014 When you include the php file, be sure it is within the <body> tag, and not in the <head></head>. To clarify, when including the codon config mentioned above it should be before any HTML output. Anything you want to appear on the page should be within the body tags. 1 Quote Link to comment Share on other sites More sharing options...
WiltshireAirlines Posted June 7, 2014 Author Report Share Posted June 7, 2014 Is it linked to layout.tpl? If not, then that's my mistake. Quote Link to comment Share on other sites More sharing options...
magicflyer Posted June 7, 2014 Report Share Posted June 7, 2014 It is not linked to layout.tpl, you'll have to call individual methods yourself. Your best friend will become MainController::Run(); when it comes to this. Quote Link to comment Share on other sites More sharing options...
StartVM Posted June 7, 2014 Report Share Posted June 7, 2014 Try this as a template http://pastebin.com/WvZTCLvq Quote Link to comment Share on other sites More sharing options...
WiltshireAirlines Posted June 7, 2014 Author Report Share Posted June 7, 2014 I used the template and now it shows my background but no text, even when there is text on the page. Quote Link to comment Share on other sites More sharing options...
WiltshireAirlines Posted June 7, 2014 Author Report Share Posted June 7, 2014 I think it's because the php is being weird. The page works fine everywhere else, just not in the home directory. Are you sure I can use php in the same way in any directory? Quote Link to comment Share on other sites More sharing options...
Tom Posted June 7, 2014 Report Share Posted June 7, 2014 I don't think my point was well explained/understood. Here's a valid example starting point: <?php // To avoid errors, this should go before *any* HTML output require('/path/to/codon.config.php'); // Call the phpVMS config file ?> <!doctype html> <html> <head> <title>Untitled Document</title> <!-- Insert any Style Sheets --> </head> <body> <!-- Page Content --> </body> </html> It would be easiest for us to help if you could post the source you're using. Quote Link to comment Share on other sites More sharing options...
WiltshireAirlines Posted June 7, 2014 Author Report Share Posted June 7, 2014 I used that template. Unfortunately, there's still a blank page - even when commenting the php. So I now know that it's not a PHP error, nor is it a problem with the template. Here's my source using your template (and with the php commented): <?php // To avoid errors, this should go before *any* HTML output require('/path/to/codon.config.php'); // Call the phpVMS config file ?> <!doctype html> <html> <head> <title>Untitled Document</title> <!-- Insert any Style Sheets --> <!-- JS BELOW --> <script> $(function() { var items = $('#v-nav>ul>li').each(function() { $(this).click(function() { //remove previous class and add it to clicked tab items.removeClass('current'); $(this).addClass('current'); //hide all content divs and show current one $('#v-nav>div.tab-content').hide().eq(items.index($(this))).show('fast'); window.location.hash = $(this).attr('tab'); }); }); if (location.hash) { showTab(location.hash); } else { showTab("tab1"); } function showTab(tab) { $("#v-nav ul li:[tab*=" + tab + "]").click(); } // Bind the event hashchange, using jquery-hashchange-plugin $(window).hashchange(function() { showTab(location.hash.replace("#", "")); }) // Trigger the event hashchange on page load, using jquery-hashchange-plugin $(window).hashchange(); }); </script> <!-- JS ABOVE --> </head> <body> <!--<?php require('codon.config.php directory'); // Call the phpVMS config file ?>--> <section id="wrapper" class="wrapper"> <div id="v-nav"> <ul> <li tab="tab1" class="first current"><a href="#">Dashboard</a></li> <li tab="tab2"><a href="#">Statistics & Awards</a></li> <li tab="tab3"><a href="#">Support</a></li> </ul> <div class="tab-content"> <h4>News & Notifications</h4> <i>No recent news. For all updates, check our <a href="https://plus.google.com/100776819388226273202/posts">Google+</a> page. </i> <br><br> <h4>Live Flights</h4> <!--<?php Template::Show('acarsmap.tpl'); ?>--> <br><br> </div> <div class="tab-content"> <h4>My Statistics</h4> <ul style="margin-top: 0px;"> <li><strong>Your Pilot ID: </strong> <?php echo $pilotcode; ?></li> <li><strong>Your Rank: </strong><?php echo $pilot->rank;?></li> <!--<?php if($report) { ?>--> <li><strong>Latest Flight: </strong><a href="<?php echo url('pireps/view/'.$report->pirepid); ?>"> <?php echo $report->code . $report->flightnum; ?></a> </li> <!--<?php } ?>--> <li><strong>Total Flights: </strong><?php echo $pilot->totalflights?></li> <li><strong>Total Hours: </strong><?php echo $pilot->totalhours; ?></li> <li><strong>Total Transfer Hours: </strong><?php echo $pilot->transferhours?></li> <li><strong>Total Money: </strong><?php echo FinanceData::formatMoney((floatval($pilot->totalpay) + floatval($pilot->payadjust))) ?></li> <!--<?php if($nextrank) { ?>--> <br><p>You have to fly <?php echo ($nextrank->minhours - $pilot_hours)?> more hours until you promote to <?php echo $nextrank->rank?></p> <!--<?php } ?>--> </ul> <br><br> <h4>Airline Statistics</h4> Total Pilots: <?php echo StatsData::PilotCount(); ?><br />Pilots Pending: <?php echo count(PilotData::GetPendingPilots())?><br />Total Hours: <?php echo StatsData::TotalHours(); ?><br />Total Flights: <?php echo StatsData::TotalFlights(); ?><br />Total Distance Flown: <?php echo StatsData::TotalMilesFlown(); ?><br />Total Schedules: <?php echo StatsData::TotalSchedules (); ?><br />Total News Items: <?php echo StatsData::TotalNewsItems (); ?><br />Total Passengers Carried: <?php echo StatsData::TotalPaxCarried (); ?><br />Total Aircraft In Fleet: <?php echo StatsData::TotalAircraftInFleet () ; ?> <br><br> <h4>My Awards</h4> <!--<?php if(!$allawards) { echo 'No awards yet'; } else { /* To show the image: <img src="<?php echo $award->image?>" alt="<?php echo $award->descrip?>" /> */ ?>--> <ul> <!--<?php foreach($allawards as $award){ ?>--> <!--<li><?php echo $award->name ?></li>--> <!--<?php } ?>--> </ul> <!--<?php } ?>--> </div> <div class="tab-content"> <h4>Support</h4> <form method="post" action="<?php echo url('/contact'); ?>"> <table width='100%' border='0'> <tr> <td><strong>Name:</strong></td> <td> <!--<?php if(Auth::LoggedIn()) { echo Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname.'" />'; } else { ?>--> <input type="text" name="name" value="" /> <!--<?php } ?>--> </td> </tr> <tr> <td width="1%" nowrap><strong>E-Mail Address:</strong></td> <td> <!--<?php if(Auth::LoggedIn()) { echo Auth::$userinfo->email; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->email.'" />'; } else { ?>--> <input type="text" name="email" value="" /> <!--<?php } ?>--> </td> </tr> <tr> <td><strong>Subject: </strong></td> <td><input type="text" name="subject" value="<?php echo $_POST['subject'];?>" placeholder="Summarize your message with this line"/></td> </tr> <tr> <td><strong>Message:</strong></td> <td> <textarea name="message" cols='60' rows='10'><?php echo $_POST['message'];?></textarea> </td> </tr> <tr> <td width="1%" nowrap><strong>Captcha</strong></td> <td> <!--<?php echo recaptcha_get_html(Config::Get('RECAPTCHA_PUBLIC_KEY'), $captcha_error); ?>--> </td> </tr> <tr> <td> <input type="hidden" name="loggedin" value="<?php echo (Auth::LoggedIn())?'true':'false'?>" /> </td> <td> <input type="submit" name="submit" value='Send Message'> </td> </tr> </table> </form> </div> </div> </section> </body> </html> Quote Link to comment Share on other sites More sharing options...
Tom Posted June 7, 2014 Report Share Posted June 7, 2014 You'll need to change "/path/to/codon.config.php" to represent where the file actually is in relation to the file you're working in. Do you have a link to this on your site too? Quote Link to comment Share on other sites More sharing options...
WiltshireAirlines Posted June 7, 2014 Author Report Share Posted June 7, 2014 I'll do that. I'm stupid...haha. Um. Embarrassing. Anyway, I can't give you the link because the website hasn't been released yet. Quote Link to comment Share on other sites More sharing options...
WiltshireAirlines Posted June 7, 2014 Author Report Share Posted June 7, 2014 Still shows a blank page after that change. The file is in the home directory, where core and lib are. The link should be /core/codon.config/php, right? Quote Link to comment Share on other sites More sharing options...
Tom Posted June 7, 2014 Report Share Posted June 7, 2014 Well without being able to see what's actually happening we'll just be guessing really. Look at the source of the page, look at your PHP error log... Quote Link to comment Share on other sites More sharing options...
WiltshireAirlines Posted June 7, 2014 Author Report Share Posted June 7, 2014 I've told you pretty much all that's happening. Blank page. I'll turn on strict standards quickly... Quote Link to comment Share on other sites More sharing options...
WiltshireAirlines Posted June 7, 2014 Author Report Share Posted June 7, 2014 No errors after I turned on strict standards. However, the source says that the whole body is just "<!---->" which isn't true...I'm using syntax highlighting so I know the body isn't one whole comment. Quote Link to comment Share on other sites More sharing options...
WiltshireAirlines Posted June 8, 2014 Author Report Share Posted June 8, 2014 I got it to work, it was a careless PHP error. Thanks for all the help! Quote Link to comment Share on other sites More sharing options...
dimitris Posted June 8, 2014 Report Share Posted June 8, 2014 Hey, can you tell me how you made it to work? I get the same blank page with: <?php require("path/to/codon.config.php"); ?> Thanks! Quote Link to comment Share on other sites More sharing options...
WiltshireAirlines Posted June 8, 2014 Author Report Share Posted June 8, 2014 I had a PHP error - for me, it was the problem that I had the same php code appear twice. I removed the second one and it worked. I'm not sure what's going on with your code - you might want to try posting it here, or debugging on your own as it's probably a php error. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.