Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4257
Latest: Alex998.
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43295
Total Topics: 7523
Most Online Today: 236
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 241
Total: 241

Author Topic: Ad location - Inside Last Post?  (Read 10003 times)

0 Members and 1 Guest are viewing this topic.

Offline ApplianceJunk

  • Sr. Member
  • ****
  • Posts: 432
    • View Profile
    • ApplianceJunk.com
Ad location - Inside Last Post?
« on: May 08, 2012, 10:35:16 am »
I already use the ad location for 'Inside First Post', but would also like to create a new ad location for 'Inside Last Post'.

Just like I notice you have in the forum here.

I see were the code for "Inside First Post" was placed in Display.template.php

Just after...

Code: [Select]

// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
echo '
<div class="signature" id="msg_', $message['id'], '_signature">', $message['member']['signature'], '</div>';


is this code for "Inside First Post".

Code: [Select]

// Begin Ad Seller Pro Location - Inside First Post
if ($message['id'] == $context['first_message'])
{
global $sourcedir;
include_once $sourcedir . "/adseller2.php";

$adSellerAdData =  ShowAdLocation(6);
if ($adSellerAdData != false)
{
echo $adSellerAdData;
}
}
// End Ad Seller Pro Location - Inside First Post


I'm not sure though were to place a new ad code for "Inside Last Post".

Could you once again point me in the right direction?

Thanks,

Offline ApplianceJunk

  • Sr. Member
  • ****
  • Posts: 432
    • View Profile
    • ApplianceJunk.com
Re: Ad location - Inside Last Post?
« Reply #1 on: May 08, 2012, 01:22:31 pm »
So I found that if I change this ad code for "Inside First Post"

Code: [Select]
if ($message['id'] == $context['first_message'])
to...

Code: [Select]
if ($message['id'] == $context['topic_last_message'])
It moves the code from the inside the first post to inside the last post.

Still playing around with it, but I maybe able to get it from here.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Ad location - Inside Last Post?
« Reply #2 on: May 08, 2012, 01:25:50 pm »
Yeah that is the variable I like having in the first/ last post
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline ApplianceJunk

  • Sr. Member
  • ****
  • Posts: 432
    • View Profile
    • ApplianceJunk.com
Re: Ad location - Inside Last Post?
« Reply #3 on: May 08, 2012, 01:39:51 pm »
Ok, so now instead of trying to create a new ad location for "Inside Last Post" I have simply been trying to edit the current "Inside First Post" code so the same ad displays in both the first and last post.

This is of coarse the code for "Inside First Post"

Code: [Select]

// Begin Ad Seller Pro Location - Inside First Post
if ($message['id'] == $context['first_message'])
{
global $sourcedir;
include_once $sourcedir . "/adseller2.php";

$adSellerAdData =  ShowAdLocation(6);
if ($adSellerAdData != false)
{
echo $adSellerAdData;
}
}
// End Ad Seller Pro Location - Inside First Post


I have been working with this line of code.

Code: [Select]

if ($message['id'] == $context['first_message'])


Trying to combine, it with this as I can seem to have it display in the first or last, but can't seem to combine the two without getting syntax errors.

Code: [Select]

if ($message['id'] == $context['topic_last_message'])


Is there a correct way to combine the two $context code or I'm I just going about it the wrong way from the start?

Thanks,

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Ad location - Inside Last Post?
« Reply #4 on: May 08, 2012, 01:43:06 pm »
Try
Code: [Select]
if ($message['id'] == $context['topic_last_message'] || $message['id'] == $context['first_message'])

Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline ApplianceJunk

  • Sr. Member
  • ****
  • Posts: 432
    • View Profile
    • ApplianceJunk.com
Re: Ad location - Inside Last Post?
« Reply #5 on: May 08, 2012, 01:51:21 pm »
Try
Code: [Select]
if ($message['id'] == $context['topic_last_message'] || $message['id'] == $context['first_message'])


That works, of coarse. :)

I was not even close, but now i see.
I was looking for other examples in the template to try and figure it out, but was not even close.

Thanks!

Offline ApplianceJunk

  • Sr. Member
  • ****
  • Posts: 432
    • View Profile
    • ApplianceJunk.com
Re: Ad location - Inside Last Post?
« Reply #6 on: May 08, 2012, 02:01:11 pm »
I also see now how to create a separate ad location for "Inside Last Message".

This will help me track the difference between the google ad in the first post and last message.

The more I learn about your code the more I'm amazed at how much work you must have put into such a project.

Thanks again for helping to educate me. :)

