Integrating Text Link Ads into Textpattern is quite easy. In this TXP Tip, based on the excellent tutorial by Juanjo Navarro on the Spanish language TXP site Textpattern Mania, we explain how.
Get your code from Text Link Ads
Assuming you have already created your account with TLA (and been approved!) you should have some PHP code that would normally be used directly in your page template. Something like this:
<?php
function tla_ads() {
// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;
// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = "local_12345.xml";
Create the XML file
You must create a new blank file called local_12345.xml (replace with the actual file name you are given by TLA), and CHMOD the file to 666. You can place the file where you want, but then you will have to change the path to the file, for example: "/home/myname/domains/mydomain.com/scripts/local_12345.xml";
Add Textpattern PHP tags
Remove the opening and closing PHP tags and replace them with TXP PHP tags:
<txp:php>
function tla_ads() {
// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;
// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = "/home/myname/domains/mydomain.com/scripts/local_12345.xml";
..........
..........
</txp:php>
Create a form called text_link_ads
Place your TLA code with the TXP PHP opening and closing tags in a form called text_link_ads and save as type misc.
Call the form in your page
<div id="textads">
<txp:output_form form="text_link_ads" />
</div>
If everything works as it should, you will see a test link and receive an email from TLA.