say you want to create a simple page in your forum with some text(or more) in it. Here's how you do that:
In SMF:
Go to your Sources directory, and create there a page called however you want, I'll call it myPage.php for this tutorial. Open up the page you just created and create a function inside it. I'll call mine myFunction() but yours could be anything you want. Here's the code:
of course, replace myFunction with the name of your function, and Custom Title with the title you want the page to have. At the end I wrote loadTemplate('myTemplate') so we'll have to go create this template.
Go to the Themes directory, then to the default directory, and create there a new file called myTemplate.template.php. myTemplate should be replaced with the template you gave to the loadTemplate. Here is how it should look:
The function name here is not subject to change, but feel free to change "my text" and maybe put some php coding there as well.
Now lastly, go to index.php, and at the end, where you should see this line:
and beneath it the monstrous list.
Decide on a name for your action, I'll call it myAct. Then look for where to put it alphabetically - myAct should come after movetopic2 and before notify. The code should look like this:
Where myAct is the name of your action, myPage.php the adress of the page you created earlier, and myFunction the name of the function you created. Now save and you're all done.
Go to index.php?action=myAct (replace myAct with the name of your action) and you should see a page with the title and text you created.
I'm getting tired now, I'll post the same for phpBB tommorow.
In SMF:
Go to your Sources directory, and create there a page called however you want, I'll call it myPage.php for this tutorial. Open up the page you just created and create a function inside it. I'll call mine myFunction() but yours could be anything you want. Here's the code:
| Code: |
|
<? function myFunction() { if (!defined('SMF')) { die('Hacking attempt...'); } global $context, $settings, $options, $scripturl, $modSettings, $txt; $context['page_title'] = 'Custom Title'; loadTemplate('myTemplate'); } ?> |
of course, replace myFunction with the name of your function, and Custom Title with the title you want the page to have. At the end I wrote loadTemplate('myTemplate') so we'll have to go create this template.
Go to the Themes directory, then to the default directory, and create there a new file called myTemplate.template.php. myTemplate should be replaced with the template you gave to the loadTemplate. Here is how it should look:
| Code: |
| <?
function template_main() { echo"my text"; } ?> |
The function name here is not subject to change, but feel free to change "my text" and maybe put some php coding there as well.
Now lastly, go to index.php, and at the end, where you should see this line:
| Quote: |
| // Here's the monstrous $_REQUEST['action'] array - $_REQUEST |
Decide on a name for your action, I'll call it myAct. Then look for where to put it alphabetically - myAct should come after movetopic2 and before notify. The code should look like this:
| Code: |
| 'myAct' => array('myPage.php', 'myFunction'), |
Where myAct is the name of your action, myPage.php the adress of the page you created earlier, and myFunction the name of the function you created. Now save and you're all done.
Go to index.php?action=myAct (replace myAct with the name of your action) and you should see a page with the title and text you created.
I'm getting tired now, I'll post the same for phpBB tommorow.
