Bradpl6 Posted February 8, 2011 Report Posted February 8, 2011 Hi all, I'm having a bit of a struggle with the custom .htm pages, I can get php to work however when it comes to things like <? echo $pilotcode; ?> they won't display. I understand it's to do with the defining variable not being passed to the custom page but can't figure out how to solve it. Any suggestions or solutions? Quote
Moderators mark1million Posted February 8, 2011 Moderators Report Posted February 8, 2011 HI in your html pages switch to source code view and use <?php YOUR CODE ?> Quote
Bradpl6 Posted February 8, 2011 Author Report Posted February 8, 2011 I'm aware of how to put php into the custom pages, what I'm looking for is a solution on how to use code such as <? echo $pilotcode; ?> or <? echo $user->firstname; ?> Quote
Moderators mark1million Posted February 8, 2011 Moderators Report Posted February 8, 2011 OK here you go, http://forum.phpvms.net/page/index.html?record=16 Quote
Bradpl6 Posted February 8, 2011 Author Report Posted February 8, 2011 (edited) Ahh thanks. I've just tried to include codon.config.php however I'm finding difficulty in doing this too, absolute directories won't work nor will navigating up a directory using the old ../../ method. Edit This is what I have in my .htm file in the 'pages' folder. <? include('../codon.config.php'); Template::Show('featchartvote.tpl'); ?> Edited February 8, 2011 by Bradpl6 Quote
Administrators Nabeel Posted February 9, 2011 Administrators Report Posted February 9, 2011 I always do: include dirname(__FILE__).'/../path/to/file'; The dirname(__FILE__) gives the absolute path to the file you're at now, and from there you can navigate to wherever that codon.config.php file is. Using the absolute path to that file is best though Quote
Bradpl6 Posted February 9, 2011 Author Report Posted February 9, 2011 Thanks, I'm now finding codon.config.php however I'm getting this message. Fatal error: Cannot redeclare codon_autoload() (previously declared in /home/**/public_html/core/classes/autoload.php:42) in /home/**/public_html/core/classes/autoload.php on line 69 Quote
Moderators mark1million Posted February 10, 2011 Moderators Report Posted February 10, 2011 That means its already being loaded somewhere else, Quote
Guest lorathon Posted February 10, 2011 Report Posted February 10, 2011 You need to fill the variable prior to echoing it. explain exactly what you are trying to do. If this page will be customized for each pilot (like the Pilot info Center) then use in the template at the top. <?php $pilot = AUTH::$userinfo; //Retrieve the logged in pilots info $pilotcode = PilotData::getPilotCode($pilot->code, pilot->pilotid); ?> All of this can be preloaded in the module as such $this->set('pilot', AUTH::$userinfo); $this->show('my_template.tpl'); or Template::Set('pilot', AUTH::$userinfo); Template::Show('my_template.tpl'); Quote
Bradpl6 Posted February 10, 2011 Author Report Posted February 10, 2011 You need to fill the variable prior to echoing it. explain exactly what you are trying to do. If this page will be customized for each pilot (like the Pilot info Center) then use in the template at the top. <?php $pilot = AUTH::$userinfo; //Retrieve the logged in pilots info $pilotcode = PilotData::getPilotCode($pilot->code, pilot->pilotid); ?> All of this can be preloaded in the module as such $this->set('pilot', AUTH::$userinfo); $this->show('my_template.tpl'); or Template::Set('pilot', AUTH::$userinfo); Template::Show('my_template.tpl'); Thanks, that worked brilliantly! 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.