Twitter SMFHacks Facebook SMFHacks SMFHacks.com
** Home Forum Index Hacks Products Login Register Search
Welcome, Guest. Please login or register.
May 19, 2013, 11:34:43 pm

Login with username, password and session length
Members
Total Members: 10760
Latest: gibranabahel
Stats
Total Posts: 32357
Total Topics: 5476
Online Today: 72
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 3
Guests: 53
Total: 56
+ 
|-+ 
| |-+ 
| | |-+ 
| | | |-+ 
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Ad location - Inside Last Post?  (Read 1110 times)
ApplianceJunk
Sr. Member
****
Offline Offline

Posts: 410



View Profile WWW
« 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:

// 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:

// 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,
Logged

ApplianceJunk
Sr. Member
****
Offline Offline

Posts: 410



View Profile WWW
« 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:
if ($message['id'] == $context['first_message'])

to...

Code:
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.
Logged

SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 10989


View Profile
« Reply #2 on: May 08, 2012, 01:25:50 pm »

Yeah that is the variable I like having in the first/ last post
Logged
ApplianceJunk
Sr. Member
****
Offline Offline

Posts: 410



View Profile WWW
« 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:

// 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:

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:

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,
Logged

SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 10989


View Profile
« Reply #4 on: May 08, 2012, 01:43:06 pm »

Try
Code:
if ($message['id'] == $context['topic_last_message'] || $message['id'] == $context['first_message'])

Logged
ApplianceJunk
Sr. Member
****
Offline Offline

Posts: 410



View Profile WWW
« Reply #5 on: May 08, 2012, 01:51:21 pm »

Try
Code:
if ($message['id'] == $context['topic_last_message'] || $message['id'] == $context['first_message'])


That works, of coarse. Smiley

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!
Logged

ApplianceJunk
Sr. Member
****
Offline Offline

Posts: 410



View Profile WWW
« 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. Smiley
Logged

ApplianceJunk
Sr. Member
****
Offline Offline

Posts: 410



View Profile WWW
« Reply #7 on: May 08, 2012, 04:31:54 pm »

Ok, so it's not exactly as I want it yet. Wink

Seems with

Code:

$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.
Logged

Pages: [1] Go Up Print 
« previous next »
Jump to:  

Recent
[Today at 11:13:02 pm]

[Today at 10:01:19 pm]

[Today at 08:18:27 pm]

[Today at 07:03:27 am]

[May 16, 2013, 10:13:46 pm]

[May 15, 2013, 11:32:14 pm]

[May 15, 2013, 11:31:24 pm]

[May 12, 2013, 09:10:43 am]

[May 10, 2013, 03:49:55 am]

[May 07, 2013, 07:12:40 pm]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
TinyPortal v0.9.7 © Bloc
SMF and SimpleMachines are registered trademarks of Simple Machines. SMFHacks.com is not affiliated with nor endorsed by Simple Machines.
Page created in 1.61 seconds with 21 queries.