homepage Welcome to WebmasterWorld Guest from 54.167.174.90
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
php redirection
ajs83

10+ Year Member



 
Msg#: 4846 posted 5:43 am on Aug 24, 2004 (gmt 0)

I am vaguely familiar with php, but not efficent enough to get this added to my site, but wish to have something like this.

What I want to do is when someone (me, a visitor, anyone) posts for example "Amazon" www.amazon/deal/affiliate-id , I would like to override it with my affiliate link. I'm not sure if this also has to do with linking words such as whenever someone posts the word "Amazon" it is automatically hyperlinked with my affiliate link.

and when you hover over the links (to the deal) it shows his address /****.php? and THEN to the deal, which somehow switched the "member who posted it" link to the owner of the site's links.

Also, I would need to customize this to include a dozen or so sites.

Is this easy to write and add? All advice would be greatly appreciated. Thanks!

[edited by: jatar_k at 5:45 pm (utc) on Aug. 24, 2004]
[edit reason] removed urls [/edit]

 

lazydog

10+ Year Member



 
Msg#: 4846 posted 11:53 am on Aug 24, 2004 (gmt 0)

You can use the str_replace function

$replacement_post = str_replace('Amazon', '<a href="http://www.amazon/deal/affiliate-id">Amazon</a>', $post);

Saurabh.

JasonHamilton

10+ Year Member



 
Msg#: 4846 posted 11:54 pm on Aug 29, 2004 (gmt 0)

What I like to do is start my template code with an ob_start(), then at the end of the template (after it's replaced template locations with data), I can do any number of str_replaces into the output buffer before sending to the user.

That way it's not limited to just some posts, but anytime "amazon" is mentioned.

Just be careful that you don't replace text within meta tags, title tags, etc.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved