iFusion Code Index
iFusion Has Moved!!! - Visit the new site at http://forum.ifcode.com
invisionFusion @ iFCode.com | ZetaBoards Beta Code Index
 




  Reply to this topic Start new topic

> [SMF]"Blank Page" + Custom Action
Panzer-
Posted: Aug 7 2007, 04:12 AM


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'),



http://imgday.com/uploads/61988Screen01.JPG

And shalah! Questions/Comments?





Top
JakeH
Posted: Aug 7 2007, 12:14 PM


*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?
Top
Panzer-
Posted: Aug 7 2007, 08:15 PM


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..
Top
JakeH
Posted: Aug 8 2007, 02:08 PM


*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.
Top
Panzer-
Posted: Aug 9 2007, 03:42 AM


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.
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:


Topic Options Reply to this topic Start new topic


Skin created by .Apotropaic of Graphical Aesthetics.


Been Helped by iFusion / iFCode's Index? | | Donate to iFusion!
| iFusion Topsites



Hosted for free by InvisionFree (Terms of Use: Updated 7/7/05) | Powered by Invision Power Board v1.3 Final © 2003 IPS, Inc.
Archive