
| |
|
[SMF]"Blank Page" + Custom Action
| Panzer- |
|
iMember

Group: Members
Posts: 24
Member No.: 9,787
Joined: 4-June 07

|
This shows you how to set up your own SMF pages. It uses the template and permissions system.. Also gives the URL a nice site.com?action=custom URL. Where-ever i say custom, just use the word you want..
Make a file called Custom.php (Yes, a capital) and save it in /sources . Put this in it...
| CODE | <?php if (!defined('SMF')) die('Hacking attempt...'); //Prevents hacking..
function Chat() { // This loads the template file which we make next loadTemplate('Custom'); } ?>
|
Next we need to make the .template.php file. Make Custom.template.php and save it in your /themes/themeyourusing/ folder.
| CODE | <?php
function template_main() { global $context, $settings, $options, $txt, $scripturl;
echo ' <script language="JavaScript" type="text/javascript"><!-- function checkAll(onOff) { for (var i = 0; i < document.searchform.elements.length; i++) { if (document.searchform.elements[i].name.substr(0, 3) == "brd") document.searchform.elements[i].checked = onOff; } } // --></script> <form action="', $scripturl, '?action=search2" method="post" name="searchform" id="searchform"> <table width="80%" border="0" cellspacing="0" cellpadding="3" align="center"> <tr> <td>', theme_linktree(), '</td> //Shows the link tree. </tr> </table> //You can edit below here... <table width="100%" border="0" cellspacing="0" cellpadding="4" align="center" class="tborder"> <tr class="titlebg"> <td>Chat</td> </tr><tr> <td class="windowbg">';
// load the chat echo 'Yay, custom content FTW! <br /> <br />'; echo'Tut shown on iFusion. Made by Panzer!';
echo ' </td> </tr> </table> </form>'; }
?>
|
So, theres the "Blank Page" made, it uses the theme's CSS and images.
Now to add the cool ?action=custom .
Open up index.php and find
| CODE | | 'boardrecount' => array('Admin.php', 'AdminBoardRecount'), |
Add After
| CODE | | 'custom' => array('Custom.php', 'Custom'), |
|
|
|
| JakeH |
|
*Sits in the corner*

Group: PostWhores
Posts: 1,095
Member No.: 1,685
Joined: 5-September 05

|
Haha, very nice although this should be in the "SMFForFree Codes" shouldn't it :S
Anyway, yeah, this is good, but can you have scripting content such as JavaScript on your custom page?
|
|
|
| Panzer- |
|
iMember

Group: Members
Posts: 24
Member No.: 9,787
Joined: 4-June 07

|
No, it shouldnt be in SMF for free. You need to edit the source of your SMF board... This has nothing to do with Javascript.. although you could use it..
|
|
|
| JakeH |
|
*Sits in the corner*

Group: PostWhores
Posts: 1,095
Member No.: 1,685
Joined: 5-September 05

|
Lol, yeah, don't worry I just wasn't thinking at the time.
I ment how could you use JavaScript on the page, say you wanted to embed a chatroom, how would you got about doing it.
|
|
|
| Panzer- |
|
iMember

Group: Members
Posts: 24
Member No.: 9,787
Joined: 4-June 07

|
Chatroom in Flash, PHP, JS ?
You would just edit the content in the .template.php file. Below the "//You can edit below here..." part.
|
|
|
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
Skin created by .Apotropaic of Graphical Aesthetics.
| 
|