Jump to content

Recommended Posts

Posted

My intent is to be able to click on the "File a new PIREP" link....have it take me to a page with only two buttons....."File a FSX Flight" and "File a DCS Flight." Each a link to a different PIREP form.

I utilized David Clarke's great content module tutorial to create two new pages (tutorial: http://david-clark.n...content-module/).

It appears that I used the tutorial correctly...my links are working, but the data stream seems to have been broken somewhere.

Explanation:

New pages are called "pirep_fsx.tpl" and "pirep_dcs.tpl" I created the new module, as directed in the tutorial....but I do not think it is the problem (I could be wrong)

I replaced the data in the default "pirep_new.tpl" (using the skin folder) with this to create the page with just two button links:

<h3>File a Flight Report</h3>
<?php
if(isset($message))
echo '<div id="error">'.$message.'</div>';
?>
</br>
<form>
<INPUT
type="button"
value="File a FSX Report"
onclick="location.href='<?php echo url('/content/pirep_fsx');?>'"
>
</br></br>
<INPUT
type="button"
value="File a DCS Report" onclick="location.href='<?php echo url('/content');?>'"
>
</form>
</br>
</br></br>

The new module "content.php"

<?php

class Content extends CodonModule	 {

function index()	 {

 $this->show('pirep_dcs');

}

function pirep_fsx()	 {

 $this->show('pirep_fsx');

}

}

I then placed just some test text into the two new created files to make sure the links work. It all worked OK, so I believe that I followed the tutorial correctly. When I click on "File a New PIREP", it send me to my modified page (coded above), I then have two links to choose from...go to "File an FSX report" or "File a DCS Report." I click on each link, and it displays my test text.

I then put real code into the pirep_fsx.tpl file....I placed the original contents of the pirep_new.tpl file. This is just the default manual PIREP form that came with the software. (The pirep_dcs.tpl still has dummy info in it, haven't gotten that far yet.)

My problem, the new pirep_fsx.tpl form (that is just a copy of the original pirep_new.tpl form), does not work. I assume that my new "pass through" page has caused a loss of data/variables/etc.

Any guidance would be appreciated. Thanks

  • Moderators
Posted

You did everything correctly but the pirep_newform.tpl gets its data from the module and you're module is pretty much nothing to give to the template. Your module is just showing those templates. :)

Posted

It looks like I should keep the original pirep_new.tpl for my one form (FSX flights) and edit the pirep.php module to include the 2 new pages? (one page for the re-direct selection (FSX or DCS) then one for the 2nd pirep form.)

Is editing the original modules recommended? or should I create a whole new module, using the default as a base file to build off of? (not sure of that will require multiple link changes elsewhere)

  • Moderators
Posted

It's better not to edit the default modules but some times there is no other way. What you can do is to set up your module and use the default functions to include the pages you want.

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