nexiss Posted April 22, 2009 Report Posted April 22, 2009 Hi all, I have finaly cracked it (well sort of) not bad for a php virgin lol I have to say I am no php coder and am stunned that I got this far! which to be honest I wouldn't have done if it wasn't for all you good people on the forum offering advice and Nabeel pointing me in the right direction, and his tutorials Feel free to use what I have done so far and if you fancy getting it to do what I need it to do (making links Clickable) and don't mind letting me have a copy please feel free, if no one develops it I will try eventually but I've got alot more learning to do first. Once again thankyou to all those that helped me. Regards Karl Latest Bids.zip Quote
nexiss Posted April 22, 2009 Author Report Posted April 22, 2009 Hi all there seems to be a problem I have tried it and there only seems to be one bid showing regardless of how many there are, if anyone can spot my mistake please let me know many thanks Quote
RogerB Posted April 23, 2009 Report Posted April 23, 2009 I noticed in your code you use last bids?? I tried switching it to just bids, but no go. This doesn't work at all for me. Quote
nexiss Posted April 23, 2009 Author Report Posted April 23, 2009 Hi roger I have re zipped (LatestBidsV01.zip) the files (the ones I'm using) and tested it on a new install on my test machine, it works but only shows the last bid (problem I can't work out), I was hoping that someone would be good enough to pick this up and help us out a little but until they do I am going to have to try and work it out when I get some spare time! unfortunatley real planes at stansted take up much of my time at work lol also in the zip I have included the test module I used to tap the api based on Nabeels Tutorial which shows the last five bids, to use it, in the core/Modules/FrontBids folder rename "frontBids" to something else and rename "Test" to "FrontBids" then to call it go "http://www.yoursite.com/index.php/FrontBids" it is obviously raw data but you may be able to do something with it. please bare in mind that things are case sensitive If you have any success please let me know. Karl LatestBidsV01.zip Quote
RogerB Posted April 23, 2009 Report Posted April 23, 2009 Yeah, I had a look Karl. I will give it a shot! Lord help us all!! LOL Quote
RogerB Posted April 24, 2009 Report Posted April 24, 2009 OK, I showed what you had done to Nabeel, he corrected it as there were many mistakes. I will post when I get time. Quote
nexiss Posted April 24, 2009 Author Report Posted April 24, 2009 Roger thats great, I'm not suprised about mistakes lol, in all honesty I'm suprised I got as far as I did! I'm not a coder I'm an aircraft handler lol, but as the old saying goes you don't know unless you try and the best way to learn is to have a go. look forward to you uploading it, more out of curiosity than anything so that I can see where I went wrong. Regards Karl Quote
RogerB Posted April 25, 2009 Report Posted April 25, 2009 I removed the font code, but this is it. <?php if(!$lastbids) { echo 'No bids have been made'; return; } foreach($lastbids as $lastbid) { $pilot_info = PilotData::GetPilotData($lastbid->pilotid); echo $pilot_info->firstname; ?> <?php } ?> Quote
nexiss Posted April 25, 2009 Author Report Posted April 25, 2009 Hi Roger I'm a bit confused! does this code replace the code in the tpl file? if so this is what confuses me as I can't see any code to output the latest bid fields, or has some thing changed in the module aswell, I did try this code in the tpl file but got a blank output Quote
RogerB Posted April 26, 2009 Report Posted April 26, 2009 Here is what he sent, sorry about that. <style type="text/css"> <!-- .style2 { font-family: Arial; font-size: 10px; } --> </style> <?php if(!$lastbids) { echo 'No bids have been made'; return; } foreach($lastbids as $lastbid) { $pilot_info = PilotData::GetPilotData($lastbid->pilotid); echo $pilot_info->firstname; ?> <p class="style2"><?php echo $lastbid->bidid . ' - ' . $lastbid->code.$lastbid->flightnum.' - '.$lastbid->depicao.' to '.$lastbid->arricao?> </p> <?php } ?> Quote
nexiss Posted April 28, 2009 Author Report Posted April 28, 2009 sweet as this works a treat! thankyou roger and Nabeel. Just to put my confusion to rest, what is the pilot info bit all about? I would love for someone to put a detailed tutorial up here expalining what the relation ship between templates and modules is, i.e. why certain bits of code go in templates and other bits of code go in the modules and how you would get the contents of a module to show with formating without a template i.e. the hub map. I would love to make lots of addons for this system, it has huge potential but I having trouble just getting my head around the basics. anyway thanks guys what I was trying to do works now reagrds karl Quote
RogerB Posted April 28, 2009 Report Posted April 28, 2009 Ok, It still doesn't work for me at all, it never shows a bid. Quote
Administrators Nabeel Posted April 28, 2009 Administrators Report Posted April 28, 2009 sweet as this works a treat! thankyou roger and Nabeel. Just to put my confusion to rest, what is the pilot info bit all about? I would love for someone to put a detailed tutorial up here expalining what the relation ship between templates and modules is, i.e. why certain bits of code go in templates and other bits of code go in the modules and how you would get the contents of a module to show with formating without a template i.e. the hub map. I would love to make lots of addons for this system, it has huge potential but I having trouble just getting my head around the basics. anyway thanks guys what I was trying to do works now reagrds karl Basically, it goes like this: mysite.com/index.php/MODULE then MODULE -> Template A module is what's called a "controller", which handles the logic, getting data from a model (the api), and passing that data to a view (template) to output. Usually, most new programmers will plop everything into one file - all their SQL, their PHP and the HTML, all into one big file, which makes it a mess to extend, and a big mess to debug and eventually the next person who has to look at it, will shoot themselves (I come across alot of this code, it's not pretty). But this method is called "MVC" programming, "Model-view-controller", where the controller (a module) is the brain for that peice, and it will talk to the model (api) and then send its final data to the view (a template). This way is very powerful as you can shift things around, etc. In my methodology, I do the main Template::Set() calls in the Controller after getting the data from the model, and then Template::Show(), then in the template, I show the final output. That way, there are no calls to the model within a template, and it's very clear where to look for specific things; if you want to know how variables are set for the template, you check the controller. If you want to see what template is called, you check the controller. If you want to see what data is used, you check the controller, then you check the model since you'll know the exact path it's taking. And you can wrestle around with the template without touching anything in the controller or model. This way it's also really easy to see where bugs really are. Maybe reading this will help: http://en.wikipedia.org/wiki/Model-view-controller http://www.codinghorror.com/blog/archives/001112.html Quote
nexiss Posted April 28, 2009 Author Report Posted April 28, 2009 Nabeel thanks for that, its very interesting reading. I will have to educate myself in writing php proberly! how people write it like a second language is beyond me, so I give enyone that can write it full credit. Roger what have you done and whats the problem, I have my bids showing up on the front page, but they are not clickable, thats my next hurdle! take a look at www.nexissair.co.uk please excuse the skin, I was just learning however am in the process of making a nice clean proffessional looking one as we speak. If I can help in any way just drop me a line Karl Quote
RogerB Posted April 28, 2009 Report Posted April 28, 2009 You can view mine on the front page, no glory yet. I used the code Nabeel fixed and your module but no luck. did you change anything?? Quote
nexiss Posted April 29, 2009 Author Report Posted April 29, 2009 Hi Roger no I didn't change a thing, I used the original module, and just pasted the code you posted on here into my template, I then just called it into the front page using MainController::Run('FrontBids', 'RecentFrontPage'); FrontBids being the module and RecentFrontPage being the template Maybe a daft question but is your frontbids module folder definatly labeled "FrontBids" and your module inside that labeled the same? Note the capital letters! the same goes for when you call it in the front page. Quote
RogerB Posted April 30, 2009 Report Posted April 30, 2009 yeah I checked all that, nothing. Not sure what could be wrong. Quote
Administrators Nabeel Posted April 30, 2009 Administrators Report Posted April 30, 2009 Put an echo in the function the recentfrontpage like echo "hello";, just to see if it's being called? Quote
RogerB Posted April 30, 2009 Report Posted April 30, 2009 When I go directly to the module, "index.php/FrontBids" I get nothing there either. Quote
nexiss Posted April 30, 2009 Author Report Posted April 30, 2009 Thats really weird, just incase there is a difference between files I have re attached the files I'm using. As before the FrontBids folder goes in your core/Modules folder and the Frontpage_recentbids.tpl goes in your lib/skins/yourskin folder. other than this I really don't know what else to suggest, Nabeel is the pro in this field, time permitting I guess Latest Front Page Bids.zip Quote
RogerB Posted April 30, 2009 Report Posted April 30, 2009 It doesn't work on my test site either. Quote
RogerB Posted April 30, 2009 Report Posted April 30, 2009 Nabeel, it echos the "no bids have been made" output, thats all........... Quote
RogerB Posted May 3, 2009 Report Posted May 3, 2009 Well, I guess I will just delete this module and worry about it later. Quote
RogerB Posted May 19, 2009 Report Posted May 19, 2009 I don't understand why its not cooperating with me damn it..........LOL Quote
RogerB Posted May 19, 2009 Report Posted May 19, 2009 OK, I noticed in the code your calling "last bid". Where is that coming from? I don't have it in my database anywhere that I can see. Quote
selwynorren Posted June 1, 2009 Report Posted June 1, 2009 Hi All Have you guys been able to sort this out, Roger I get exactly the same as you. I think its a neat module, but it does not work at all Quote
Nagelfar Posted June 21, 2009 Report Posted June 21, 2009 jeah since the last major update it´s broken:-( PLEASE repair it! 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.