Чтение RSS каналов

Форум

Открыть Ответить

Вставка рекламы

1

1
1
16.06.2009 10:07:16
Прошу помощи разобраться с рекламным блоком.Как мне вставить рекламный блок так,что-бы он показывался после каждой новости сам.
Искал на форуме,нашёл похожее,но не то.


Версия системы: SLAED CMS 3.5 Pro
Версия PHP: PHP 5
Сервер: Сервер в интернете
2
16.06.2009 12:34:59
я сделал вот так


В главной функции новостей перед запросом в базу вставляем

$banner_counter= 1;


ниже после basic($cid, $cimg, $ctitle,и так даллее);


if($banner_counter == 2 ){echo"Твоя реклама";}


$banner_counter++;



цифра 2 это значит что после второй новости выводить рекламу
3.74

3.74
3
16.06.2009 13:40:53
ra55551
Большая просьба,опиши по подробней.
В каком файле
Перед или после какой строки вставлять $banner_counter= 1;
и так далее.


Версия системы: SLAED CMS 3.5 Pro
Версия PHP: PHP 5
Сервер: Сервер в интернете
4
16.06.2009 14:04:55
я для модуля новостей привел пример.

Прикрепляй код, напишу
3.74

3.74
5
16.06.2009 14:38:11
Я для модуля новостей и имел ввиду.
Вот сам код

<script type="text/javascript">
if(typeof teasernet=='undefined'){
var teasernet = new Array();
var teasernet_blockid = 14358;
}else
teasernet_blockid = 14358;
teasernet[teasernet_blockid] ={
'styles': {
'TABLE': 'border: 1px dashed #CCCCCC; width: 100%; background: #FFFFFF;',
'TD': 'text-align: center; border: 1px dotted #CCCCCC; background: #FFFFFF; font-size: 10px; color: #000000;',
'IMG': 'border:0; margin: 0 auto;',
'A': 'color:#0000CC; font-size: 10px;',
'AHOVER': 'color:#D50303; font-size: 10px;'
},
'padid': 5496,
'hor': 3,
'ver': 1,
'size': 60
};
document.write('<div id="teasernet_'+teasernet_blockid+'"></div><scr'+'ipt type="text/jav'+
'ascript" src="http://echo.teasernet.ru/step1.php?padid=5496&blockid='+teasernet_blockid+
'&count='+(teasernet[teasernet_blockid].hor*teasernet[teasernet_blockid].ver)+
'&ref='+escape(document.referrer)+'&'+Math.round(Math.random()Смайл - 100000)+'"></scr'+
'ipt>');
</script>
6
16.06.2009 15:12:3816.06.2009 15:14:52
не знаю на сколько это правильно но у меня работает
Тупо не копируй а смотри по своему файлу



function news() {
global $prefix, $db, $admin_file, $user, $conf, $confu, $confn, $home, $pagetitle;
$cwhere = catmids($conf['name'], "s.catid");
$newnum = user_news($user[3], $confn['newnum']);
$sbest = (isset($_GET['best'])) ? 1 : 0;
$shits = (isset($_GET['hits'])) ? 1 : 0;
$scat = (isset($_GET['cat'])) ? intval($_GET['cat']) : 0;
if ($sbest && $confn['newrate']) {
$caton = 0;
$field = "best=1&";
$order = "WHERE s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.score DESC";
$ordernum = "time <= now() AND status!='0'";
$news_logo = _BEST;
$pagetitle = $conf['defis']." "._NEWS." ".$conf['defis']." $news_logo";
} elseif ($shits && $confn['newrate']) {
$caton = 0;
$field = "hits=1&";
$order = "WHERE s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.counter DESC";
$ordernum = "time <= now() AND status!='0'";
$news_logo = _POP;
$pagetitle = $conf['defis']." "._NEWS." ".$conf['defis']." $news_logo";
} elseif ($scat) {
$caton = 1;
$field = "cat=$scat&";
list($cat_title, $cat_description) = $db->sql_fetchrow($db->sql_query("SELECT title, description FROM

".$prefix."_categories WHERE id='$scat'"));
$order = "WHERE s.catid='$scat' AND s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.time DESC";
$ordernum = "catid='$scat' AND time <= now() AND status!='0'";
$pagetitle = $conf['defis']." "._NEWS." ".$conf['defis']." $cat_title";
} else {
$caton = 1;
$field = "";
$order = (!$home) ? "WHERE s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.time DESC" : "WHERE

s.ihome='0' AND s.time <= now() AND s.status!='0' ".$cwhere." ORDER BY s.time DESC";
$ordernum = (!$home) ? "time <= now() AND status!='0'" : "ihome='0' AND time <= now() AND status!='0'";
$news_logo = _NEWS;
$pagetitle = $conf['defis']." $news_logo";
}
head();
if (!$home) {
if ($scat) {
menu($cat_title);
} else {
menu($news_logo);
}
if ($scat) templ("catlink", catlink($conf['name'], $scat, $confn['defis'], _NEWS));
if ($caton == 1) categories($conf['name'], $confn['newcol'], $confn['newsub'], $confn['newcatdesc'], $scat);
}
$num = isset($_GET['num']) ? intval($_GET['num']) : "1";
$offset = ($num-1) * $newnum;
$offset = intval($offset);

##############################тут вставвили
$banner_counter= 1;

$result = $db->sql_query("SELECT s.sid, s.catid, s.name, s.title, UNIX_TIMESTAMP(s.time) as formatted, s.hometext,

s.comments, s.counter, s.acomm, s.score, s.ratings, s.banner, c.id, c.title, c.description, c.img, u.user_name FROM

".$prefix."_stories AS s LEFT JOIN ".$prefix."_categories AS c ON (s.catid=c.id) LEFT JOIN ".$prefix."_users AS u ON

(s.uid=u.user_id) ".$order." LIMIT $offset, $newnum");
if ($db->sql_numrows($result) > 0) {
while (list($sid, $catid, $uname, $stitle, $formatted, $hometext, $comments, $counter, $acomm, $score,

$ratings, $banner, $cid, $ctitle, $cdescription, $cimg, $user_name) = $db->sql_fetchrow($result)) {
$time = date(_DATESTRING, $formatted);
$title = "<a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\"

title=\"$stitle\">".$stitle."</a> ".new_graphic($formatted);
$read = "<a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\"

title=\"$stitle\">"._READMORE."</a>";
$post = ($user_name) ? " "._POSTEDBY.": ".user_info($user_name, 1) : (($uname) ? " "._POSTEDBY.":

".$uname : " "._POSTEDBY.": ".$confu['anonym']);
$ndate = ($confn['newdate']) ? " "._DATE.": ".$time : "";
$reads = ($confn['newread']) ? " "._READS.": ".$counter : "";
if (!$acomm) {
if ($comments == 0) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\"

title=\"$stitle\">"._COMMENTS."</a>";
} elseif ($comments == 1) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\"

title=\"$stitle\">"._COMMENT.": $comments</a>";
} elseif ($comments > 1) {
$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\"

title=\"$stitle\">"._COMMENTS.": $comments</a>";
}
} else {
$comm = "";
}
$hometext = bb_decode($hometext, $conf['name']);
if ($confn['key'] && $conf['keywords']){
$words = explode(', ', $conf['keywords']);
foreach($words as $word){
$hometext = preg_replace('#('.$word.')#i', '<strong>\\1</strong>', $hometext);
while(preg_match('#<([^>]*)<strong>([^<>]+)</strong>([^>]*)>#i', $hometext)){
$hometext = preg_replace('#<([^>]*)<strong>([^<>]+)</strong>([^>]*)>#i', '<\\1\\2\\3>', $hometext);
}
while(preg_match('#<strong><strong>([^<>]+)</strong></strong>#i', $hometext)){
$hometext = preg_replace('#<strong><strong>([^<>]+)</strong></strong>#i', '<strong>\\1</strong>',

$hometext);
}
}
}
$arating = " ".ajax_rating(0, $sid, $conf['name'], $ratings, $score, "");
$print = " ".ad_print("index.php?name=".$conf['name']."&op=printe&id=".$sid);
$admin = (is_moder($conf['name'])) ? " ".add_menu($sid, "<a

href=\"".$admin_file.".php?op=news_add&id=".$sid."\" title=\""._FULLEDIT."\">"._FULLEDIT."</a>||<a

href=\"".$admin_file.".php?op=news_delete&id=".$sid."\" OnClick=\"return DelCheck(this, '"._DELETE."

&quot;$stitle&quot;?');\" title=\""._ONDELETE."\">"._ONDELETE."</a>") : "";
$cdescription = ($cdescription) ? $cdescription : $ctitle;
$cimg = ($cimg) ? "<a href=\"index.php?name=".$conf['name']."&cat=$cid\"><img

src=\"images/categories/".$cimg."\" border=\"0\" alt=\"$cdescription\" title=\"$cdescription\" align=\"right\" hspace=\"10\"

vspace=\"10\"></a>" : "";
$link = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"75%\"

align=\"left\"><b>".$read."</b>".$post.$ndate.$reads.$comm."</td><td>".$arating."</td><td

align=\"right\">".$print.$admin."</td></tr></table>";


basic($cid, $cimg, $ctitle, $sid, $title, $hometext, $link, $read, $post, $ndate, $reads, $comm, $arating, $print, $admin);


####################тут втавили

if($banner_counter == 2 ){
?>

################начало твоего рекламного кода
<script type="text/javascript">
if(typeof teasernet=='undefined'){
var teasernet = new Array();
var teasernet_blockid = 9232;
}else
teasernet_blockid = 9232;
teasernet[teasernet_blockid] ={
'styles': {
'TABLE': 'border: 0px solid #CCCCCC; width: 100%; background: #FFFFFF;',
'TD': 'text-align: center; border: 0px solid #CCCCCC; background: #FFFFFF; font-size: 11px; color: #000000;',
'IMG': 'border:0; margin: 0 auto;',
'A': 'color:#2F4F4F; font-size: 11px;',
'AHOVER': 'color:#D50303; font-size: 11px;'
},
'padid': 2436,
'hor': 1,
'ver': 8,
'size': 100
};
document.write('<div id="teasernet_'+teasernet_blockid+'"></div><scr'+'ipt type="text/jav'+
'ascript" src="http://echo.teasernet.ru/step1.php?padid=2436&blockid='+teasernet_blockid+
'&count='+(teasernet[teasernet_blockid].hor*teasernet[teasernet_blockid].ver)+
'&ref='+escape(document.referrer)+'&'+Math.round(Math.random()Смайл - 100000)+'"></scr'+
'ipt>');
</script>

################конец твоего рекламного кода

<?php
}
$banner_counter++;
###########тут закончмили


echo bb_decode($banner, $conf['name']);

}
num_article($conf['name'], $newnum, $field, "sid", "_stories", "catid", $ordernum);
}
foot();
}
3.74

3.74
7
16.06.2009 16:22:35
Что-то не клеится у меня.таким образом.Вот мой код

function news() {
	global $prefix, $db, $pagetitle, $conf, $confu, $confn, $admin_file, $home, $user, $currentlang;
	$lang = ($conf['multilingual']) ? "AND (c.language='$currentlang' OR c.language='')" : "";
	$newnum = (isset($user[3]) && $confu['news'] == 1) ? intval($user[3]) : intval($confn['newnum']);
	$sbest = (isset($_GET['best'])) ? 1 : 0;
	$shits = (isset($_GET['hits'])) ? 1 : 0;
	$scat = (isset($_GET['cat'])) ? $_GET['cat'] : 0;
	if ($sbest && $confn['newrate']) {
		$caton = 0;
		$field = "best=1&";
		$order = "WHERE time <= now() AND status!='0' ".$lang." ORDER BY score DESC";
		$ordernum = "time <= now() AND status!='0'";
		$news_logo = ""._BEST."";
		$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." $news_logo";
	} elseif ($shits && $confn['newrate']) {
		$caton = 0;
		$field = "hits=1&";
		$order = "WHERE time <= now() AND status!='0' ".$lang." ORDER BY counter DESC";
		$ordernum = "time <= now() AND status!='0'";
		$news_logo = ""._POP."";
		$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." $news_logo";
	} elseif ($scat) {
		$caton = 1;
		$field = "cat=$scat&";
		list($cat_title, $cat_description) = $db->sql_fetchrow($db->sql_query("SELECT title, description FROM ".$prefix."_categories WHERE id='$scat'"));
		$order = "WHERE catid='$scat' AND time <= now() AND status!='0' ".$lang." ORDER BY time DESC";
		$ordernum = "catid='$scat' AND time <= now() AND status!='0'";
		$pagetitle = "".$conf['defis']." "._NEWS." ".$conf['defis']." $cat_title";
	} else {
		$caton = 1;
		$field = "";
		$order = (!$home) ? "WHERE time <= now() AND status!='0' ".$lang." ORDER BY time DESC" : "WHERE ihome='0' AND time <= now() AND status!='0' ".$lang." ORDER BY time DESC";
		$ordernum = (!$home) ? "time <= now() AND status!='0'" : "ihome='0' AND time <= now() AND status!='0'";
		$news_logo = ""._NEWS."";
		$pagetitle = "".$conf['defis']." $news_logo";
	}
	head();
	if (!$home) {
		if ($scat) {
			menu($cat_title);
		} else {
			menu($news_logo);
		}
		if ($caton == 1) categories($conf['name'], $confn['newcol'], $confn['newsub'], $confn['newcatdesc'], $scat);
	}
	$num = isset($_GET['num']) ? intval($_GET['num']) : "1";
	$offset = ($num-1) * $newnum;
	$offset = intval($offset);


	$result = $db->sql_query("SELECT s.sid, s.catid, s.aid, s.title, UNIX_TIMESTAMP(s.time) as formatted, s.hometext, s.comments, s.counter, s.acomm, s.score, s.ratings, c.id, c.title, c.description, c.img FROM ".$prefix."_stories AS s LEFT JOIN ".$prefix."_categories AS c ON (s.catid=c.id) ".$order." LIMIT $offset, $newnum");
	if ($db->sql_numrows($result) > 0) {
		while (list($sid, $catid, $aid, $stitle, $formatted, $hometext, $comments, $counter, $acomm, $score, $ratings, $cid, $ctitle, $cdescription, $cimg) = $db->sql_fetchrow($result)) {
			$time = date(""._DATESTRING."", $formatted);
			$title = "<a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\" title=\"$stitle\">".$stitle."</a> ".new_graphic($formatted)."";
			$read = "<a href=\"index.php?name=".$conf['name']."&op=view&id=$sid\" title=\"$stitle\">"._READMORE."</a>";
			$post = " "._POSTEDBY.": ".user_info($aid, 1)."";
			$ndate = ($confn['newdate']) ? " "._DATE.": ".$time."" : "";
			$reads = ($confn['newread']) ? " "._READS.": ".$counter."" : "";
			if (!$acomm) {
				if ($comments == 0) {
					$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\" title=\"$stitle\">"._COMMENTS."</a>";
				} elseif ($comments == 1) {
					$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\" title=\"$stitle\">"._COMMENT.": $comments</a>";
				} elseif ($comments > 1) {
					$comm = " <a href=\"index.php?name=".$conf['name']."&op=view&id=$sid#$sid\" title=\"$stitle\">"._COMMENTS.": $comments</a>";
				}
			} else {
				$comm = "";
			}
			$arating = " ".ajax_rating(0, $sid, $conf['name'], $ratings, $score)."";
			$print = " ".ad_print("index.php?name=".$conf['name']."&op=printe&id=".$sid."")."";
			$admin = (is_moder($conf['name'])) ? " ".ad_edit("".$admin_file.".php?op=news_add&id=".$sid."")."" : "";
			$cdescription = ($cdescription) ? $cdescription : $ctitle;
			$cimg = ($cimg) ? "<a href=\"index.php?name=".$conf['name']."&cat=$cid\"><img src=\"images/categories/".$cimg."\" border=\"0\" alt=\"$cdescription\" title=\"$cdescription\" align=\"right\" hspace=\"10\" vspace=\"10\"></a>" : "";
			$link = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"75%\" align=\"left\"><b>".$read."</b>".$post."".$ndate."".$reads."".$comm."</td><td>".$arating."</td><td align=\"right\">".$print."".$admin."</td></tr></table>";
			basic($cid, $cimg, $ctitle, $sid, $title, bb_decode($hometext, $conf['name']), $link, $read, $post, $ndate, $reads, $comm, $arating, $print, $admin);


		}
		num_article($conf['name'], $newnum, $field, "sid", "_stories", "catid", $ordernum);
	}
	foot();
}

function liste() {
8
16.06.2009 16:42:25
мне нужно что-бы рекламный блок выводился после новости при просмотре "Подробнее" сразу после "Разместил"
9
16.06.2009 17:52:1116.06.2009 18:05:08
Как идея - в теме создать basic-news-view.html, основу скопировать из basic.html, а в конец добавить код рекламы. Например:

<div class="basic">
	<h3 class="btitle">$arg[4]</h3>
	<div class="morefield">
	$arg[12]
	<span class="arg">$arg[8]</span>
	<span class="arg">$arg[9]</span>
	<span class="arg">$arg[10]</span>
	</div>
	<div class="maincont">
	$arg[1] $arg[5]
	</div>
	<div class="morelink">
	<b>$arg[7]</b><span class="argcom">$arg[11]</span><span class="baseicons">$arg[13]$arg[14]</span>
	</div>
	<div class="clr"></div>
</div>

<!--НАЧАЛО РЕКЛАМА-->
Текст рекламы. Любой html код, либо переменная.
<!--КОНЕЦ РЕКЛАМА-->
10
16.06.2009 19:46:43
У меня basic.html вот какой код:

<table class="basic" width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="7"><img src="templates/$ThemeSel/images/basic_left_top.gif" width="7" height="7" alt="" /></td>
                  <td class="basic-top"><img src="templates/$ThemeSel/images/pixel.gif" width="1" height="7" alt="" /></td>
                  <td width="7"><img src="templates/$ThemeSel/images/basic_right_top.gif" width="7" height="7" alt="" /></td>
                </tr>
                <tr valign="top">

		<td class="basic-left"></td>
		<td>

		<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>
			<td valign="top">
			<h3 id="titlebasic">$title</h3>
			$topicimage $content
			</td>
				</tr>
				<tr>
			<td class="morelink">$arg[100] $morelink</td>
		</tr></table>
		</td>

		<td class="basic-right"></td>
                </tr>
                <tr>
                  <td width="7"><img src="templates/$ThemeSel/images/basic_left_bottom.gif" width="7" height="7" alt="" /></td>
                  <td class="basic-bottom"><img src="templates/$ThemeSel/images/pixel.gif" width="1" height="7" alt="" /></td>
                  <td width="7"><img src="templates/$ThemeSel/images/basic_right_bottom.gif" width="7" height="7" alt="" /></td>
                </tr>
              </table><br />


И что я только не химичил,не получается.
Открыть Ответить
Хотите опробовать SLAED CMS в действии?

Технологии

PHP MySQL HTML 5 CSS 3 jQuery jQuery UI

Контакты

  • D-49179, Deutschland
    Ostercappeln, Im Siek 6
  • +49 176 61966679

  • https://slaed.net
Идеи и предложения
Обратная связь