Welcome to Geeklog, Anonymous Wednesday, February 05 2025 @ 11:07 pm EST
Geeklog Forums
Banner Ad in article 1 and 4
Status: offline
jmucchiello
Forum User
Full Member
Registered: 08/29/05
Posts: 985
In public_html/index.php is probably the only place to really do this. Find this code (this is GL v1.4.0):
$display .= STORY_renderArticle ($A, 'y');
// get plugin center blocks after featured article
if ($A['featured'] == 1) {
$display .= PLG_showCenterblock (2, $page, $topic);
}
// get reamaining stories
while ( $A = DB_fetchArray($result) ) {
$display .= STORY_renderArticle ($A, 'y');
}
Modify the while loop so you keep count of the number of articles rendered and call your ad function after the first and fourth articles.
Text Formatted Code
// display first article$display .= STORY_renderArticle ($A, 'y');
// get plugin center blocks after featured article
if ($A['featured'] == 1) {
$display .= PLG_showCenterblock (2, $page, $topic);
}
// get reamaining stories
while ( $A = DB_fetchArray($result) ) {
$display .= STORY_renderArticle ($A, 'y');
}
9
9
Quote
Status: offline
fakestar
Forum User
Chatty
Registered: 03/15/06
Posts: 37
Text Formatted Code
// get reamaining stories
while ( $A = DB_fetchArray($result) ) {
$display .= STORY_renderArticle ($A, 'y');
if ($A == 1 OR $a ==4){
My banner code
}
}
I did this modification but it doesn't work :/
Can you help me?
12
8
Quote
Status: offline
jmucchiello
Forum User
Full Member
Registered: 08/29/05
Posts: 985
You need an independent article counter:
$display .= STORY_renderArticle ($A, 'y');
$cnt = 0;
// get reamaining stories
while ( $A = DB_fetchArray($result) ) {
++$cnt;
if ($cnt == 1 OR $cnt ==4){
Your banner code
}
$display .= STORY_renderArticle ($A, 'y');
}
Text Formatted Code
// display first article$display .= STORY_renderArticle ($A, 'y');
$cnt = 0;
// get reamaining stories
while ( $A = DB_fetchArray($result) ) {
++$cnt;
if ($cnt == 1 OR $cnt ==4){
Your banner code
}
$display .= STORY_renderArticle ($A, 'y');
}
7
9
Quote
Status: offline
fakestar
Forum User
Chatty
Registered: 03/15/06
Posts: 37
Thanks again jmucchiello.
if i put "test banner" alone i get errors.
I put an echo like this:
but the "test banner" shows above my header, not in article.
what am i doing wrong?
if i put "test banner" alone i get errors.
I put an echo like this:
Text Formatted Code
<br /> $cnt = 0;<br /> // get reamaining stories<br /> while ( $A = DB_fetchArray($result) ) {<br /> ++$cnt;<br /> if ($cnt == 1 OR $cnt ==4){<br /> echo ("test banner");<br /> }<br /> $display .= STORY_renderArticle ($A, 'y');<br /> }<br /><br />but the "test banner" shows above my header, not in article.
what am i doing wrong?
12
12
Quote
Status: offline
jmucchiello
Forum User
Full Member
Registered: 08/29/05
Posts: 985
You never echo in Geeklog. See all the other lines that say $display .= something. You need to write $display .= MyAdFunction() where MyAdFunction returns valid HTML containing your ads.
9
10
Quote
All times are EST. The time is now 11:07 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content