Offline ApplianceJunk

  • Sr. Member
  • ****
  • Posts: 432
    • View Profile
    • ApplianceJunk.com
Re: Ad location - Inside Last Post?
« Reply #7 on: May 08, 2012, 04:31:54 pm »
Ok, so it's not exactly as I want it yet. ;)

Seems with

Code: [Select]

$context['topic_last_message']


 it only shows on the very last one.

So if one topic has multiple pages of replies I only see the ad on the very last message.

I would like to see the ad on the last message of each page, if that makes sense.

I see that is how your ad works here in the topic.

Offline ApplianceJunk

  • Sr. Member
  • ****
  • Posts: 432
    • View Profile
    • ApplianceJunk.com
Re: Ad location - Inside Last Post?
« Reply #8 on: February 19, 2014, 06:19:23 pm »
I never did figure out why this only shows on the very last reply instead of the last reply on every page.

Code: [Select]
$context['topic_last_message']
How do you get your ads on your SMFhacks forum to show up on every last replay per page instead of just the very last reply for the topic?

I have no problem with this showing the code on the first replay of every page.

Code: [Select]
if ($message['id'] == $context['first_message'])
If I have 30 replies to a topic and 10 on each page the 'first_message' ad is displayed on the first message of each page if that make sense.

I would like to get the topic_last_message to do that to and not just display on the very last reply.

Thanks,


Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Ad location - Inside Last Post?
« Reply #9 on: February 19, 2014, 06:25:03 pm »
On this site I used
Code: [Select]
if($context['last_message'] == 0 || $message['id'] == $context['first_message'])
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline ApplianceJunk

  • Sr. Member
  • ****
  • Posts: 432
    • View Profile
    • ApplianceJunk.com
Re: Ad location - Inside Last Post?
« Reply #10 on: February 19, 2014, 06:29:15 pm »
On this site I used
Code: [Select]
if($context['last_message'] == 0 || $message['id'] == $context['first_message'])

Just tried that and in SMF 2.0.7 it displays the ad inside every reply. Well with google I only see the ad three times, but then after that there is a large space in each reply were the ad would show if google showed more then three ads at once.

Is it different in SMF 2.0.7 then what code you use here for SMF 1.1.19

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Ad location - Inside Last Post?
« Reply #11 on: February 19, 2014, 06:44:06 pm »
It maybe different between those two versions haven't checked SMF 2.0.x
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline ApplianceJunk

  • Sr. Member
  • ****
  • Posts: 432
    • View Profile
    • ApplianceJunk.com
Re: Ad location - Inside Last Post?
« Reply #12 on: July 26, 2015, 11:06:41 am »
On this site I used
Code: [Select]
if($context['last_message'] == 0 || $message['id'] == $context['first_message'])

I hate to be such a pest. ;)
Was wondering now since you have switch to SMF 2.0.9 if the line of code you used above has changed.

Thanks,

Edited to add: Well now that I turned off my ad blocker on see you only display a google ad on first post with SMF 2.0.9 and not first and last post of each forum page as you did with SMF 1.x.x

I would still like to find a way to display a ad on first and last post of each forum page with SMF 2.0.9 like you use to do with SMF 1.x.x
« Last Edit: July 26, 2015, 11:11:26 am by ApplianceJunk »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Ad location - Inside Last Post?
« Reply #13 on: July 26, 2015, 11:34:29 am »
Try this and see if this helps
Code: [Select]
if($message['id']  ==  $context['topic_last_message'] || $message['id'] == $context['first_message'])
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
28 Replies
23761 Views
Last post April 13, 2007, 07:56:47 am
by sduford
7 Replies
4410 Views
Last post May 04, 2012, 11:13:42 am
by ApplianceJunk
2 Replies
3207 Views
Last post November 15, 2012, 07:46:48 pm
by ApplianceJunk
2 Replies
5006 Views
Last post April 02, 2014, 07:12:56 pm
by diabloviejo
9 Replies
4810 Views
Last post October 27, 2014, 05:19:02 pm
by SMFHacks

+- Recent Topics

Please Help! by SMFHacks
April 17, 2024, 08:04:55 am

Rate own images by fvlog19
April 11, 2024, 10:56:53 am

Tidy Child Boards on 2.1.4 by SMFHacks
April 04, 2024, 03:54:12 pm

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
March 30, 2024, 12:41:08 pm

Can't DROP 'id_member'; check that column/key exists Datei: by SMFHacks
March 30, 2024, 11:58:20 am

No thumbnails on new uploads by Tonyvic
March 29, 2024, 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

Powered by EzPortal