Hi
I really need some help. I use smf with the helios theme. http://www.rcarmy.com/forum/index.php I want to place the ads that are at the top of the forum page in the news block instead. I have tried just entering the code into the add news section on the control panel but it just shows the code as the news. So I guess I need to go into a .php file and add the code in there. Can anyone tell me what file and where abouts I would need to put it. The code I have is either php or javascript.
<?php
if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:1', 0, '', '', '0', $phpAds_context);
echo $phpAds_raw['html'];
}
?>
or
<script language='JavaScript' type='text/javascript' src='http://rcarmy.com/ads/adx.js'></script>
<script language='JavaScript' type='text/javascript'>
<!--
if (!document.phpAds_used) document.phpAds_used = ',';
phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
document.write ("http://rcarmy.com/ads/adjs.php?n=" + phpAds_random);
document.write ("&what=zone:1");
document.write ("&exclude=" + document.phpAds_used);
if (document.referrer)
document.write ("&referer=" + escape(document.referrer));
document.write ("'><" + "/script>");
//-->
</script><noscript><a href='http://rcarmy.com/ads/adclick.php?n=a565569d' target='_blank'><img src='http://rcarmy.com/ads/adview.php?what=zone:1&n=a565569d' border='0' alt=''></a></noscript>
Sorry I am very new at this and any help would really be appreciated.
Many Thanks
I don't think SMF supports php code in the news section. You might have to look for another location for your ads.
index.template.php in the helios folder under Themes is where you will find the code for the news block.
IchBin is correct that the SMF news feature does not allow PHP. It only allows regular html in there.
Sorry to be a pain but do you know where abouts in the index.template.php file I would insert it?
I don't have a copy of the theme here at work, but there should be a comment that says something about the news. Open the file for editing and do a search on the word "news" and I am pretty sure that you will find it.
Hi
I have searched and found this part of the code which mentions news.
Quoteecho '</div></td><td style="padding-right: 10px;" width="50%" align="right" >';
if(isset($settings['userlogo']) && !empty($settings['userlogo']))
echo '<a href="index.php"><img src="'.$settings['userlogo'].'" border="0" alt="logo" /></a>';
echo ' </td></tr></table>'.$botbox.'</div>';
if (!empty($settings['enable_news']))
echo '<div style="padding-right: 10px;">'. $topbox.'<div style="padding: 6px; text-align: center;">'.$context['random_news_line'].'</div>'.$botbox.'</div>';
// news
echo '
</div>';
// stats
echo '<div style="padding-left: 0px;">'.$leftbox.'<table width="99%" cellpadding="0" cellspacing="0" border="0"><tr><td align="left" style="color: #88908a; font-size: 8pt; font-family: tahoma, helvetica, serif;">', $modSettings['totalMessages'], ' ', $txt[95], ' ', $txt['smf88'], '
', $modSettings['totalTopics'], ' ', $txt[64], ' ', $txt[525], ' ', $modSettings['totalMembers'], '
', $txt[19], '
- ', $txt[656], ': <a style="color: #b0b0b0" href="', $scripturl , '?action=profile;u=' , $modSettings['latestMember'] , '">' , $modSettings['latestRealName'] , '</a>
</td><td align="right" style="color: #b0b0b0; font-size: 8pt; font-family: tahoma, helvetica, serif;">'.$context['current_time'].'</td></tr></table>'.$rightbox.'</div>';
Sorry I have not got a clue where to put it.
Sorry for going a bit off-topic here, but this was discussed a bit so:
I too got a bit confused as to where I should post my questions.
There is a beta-support forum, but for those running non-beta the closest thing I found to post my questions was this forum, I might be mistaken tho...???
Change this:
if (!empty($settings['enable_news']))
echo '<div style="padding-right: 10px;">'. $topbox.'<div style="padding: 6px; text-align: center;">'.$context['random_news_line'].'</div>'.$botbox.'</div>';
to
if (!empty($settings['enable_news']))
{
echo '<div style="padding-right: 10px;">'. $topbox.'<div style="padding: 6px; text-align: center;">';
if (@include(getenv('DOCUMENT_ROOT').'/ads/phpadsnew.inc.php')) {
if (!isset($phpAds_context)) $phpAds_context = array();
$phpAds_raw = view_raw ('zone:1', 0, '', '', '0', $phpAds_context);
echo $phpAds_raw['html'];
}
echo '</div>'.$botbox.'</div>';
}
That should do it (operative word there being "should" ;D
Ok, that was so close. It put the ad in the box, however it through this up at the top of the page
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/rcarycom/public_html/mkportal/include/mk_mySQL.php on line 57
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/rcarycom/public_html/mkportal/include/mk_mySQL.php on line 57
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/rcarycom/public_html/mkportal/include/mk_mySQL.php on line 57
Okay, at this point, I think that you need to be asking about this error over on the mkportal forums or perhaps on the SMF boards.
While I am often glad to help out, I know nothing about mk portal. This is the Tiny Portal website, so it is doubtful that many here know anything about errors from MK Portal code.
Quite likely you need to include a global from the MK Portal software to get rid of the error, and sorry, but that is not something that I can help with.
Sorry I could not be more help.