Alright, I have an article website that I want to monetize a certain way. I would like a script that would allow keywords of my choice to be linked to a website of my choice. For example: everytime the keyword 'hosting' shows up on my website, I want it linked to my affiliate link for HostGator. I briefly searched Google and hotScripts, didnt see anything, and os will pay $3 to the first person who links me to a script like this (PayPal). I prefer the script to be free. Thanks
It's not the most practical way of doing it, but: <<--- SEE BELOW --->> PHP: This is very limited, as it'll only allow you to replace one word as far as I remember. I'll try and find a better example. EDIT: <?php $string = "blah blah blah hostgator andanother: Xtrm2Matt"; $string = str_replace( "hostgator", "<a href=\"http://www.hostgator.com\">hostgator</a>", $string ); $string = str_replace( "Xtrm2Matt", "<a href=\"http://www.Xtrm2Matt.com\">Xtrm2Matt</a>", $string ); echo $string; ?> PHP:
I really need something that will allow me to place some javascript on the top of the file, similair to intellitxt or kontera - only for me own affiliate links. Also, I got the following error when I ran that code: Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\links.php on line 3 +rep for the assistance though
<?php // The text string $text = "All Content here saying hosting"; // The word we want to replace $oldWord = "hosting"; // The new word we want in place of the old one $newWord = "<a href=www.hostgator.com.com>hosting</a>"; // Run through the text and replaces all occurrences of $oldText $text = str_replace($oldWord , $newWord , $text); // Display the new text echo $text; ?> Hope this helps, with understanding comments. Regards, Finney
Updated my post with a sniplet of code I found in one of my old scripts. That way, you can have a list of things you want to change: <?php $string = "blah blah blah hostgator andanother: Xtrm2Matt"; $string = str_replace( "hostgator", "<a href=\"http://www.hostgator.com\">hostgator</a>", $string ); $string = str_replace( "Xtrm2Matt", "<a href=\"http://www.Xtrm2Matt.com\">Xtrm2Matt</a>", $string ); echo $string; ?> PHP: That's PHP anyway. As for javascript, the closest I can get is: <script type="text/javascript"> var str="blah blah blah hostgator"; document.write(str.replace(/hostgator/g, "<a href=\"http://www.hostgator.com\">hostgator</a>") </script> Code (markup): Now this is restricted. I don't know how you'd use this for multiple replaces. Perhaps someone can go from this
@Finney Thanks, but I would need to replace multiple words on each page. It would also be something I need to embed in my article directory script (articledashboard.com)
All of these would work perfect for a static site or possibly a blog. For my site though (using the articledashboard.com script) people post their article through the scripts predefined methods and I do not have access to the script code (obfuscated) so I can't see what is handling the article text to pass it into the $string variable.
Don't know what else to suggest, sorry! I'll be watching the thread if someone manages to come up with a solution, though
Similar to paxis's.. <?php // The text string $text = "All Content here"; // The word we want to replace $oldWord = "hosting"; $oldWord2 = "google"; $oldWord3 = "yahoo"; // The new word we want in place of the old one $newWord = "<a href=www.hostgator.com>hosting</a>"; $newWord2 = "<a href=www.google.com>google</a>"; $newWord3 = "<a href=www.yahoo.co.uk>yahoo</a>"; // Run through the text and replaces all occurrences of $oldText $text = str_replace($oldWord , $newWord , $text); $text = str_replace($oldWord2 , $newWord2 , $text); $text = str_replace($oldWord3 , $newWord2 , $text); // Display the new text echo $text; ?>
Simple put <?php $text = " Code (markup): at the start of your source and then "; ?> Code (markup): at the end of your source. You may have to change all your HTML's " into ' though. Sorry.
The reason I can't do it is because the code is obfuscated that is why I was looking more to included a javascipt type widget similiar to IntelliTXT
I found a guide that showed you how to do one on the internet somewhere. I attatched an example file on what to do. This is fairly simple, you should be able to figure it out from here. I am not sure about upload policy here so I just used the forum built in one.
This is a nice post, thanks for the share. Never considered this with ArticleDashboard, but a great idea!!!