Twitter SMFHacks Facebook SMFHacks SMFHacks.com
** Home Forum Index Hacks Products Login Register Search
Welcome, Guest. Please login or register.
May 18, 2013, 11:55:39 am

Login with username, password and session length
Members
Total Members: 10756
Latest: paul25
Stats
Total Posts: 32348
Total Topics: 5473
Online Today: 56
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 1
Guests: 40
Total: 41
+ 
|-+ 
| |-+ 
| | |-+ 
| | | |-+ 
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Inside first post ad code help  (Read 1077 times)
ApplianceJunk
Sr. Member
****
Offline Offline

Posts: 410



View Profile WWW
« on: May 04, 2012, 09:33:00 am »

I would like to create a simple text ad that is placed inside the first post.

There is already a location for this, but I need help with the ad code itself.

I would like to automatically display the topic title in the ad code and make a link out of it.

So for example:

If the topic title is, "Maytag washer not doing nothing" I would like to have my ad code create a link using that title.

Code:
<a href="http://AffiliatePartsSite.com">Maytag washer not doing nothing</a>

The above is just a example as i'm not sure exactly what I'm going to do with it yet, but what to know if something like that can even be coded to work before I get to carried away with idea's for it.

Thanks,
Logged

SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 10987


View Profile
« Reply #1 on: May 04, 2012, 10:13:45 am »

You would do custom code and something like this
Code:
global $context;
echo '<a href="http://AffiliatePartsSite.com">' . $context['page_title'] . '</a>';
Logged
ApplianceJunk
Sr. Member
****
Offline Offline

Posts: 410



View Profile WWW
« Reply #2 on: May 04, 2012, 10:42:06 am »

Ok, I added your code into the custom ad code text box and it displays this inside the first post.

global $context; echo '' . $context['page_title'] . '';

with '' . $context['page_title'] . '' bing a clickable link.

I tired adding <?php tags but still could not get it to display correctly.
Logged

ApplianceJunk
Sr. Member
****
Offline Offline

Posts: 410



View Profile WWW
« Reply #3 on: May 04, 2012, 10:45:28 am »

I'm such a tard.

I just seen the check box for Is PHP Code?

I checked the box and it works great now!

Thanks,
Logged

SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 10987


View Profile
« Reply #4 on: May 04, 2012, 11:01:06 am »

Glad you got it working.
Logged
ApplianceJunk
Sr. Member
****
Offline Offline

Posts: 410



View Profile WWW
« Reply #5 on: May 04, 2012, 11:06:30 am »

One more question for my wondering mind. Smiley

I see how to add addition text before the page title link, but is it possible to add text before or after the page title link that will become part of the link?

Does that make sense?
Logged

SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 10987


View Profile
« Reply #6 on: May 04, 2012, 11:08:58 am »

Yeah example
echo '<a href="http://AffiliatePartsSite.com">moretexthere ' . $context['page_title'] . ' and more text</a>';
Logged
ApplianceJunk
Sr. Member
****
Offline Offline

Posts: 410



View Profile WWW
« Reply #7 on: May 04, 2012, 11:13:42 am »

I was close, seems so simple now. Smiley

Thanks!
Logged

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

Recent
[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]

[May 07, 2013, 02:37:14 pm]

[May 06, 2013, 10:29:56 pm]

[May 04, 2013, 03:22:01 pm]

[May 04, 2013, 01:08:57 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.201 seconds with 21 queries.