News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

[1.1] How to add tabs to Core (NDT)?

Started by JayBachatero, December 31, 2005, 04:21:57 PM

Previous topic - Next topic

Onni

Hi!

I dont know much about PHP, so i would be glad if somebody would help me to add link to my "main page" on the navigation bar ;). Im using SMF 1.1.4 and default (core) theme. I woul like the link to appear between "Home" and "Help" links. Adress would be http://www.rammstein-hq.com. Thanks :).

-Onni

Deaks

Omni can I suggest that you read this thread the answer is already posted in here :)
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Onni

Not working :'(... What am i doing wrong? Heres the code:


// Work out where we currently are.
$current_action = 'home';
if (in_array($context['current_action'], array('admin', 'ban', 'boardrecount', 'cleanperms', 'detailedversion', 'dumpdb', 'featuresettings', 'featuresettings2', 'findmember', 'maintain', 'manageattachments', 'manageboards', 'managecalendar', 'managesearch', 'membergroups', 'modlog', 'news', 'optimizetables', 'packageget', 'packages', 'permissions', 'pgdownload', 'postsettings', 'regcenter', 'repairboards', 'reports', 'serversettings', 'serversettings2', 'smileys', 'viewErrorLog', 'viewmembers')))
$current_action = 'admin';
if (in_array($context['current_action'], array('mainpage', 'search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))
$current_action = $context['current_action'];
if ($context['current_action'] == 'search2')
if ($context['current_action'] == 'mainpage')
$current_action = 'mainpage';
$current_action = 'search';
if ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';



// Show the [home] button.
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '">' , $txt[103] , '</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Show the [mainpage] button.
echo ($current_action=='mainpage' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'mainpage' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=mainpage">Chat</a>
</td>' , $current_action == 'mainpage' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

// Show the [help] button.
echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'help' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=help">' , $txt[119] , '</a>
</td>' , $current_action == 'help' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

Deaks

try changing this
// Show the [mainpage] button.
echo ($current_action=='mainpage' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'mainpage' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=mainpage">Chat</a>
</td>' , $current_action == 'mainpage' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


to

// Show the [mainpage] button.
echo ($current_action=='mainpage' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'mainpage' ? 'active_back' : 'back' , '">
<a href="http://www.rammstein-hq.com">Main</a>
</td>' , $current_action == 'mainpage' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Onni


scuzzy47

I got a question, I got the button to work, it's an upload script, so now I link that button to an Upload.php page in Sources.
But that's not the upload page I want to use, so what code should I use to link to that page?
I was thinking about an <iframe> html code, but than the layout get's all messed up, I need it to appear where the other pages appear, center of my forum...

deziner

Hi I would like to put links above everything at the top of the page. The site is http://www.amputee-center.com/forum/ [nofollow]  The links would be for the reat of the site likecontact us pg1 pg2 etc. They will all be external links what file do I modify and where do I modify it?

Gary

Just change the <a href=" tag to contain the external URL.


// That says corn Bart
echo'
<td valign="top" class="maintab_back">
<a href="http://babysimpson.co.uk">The Cutest Baby</a>
</td>'';


Should to the trick.
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

shumar

Quote from: Penelope on June 04, 2006, 06:02:42 PM
Thanks for all the info!  :D

I have only one question. I made a new menu item "Hall of Fame" and when i go on that page, the "Home" and "Hall of Fame" button are selected, which should only be the "Hall of Fame" button.

Any idea what is wrong? Hope someone can help me!

in the index.template i have this:

//Hall of fame menu button
if ($context['current_action'] == 'halloffame')
$current_action = 'halloffame';
echo ($current_action=='halloffame' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'halloffame' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=halloffame">Hall of Fame</a>
</td>' , $current_action == 'halloffame' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


in the halloffame.php file i have this:

<?php
if (!defined('SMF'))
die('Hacking attempt...');

function 
halloffame() {
// This is gonna be needed...
loadTemplate('halloffame');
}


in the halloffame.template i have this:

<?php
// Version: 1.1 RC2; Gallery

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

 <script type="text/javascript"><!--

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don\'t support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

// --></script>

<table width="100%" border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
<tr class="titlebg">
<td>Hall of Fame</td>
</tr><tr>
<td class="windowbg">'
;

/*   
 *   Podium Hall of Fame
 *   
 *   
 */

echo ' <center><table border="0" width="95%" cellspacing="1" cellpadding="5" class="bordercolor">
<tr class="catbg">
<td align="center" colspan = 3>
<img src="">
<a href="'
.$scripturl.'?action=arcade">Hero Members</a><img src="">
</td>
</tr>
<tr align="center">
'
;
if(!empty($data_1[2]["name"])){
echo'
<td class="windowbg" width="33%">
<img src="" border="0" /> <br />
'
.$data_1[2]["avatar"].' <br/>
<a href="'
.$scripturl.'?action=profile;u='.$data_1[2]["id"].'">'.$data_1[2]["name"].'</a> <br/>
(<b>'
.$data_1[2]["count"].'</b> Highscores)
</td>
'
;
}else{
echo'
<td class="windowbg" width="33%">
&nbsp;
</td>



<td class="windowbg" width="33%">
<img src="" border="0" /> <br />

<a href=""></a> <br/>

</td>
<td class="windowbg" width="33%">
&nbsp;
</td>
'
;
}
if(!empty($data_1[3]["name"])){
echo'
<td class="windowbg" width="33%">
<img src="" border="0" /> <br />
'
.$data_1[3]["avatar"].' <br/>
<a href="'
.$scripturl.'?action=profile;u='.$data_1[3]["id"].'">'.$data_1[3]["name"].'</a> <br/>
(<b>'
.$data_1[3]["count"].'</b> Highscores)
</td>
'
;
}else{
echo'

'
;
}
echo'
</tr>
</table></center>
'
;


/*
 * End podium Hall of Fame
 *
 *
 */






echo '
</td>
</tr>
</table>
</form>'
;
}

?>

Where to add those files ??

Gary

There was no need to quote that. Are you trying to add a gallery to your forum, because you can just install one of the many galleries on the Mod Site.
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

shumar

I need hall of fame, not gallery...

Gary

Drop halloffame.php into the Sources directory and halloffame.template.php into the Default theme's folder.
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

shumar

hm...
Does someone try this hall of fame every time I click it send me to index.php

Gary

You'll need to add the action call to it in index.php of your forum's root.
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

Kolya

#414
I want to call up a certain SMF thread from a custom core tab.
I got it working so far that the thread is loaded but the tab is not being activated.
Or when I add a custom action after the threads URL the tab gets activated but the thread is not being loaded.

I need a bit of help here.

index.template.php

echo '
<td class="maintab_' , $current_action == 'welcome' ? 'active_back' : 'back' , '">
<a href="', $boardurl, '/index.php/topic,109.0.html', '">' , $txt[119] , '</a>
</td>';



IchBin™

You'll have to add some custom PHP to detect your location.
Change the number 5 to the number of your topic.
if (isset($_GET['topic']) && $_GET['topic'] == 5)
$current_action = 'topic';


In your button code put the action as topic.
IchBin™        TinyPortal

Kolya

Thanks a lot, that worked great.  :)

IchBin™

If your topic isn't for core we would appreciate if you'd make your own topic thanks.
IchBin™        TinyPortal

shumar

I need little more help.

//Hall of fame menu button
if ($context['current_action'] == 'halloffame')
$current_action = 'halloffame';
echo ($current_action=='halloffame' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'halloffame' ? 'active_back' : 'back' , '">
<a href="./hall_of_fame-p8.html">Hall of Fame</a>
</td>' , $current_action == 'halloffame' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


Only Home button is highlighted not Hall of Fame. What I need to change ??

IchBin™

Its because in your actual URL it has to say http://www.yoursite.com/index.php?action=halloffame for it to highlight. Since your link is external to SMF (./hall_of_fame-p8.html) it will not highlight when you are on that page.
IchBin™        TinyPortal

Advertisement: