Coinbase

Author Topic: Help needed editing index.template.php  (Read 6212 times)

0 Members and 1 Guest are viewing this topic.

Offline zigzag

  • Newbie
  • *
  • Posts: 1
Help needed editing index.template.php
« on: October 12, 2008, 12:31:37 am »
Hi there,

I'm completely stuck editing my index.template.php I've tried comparing the code with the default theme but it's so different that I'm getting nowhere. Any help much appreciated.

Code: [Select]
<?php


// Initialize the template... mainly little settings.
function template_init()
{
global $context$settings$options$txt;

/* Use images from default theme when using templates from the default theme?
if this is 'always', images from the default theme will be used.
if this is 'defaults', images from the default theme will only be used with default templates.
if this is 'never' or isn't set at all, images from the default theme will not be used. */
$settings['use_default_images'] = 'never';

/* What document type definition is being used? (for font size and other issues.)
'xhtml' for an XHTML 1.0 document type definition.
'html' for an HTML 4.01 document type definition. */
$settings['doctype'] = 'xhtml';

/* The version this template/theme is for.
This should probably be the version of SMF it was created for. */
$settings['theme_version'] = '1.1 RC2';

/* Set a setting that tells the theme that it can render the tabs. */
$settings['use_tabs'] = false;

/* Use plain buttons - as oppossed to text buttons? */
$settings['use_buttons'] = false;
$settings['use_image_buttons'] = true;
/* Show sticky and lock status seperate from topic icons? */
$settings['seperate_sticky_lock'] = true;

}

// The main sub template above the content.
function template_main_above()
{
global $context$settings$options$scripturl$txt$modSettings;




// test for joomla integration
global $wrapped$jsmfConfig$header_style $toolbar_style $footer_style;

$context['jsmf_wrapped']=false;

if(isset($wrapped) && $wrapped == "true")
$context['joomla_wrapped']=true;
elseif(isset($wrapped) && $wrapped== "false")
$context['joomla_wrapped']=false;
elseif(isset($jsmfConfig) && $jsmfConfig->wrapped) {
$context['joomla_wrapped']=true;
$context['jsmf_wrapped']=true;
} elseif(isset($jsmfConfig) && !$jsmfConfig->wrapped)
$context['joomla_wrapped']=false;
else
$context['joomla_wrapped']=false;

// the color choices
if(!empty($settings['template_style'])){
switch($settings['template_style']){
case 0:
$template_style='dark';
break;
case 1:
$template_style='light';
break;
case 2:
$template_style='pga';
break;
case 3:
$template_style='beige';
break;
default:
$template_style='dark';
break;
}
}
else {
$template_style='dark';
}

  
$context['templatestyle']=$template_style;

// the width choices
if(!empty($settings['template_width']))
$template_width=$settings['template_width'];
else
$template_width='vmax';

// the align choices
if(!empty($settings['template_align']))
$template_align=$settings['template_align'];
else
$template_align='center';

  if (!
$context['joomla_wrapped'] || $context['jsmf_wrapped']) {
  

  if (!
$context['jsmf_wrapped']) {

// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"'
$context['right_to_left'] ? ' dir="rtl"' '''>';
  }
echo '<head>
<meta http-equiv="Content-Type" content="text/html; charset='
$context['character_set'], '" />
<meta name="description" content="'
$context['page_title'], '" />', empty($context['robot_no_index']) ? '' '
<meta name="robots" content="noindex" />'
'
<meta name="keywords" content="france, living in france, french property, forum" />
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/script.js?rc2p"></script>

<!--[if lte IE 6]>
<style type="text/css">
.clearfix {height: 1%;}
img {border: none;}
</style>
<![endif]-->
<!--[if gte IE 7.0]>
<style type="text/css">
.clearfix {display: inline-block;}
</style>
<![endif]-->

<script language="JavaScript" type="text/javascript">
var smf_theme_url = "'
$settings['theme_url'], '";
var smf_images_url = "'
$settings['images_url'], '";
var smf_scripturl = "'
$scripturl'";
</script>
<title>'
$context['page_title'], '</title>';

// The ?rc2 part of this link is just here to make sure browsers don't cache it wrongly.


   
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['theme_url'], '/css/template_css.css" />
<link rel="stylesheet" type="text/css" href="'
$settings['theme_url'], '/css/ja.scriptdlmenu.css" />';

echo '
<link rel="stylesheet" type="text/css" href="'
$settings['theme_url'], '/css/'.$template_style.'_color.css" />
'
;

 echo 
'
<link rel="stylesheet" type="text/css" href="'
$settings['theme_url'], '/style.css?rc2" />
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/print.css?rc2" media="print" />';


/* Internet Explorer 4/5 and Opera 6 just don't do font sizes properly. (they are big...)
Thus, in Internet Explorer 4, 5, and Opera 6 this will show fonts one size smaller than usual.
Note that this is affected by whether IE 6 is in standards compliance mode.. if not, it will also be big.
Standards compliance mode happens when you use xhtml... */
if ($context['browser']['needs_size_fix'])
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/fonts-compat.css" />';

// Show all the relative links, such as help, search, contents, and the like.
echo '
<link rel="help" href="'
$scripturl'?action=help" target="_blank" />
<link rel="search" href="' 
$scripturl '?action=search" />
<link rel="contents" href="'
$scripturl'" />';

// If RSS feeds are enabled, advertise the presence of one.
if (!empty($modSettings['xmlnews_enable']))
echo '
<link rel="alternate" type="application/rss+xml" title="'
$context['forum_name'], ' - RSS" href="'$scripturl'?type=rss;action=.xml" />';

// If we're viewing a topic, these should be the previous and next topics, respectively.
if (!empty($context['current_topic']))
echo '
<link rel="prev" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=prev" />
<link rel="next" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=next" />';

// If we're in a board, or a topic for that matter, the index will be the board's index.
if (!empty($context['current_board']))
echo '
<link rel="index" href="' 
$scripturl '?board=' $context['current_board'] . '.0" />';

// We'll have to use the cookie to remember the header...
if ($context['user']['is_guest'])
$options['collapse_header'] = !empty($_COOKIE['upshrink']);

// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'], '

<script language="JavaScript" type="text/javascript">
var current_header = '
, empty($options['collapse_header']) ? 'false' 'true'';

function shrinkHeader(mode)
{'
;

// Guests don't have theme options!!
if ($context['user']['is_guest'])
echo '
document.cookie = "upshrink=" + (mode ? 1 : 0);'
;
else
echo '
smf_setThemeOption("collapse_header", mode ? 1 : 0, null, "'
$context['session_id'], '");';

echo '
document.getElementById("upshrink").src = smf_images_url + (mode ? "/upshrink2.gif" : "/upshrink.gif");

document.getElementById("upshrinkHeader").style.display = mode ? "none" : "";
document.getElementById("upshrinkHeader2").style.display = mode ? "none" : "";

current_header = mode;
}
</script>'
;

// the routine for the info center upshrink
echo '
<script language="JavaScript" type="text/javascript">
var current_header_ic = '
, empty($options['collapse_header_ic']) ? 'false' 'true'';

function shrinkHeaderIC(mode)
{'
;

if ($context['user']['is_guest'])
echo '
document.cookie = "upshrinkIC=" + (mode ? 1 : 0);'
;
else
echo '
smf_setThemeOption("collapse_header_ic", mode ? 1 : 0, null, "'
$context['session_id'], '");';

echo '
document.getElementById("upshrink_ic").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif");

document.getElementById("upshrinkHeaderIC").style.display = mode ? "none" : "";

current_header_ic = mode;
}
</script>
</head>'
;

if (!
$context['jsmf_wrapped']) {
echo '
<body class="page_bg ' 
$template_width ' ' $template_align '">
<a name="up" id="up"></a>
<div id="wrapper">
<div id="shadow_l"><a title="Book a ferry to or from France" style="background:transparent url(/modules/mod_beInvolved/images/ferry.png) no-repeat scroll right top !important;z-index:3;cursor:pointer;display:block;height:100px;position:absolute;right:0pt;text-decoration:none;text-indent:-999em;top:0pt;width:100px;" href="/travel/booking/626-ferries" target="_self">
Book a ferry</a> 
<div id="shadow_r">
<div><div id="ja-user3">&nbsp;<img src="/images/stories/weather.png" alt="World Weather" border="0" />
<a href="/world-weather">World Weather</a><img src="/images/stories/travel.png" alt="Road Traffic Reports" border="0" />
<a href="/road-traffic-reports">Road Traffic Reports</a>
</div>
  <div id="header"><div id="banner">'
$context['random_news_line'], '</div>

<div id="logo"><h1 class="logo">
<a href="http://www.mysite.com/" title="Home Page"><span>Home Page</span></a>
</h1></div>

<div id="search"><form action="'
$scripturl'?action=search2" method="post" accept-charset="'$context['character_set'], '" style="margin: 0;">
<a href="'
$scripturl'?action=search;advanced"><img src="'.$settings['images_url'].'/filter.gif" align="middle" style="margin: 0 1ex;" alt="" /></a>
<input type="text" name="search" value="" style="width: 130px;" />&nbsp;
<input type="submit" name="submit" value="'
$txt[182], '" class="button" style="width: 11ex;" />
<input type="hidden" name="advanced" value="0" />'
;

// Search within current topic?
if (!empty($context['current_topic']))
echo '
<input type="hidden" name="topic" value="'
$context['current_topic'], '" />';

// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']))
echo '
<input type="hidden" name="brd['
$context['current_board'], ']" value="'$context['current_board'], '" />';

echo '
</form></div>
mainstuff(), '

<!-- BEGIN: MAIN NAVIGATION -->
<div id="ja-mainnavwrap">
<div id="ja-mainnav" class="clearfix">
<div id="jasdl-mainnav">
<ul>
<li id="jasdl-mainnav96">
<a href="http://www.mysite.com/" class="menu-item0 active first-item" id="menu96" title="Home">
<span class="menu-title">Home</span></a></li>
<li id="jasdl-mainnav111">
<a href="http://www.mysite.com/forums/index.php" class="menu-item1" id="menu111" title="Forum">
<span class="menu-title">Forum</span></a></li>
<a href="/books" class="menu-item5" id="menu41" title="Books">
<span class="menu-title">Books</span></a></li>
</ul>
</div>

</div>
</div>
<div id="ja-subnavwrap">
<div id="ja-subnav" class="clearfix">
<div id="jasdl-subnav">
 '
,template_menu(),'
</div>
</div>
</div>
<!-- END: MAIN NAVIGATION -->

<div id="maincontent">
<table class="nospace">
<tr valign="top">
<td>'
;

}
  }
echo '<div class="' $template_style '">';
  if (
$context['joomla_wrapped']) {
echo '<div id="horizmenu"><div id="nav">',template_menu2(),'</div></div>
<div class="clr" style="margin-bottom:5px;"></div>'
;
  }


}

function 
template_main_below() {
global $context$settings$options$scripturl$txt;
echo '<br />';
        include(
'ads.php');
   echo 
'</div>';
  
if ($context['joomla_wrapped']) {
  echo'
<div style="padding: 5px; text-align: center;">

<div class="smalltext">' 
,theme_copyright(),'
</div></div>'
;
}
if(!$context['joomla_wrapped'])
echo '<div align="center">' ,theme_copyright(),'</div>
</td>
</tr>
<tr valign="top">
<td class="footer">
<div id="footer_mods">

<a href="http://www.mysite.com/help"><span>Help and FAQs</span></a> |

<a href="http://www.mysite.com/privacy-policy"><span>Privacy Policy</span></a> | 
<a href="http://www.mysite.com/terms-of-use"><span>Terms of Use</span></a> | 
<a href="http://www.mysite.com/contact"><span>Contact Us</span></a> | 
<a href="http://www.mysite.com/advertise"><span>Advertise With Us</span></a> |
<a href="http://www.mysite.com/site-map"><span>Site Map</span></a>  | 
<br /> Copyright &#38;#169; 2005 - 2008 - mysite.com
</div>
</td>
</tr>
<?php } ?>

</table>
<div id="padbottom"></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>';
}

// Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree()
{
global $context, $settings, $options;

echo '<span class="pathway">';
// Each tree item has a URL and name. Some may have extra_before and extra_after.
foreach ($context['linktree'] as $link_num => $tree)
{
// Show something before the link?
if (isset($tree['extra_before']))
echo $tree['extra_before'];

// Don't show a separator for the last one.
if ($link_num != count($context['linktree']) - 1)
// Show the link, including a URL if it should have one.
echo $settings['linktree_link'] && isset($tree['url']) ? '<a href="' . $tree['url'] . '" class="pathway">' . $tree['name'] . '</a>' : $tree['name'] , '<img src="'.$settings['images_url'].'/arrow_'.$context['templatestyle'].'.png" style="margin: 0 12px 0 12px" alt="" />';
else
echo $tree['name'];

// Show something after the link...?
if (isset($tree['extra_after']))
echo $tree['extra_after'];

}

echo '</span>';
}

// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;





// Show the [home] button.
echo '<span class="menu-title"><a class="first" href="', $scripturl, '">Forum Home</a></span>';

// Show the [help] button.
echo '<span class="menu-title"><a href="', $scripturl, '?action=help">' , $txt[119] , '</a></span>';

// How about the [search] button?
if ($context['allow_search'])
echo '<span class="menu-title"><a href="', $scripturl, '?action=search">' , $txt[182] , '</a></span>';

// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo '<span class="menu-title"><a href="', $scripturl, '?action=admin">' , $txt[2] , '</a></span>';

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '<span class="menu-title"><a href="', $scripturl, '?action=profile">' , $txt[79] , '</a></span>';

// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo '<span class="menu-title"><a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a></span>';

   if ($context['user']['is_logged'])
echo '<span class="menu-title"><a href="', $scripturl, '?action=unread">Unread Posts</a></span>';

if ($context['user']['is_logged'])
echo '<span class="menu-title"><a href="', $scripturl, '?action=unreadreplies">New Replies</a></span>';

//Recent posts
echo '<span class="menu-title"><a href="index.php?action=recent">Latest Posts</a></span>';

// The [calendar]!
if ($context['allow_calendar'])
echo '<span class="menu-title"><a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a></span>';

// the [member] list button
if ($context['allow_memberlist'])
echo '<span class="menu-title"><a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a></span>';

// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo '<span class="menu-title"><a href="http://www.mysite.com/login">' , $txt[34] , '</a></span>';

// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo '<span class="menu-title"><a href="', $scripturl, '?action=join">' , $txt[97] , '</a></span>';

// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo '<span class="menu-title"><a href="http://www.mysite.com/login">' , $txt[108] , '</a></span>';

}
// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu2()
{
global $context, $settings, $options, $scripturl, $txt;



}

// Generate a strip of buttons.
function template_button_strip($button_strip, $direction = 'top', $force_reset = false, $custom_td = '')
{
global $settings, $buttons, $context, $txt, $scripturl;

// Create the buttons...
foreach ($button_strip as $key => $value)
{
if (isset($value['test']) && empty($context[$value['test']]))
{
unset($button_strip[$key]);
continue;
}
elseif (!isset($buttons[$key]) || $force_reset)
$buttons[$key] = '<a href="' . $value['url'] . '" ' .( isset($value['custom']) ? $value['custom'] : '') . '>' . $txt[$value['text']] . '</a>';

$button_strip[$key] = $buttons[$key];
}

if (empty($button_strip))
return '<td>&nbsp;</td>';

echo '
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_' , $context['right_to_left'] ? 'last' : 'first' , '">&nbsp;</td>
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_back">', implode(' &nbsp;|&nbsp; ', $button_strip) , '</td>
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_' , $context['right_to_left'] ? 'first' : 'last' , '">&nbsp;</td>';
}
// Generate a strip of buttons.
function template_button_strip_mill($button_strip, $direction = 'top', $force_reset = false, $custom_td = '')
{
global $settings, $buttons, $context, $txt, $scripturl;

// Create the buttons...
foreach ($button_strip as $key => $value)
{
if (isset($value['test']) && empty($context[$value['test']]))
{
unset($button_strip[$key]);
continue;
}
elseif (!isset($buttons[$key]) || $force_reset)
$buttons[$key] = '<a href="' . $value['url'] . '" ' .( isset($value['custom']) ? $value['custom'] : '') . '>'. ($custom_td!='' ? '<'.$custom_td.'>' : '') . $txt[$value['text']] . ($custom_td!='' ? '</'.$custom_td.'>' : '') .'</a>';

$button_strip[$key] = $buttons[$key];
}

if (empty($button_strip))
return '&nbsp;';

echo implode(' &nbsp;|&nbsp; ', $button_strip);
}
function mainstuff()
{
global $settings, $buttons, $context, $txt, $scripturl;
echo '
</div>';
 
}

?>

Offline Soulgirl

  • Newbie
  • *
  • Posts: 8
Re: Help needed editing index.template.php
« Reply #1 on: November 21, 2008, 02:28:45 pm »
I'm stuck on exactly the same thing... hopefully someone will come and help :)

Offline ccbtimewiz

  • Sr. Member
  • ****
  • Posts: 326
    • Dream Portal
Re: Help needed editing index.template.php
« Reply #2 on: November 22, 2008, 12:15:02 am »
Find:
Code: [Select]
<body class="page_bg ' . $template_width . ' ' . $template_align . '">
<a name="up" id="up"></a>

Replace with:
Code: [Select]
<body class="page_bg ' . $template_width . ' ' . $template_align . '">';

// the ad code from the guide

echo '
<a name="up" id="up"></a>

And continue in similar fashion.

SMF Ads Support Forum

Re: Help needed editing index.template.php
« Reply #2 on: November 22, 2008, 12:15:02 am »
.