Members Vangelis Posted February 24, 2010 Members Report Posted February 24, 2010 Hello guys I am trying to make the pilot roster to show only the pilots and i have managed this the only problem is that it keeps looping the pilot_list.tpl i have also tried to insert my own page into it like <?php echo "Hello World"; ?> and this keeps looping asswel so i am sure that the code is corect This is the code of the pilot_list.tpl <?php $roster = PilotData::getAllPilots(); ?> <?php if(!$roster) { echo 'There are no pilots!'; return; } ?> <table id="tabledlist" class="tablesorter"> <thead> <tr> <th>Pilot ID</th> <th>Name</th> <th>Rank</th> <th>Flights</th> <th>Hours</th> <th>HUBs</th> </tr> </thead> <tbody> <?php foreach($roster as $pilot) { ?> <tr> <td width="1%" nowrap> <img src="<?php echo Countries::getCountryImage($pilot->location);?>" alt="<?php echo Countries::getCountryName($pilot->location);?>" /> <a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>"> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a> </td> <td> <center><?php echo $pilot->firstname.' '.$pilot->lastname?></center> </td> <center><td><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td></center> <center><td><?php echo $pilot->totalflights?></td></center> <center><td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td></center> <center><td><?php echo $pilot->hub?></td></center> </tr> <?php } ?> </tbody> </table> any help would be gratefull Thanks in advance Vangelis Boulasikis http://aviation-global-airways.com Quote
Administrators simpilot Posted February 25, 2010 Administrators Report Posted February 25, 2010 Your page is good. I think it is how you are calling it. Are you still using the address as www.yoursite.com/index.php/pilots ? If so, you are calling the functions within the module which will seperate the pilots into hubs everytime. Best bet is to create a new path to the page. Either using the page function in admin or through a new module. I pasted your code into a blank page without using the pilots module and it works fine... Hope this helps a little. Quote
Members Vangelis Posted February 25, 2010 Author Members Report Posted February 25, 2010 Your page is good. I think it is how you are calling it. Are you still using the address as www.yoursite.com/index.php/pilots ? If so, you are calling the functions within the module which will seperate the pilots into hubs everytime. Best bet is to create a new path to the page. Either using the page function in admin or through a new module. I pasted your code into a blank page without using the pilots module and it works fine... Hope this helps a little. could you please help on how to do that or an example of this ? Thanks in advance Vangelis Boulasikis P.S Temporarly i stoped the problem by leaving only 1 hub but like that we can not gice the option to the new pilots to select their hub Quote
Administrators Nabeel Posted February 25, 2010 Administrators Report Posted February 25, 2010 You have to modify the module to get it to work right... if you do a search it's come up before Quote
Members Vangelis Posted February 25, 2010 Author Members Report Posted February 25, 2010 You have to modify the module to get it to work right... if you do a search it's come up before Do u have a name for that module ? Thanks Quote
Administrators simpilot Posted February 25, 2010 Administrators Report Posted February 25, 2010 Without creating another module or a new page for your site you can open pilots.php in your core/modules/pilots folder and find the index section -> public function index() { // Get all of our hubs, and list pilots by hub $allhubs = OperationsData::GetAllHubs(); if(!$allhubs) $allhubs = array(); foreach($allhubs as $hub) { $this->set('title', $hub->name); $this->set('icao', $hub->icao); $this->set('allpilots', PilotData::findPilots(array('p.hub'=>$hub->icao))); $this->render('pilots_list.tpl'); } $nohub = PilotData::findPilots(array('p.hub'=>'')); if(!$nohub) { return; } $this->set('title', 'No Hub'); $this->set('icao', ''); $this->set('allpilots', $nohub); $this->render('pilots_list.tpl'); } and change it to public function index() { $this->set('allpilots', PilotData::getAllPilots()); $this->render('pilots_list.tpl'); } Just remember when you update this will be overwritten to the default structure. You would be better served to create a new page and/or module. Quote
Members Vangelis Posted February 26, 2010 Author Members Report Posted February 26, 2010 That worked Thanks a lot for your help Vangelis Boulasikis Quote
RogerB Posted March 5, 2010 Report Posted March 5, 2010 I am going to make a tutorial about how to make some custom pages, and changes. Quote
Guest Brian Posted March 5, 2010 Report Posted March 5, 2010 All that really needs to be done is to render the object into the template. Quote
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.