July 25, 2008, 10:37:16 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Add your links to our directory. Click here to add your links.
 
  Home   Forum   Help Search Directory Calendar Login Register    RSS 2.0 feedAtom feed


News
Add your links to our directory. Click here to add your links.
Pages: [1]
  Print  
Author Topic:

BBC :: Linking keywords inside a post to Amazon.com searches ..

 (Read 1270 times)
0 Members and 1 Guest are viewing this topic.
Nite
Jr. Member
**

Points: 0
Offline Offline

Posts: 55



WWW
« on: February 28, 2007, 08:05:44 »

Searching Amazon from a keyword inside of a regular post.

DEMO :: here.

** Backup your files in case this modification fails for you.

For Amazon.COM, Amazon.CA, Amazon.CO.UK, and AMAZON.DE
Add the Amazon BBC Image Button to :: /Themes/default/images/bbc/amazon.gif
Be sure that the amazon image name is lowercase.
BBC Button Image (23px x 22px) ::
***
Notice :: When examining the code that I have listed, be aware that I have included much of the SURROUNDING code as well. This is so that finding the specific areas for code insertion is made easier. The specific code relevant to enabling the amazon searching will be sectioned off using // with relevant descriptions as to where the amazon searching code begins and where the amazon searching code ends for this particular modification.
***
  For Amazon.COM searches
File to be edited :: /Sources/Subs.php
Where to be added :: Pay attention to where the // Begin and // End occur.
Code:
array(
'tag' => 'html',
'type' => 'unparsed_content',
'content' => '$1',
'block_level' => true,
'disabled_content' => '$1',
),
// Beginning of Amazon Search Code ..
array(
'tag' => 'amazon',
'type' => 'unparsed_content',
'content' => '<a href="http://www.amazon.com/gp/search?index=blended&_encoding=UTF8&tag=amazon-xml-20&camp=211041&creative=374001&linkCode=qs1&adid=0RRMYTA7XJMF27CGEZ7A&keywords=$1" target="_blank">$1</a>',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
                'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_content' => '<span style="color: red;">$1</span>',
),
array(
'tag' => 'amazon',
'type' => 'unparsed_equals',
'before' => '<a href="http://www.amazon.com/gp/search?index=blended&_encoding=UTF8&tag=amazon-xml-20&camp=211041&creative=374001&linkCode=qs1&adid=0RRMYTA7XJMF27CGEZ7A&keywords=$1" target="_blank">',
                'after' => '</a>',
                'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_before' => '<span style="color: red;">',
                'disabled_after' => ' ($1)</span>',
),
// End of Amazon Search Code ..
array(
'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
),
'content' => '<img src="$1" alt="{alt}"{width}{height} border="0" />',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
'disabled_content' => '($1)',
),

  For Amazon.DE searches
File to be edited :: /Sources/Subs.php
Where to be added :: Pay attention to where the // Begin and // End occur.
Code:
array(
'tag' => 'html',
'type' => 'unparsed_content',
'content' => '$1',
'block_level' => true,
'disabled_content' => '$1',
),
// Beginning of Amazon Search Code ..
array(
'tag' => 'amazon',
'type' => 'unparsed_content',
'content' => '<a href="http://www.amazon.de/gp/search?index=blended&_encoding=UTF8&tag=amazon-search-21&camp=1874&creative=7026&linkCode=qs1&adid=1YP1PXQYH77Q7Z3CVEND&keywords=$1" target="_blank">$1</a>',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
                'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_content' => '<span style="color: red;">$1</span>',
),
array(
'tag' => 'amazon',
'type' => 'unparsed_equals',
'before' => '<a href="http://www.amazon.de/gp/search?index=blended&_encoding=UTF8&tag=amazon-search-21&camp=1874&creative=7026&linkCode=qs1&adid=1YP1PXQYH77Q7Z3CVEND&keywords=$1" target="_blank">',
                'after' => '</a>',
                'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_before' => '<span style="color: red;">',
                'disabled_after' => ' ($1)</span>',
),
// End of Amazon Search Code ..
array(
'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
),
'content' => '<img src="$1" alt="{alt}"{width}{height} border="0" />',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
'disabled_content' => '($1)',
),

  For Amazon.CO.UK searches
File to be edited :: /Sources/Subs.php
Where to be added :: Pay attention to where the // Begin and // End occur.
Code:
array(
'tag' => 'html',
'type' => 'unparsed_content',
'content' => '$1',
'block_level' => true,
'disabled_content' => '$1',
),
// Beginning of Amazon Search Code ..
array(
'tag' => 'amazon',
'type' => 'unparsed_content',
'content' => '<a href="http://www.amazon.co.uk/gp/search?index=blended&_encoding=UTF8&tag=amazon-xml-21&camp=1878&creative=7034&linkCode=qs1&adid=0CNVBQZ39V2DE8PGE4PH&keywords=$1" target="_blank">$1</a>',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
                'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_content' => '<span style="color: red;">$1</span>',
),
array(
'tag' => 'amazon',
'type' => 'unparsed_equals',
'before' => '<a href="http://www.amazon.co.uk/gp/search?index=blended&_encoding=UTF8&tag=amazon-xml-21&camp=1878&creative=7034&linkCode=qs1&adid=0CNVBQZ39V2DE8PGE4PH&keywords=$1" target="_blank">',
                'after' => '</a>',
                'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_before' => '<span style="color: red;">',
                'disabled_after' => ' ($1)</span>',
),
// End of Amazon Search Code ..
array(
'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
),
'content' => '<img src="$1" alt="{alt}"{width}{height} border="0" />',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
'disabled_content' => '($1)',
),

  For Amazon.CA searches
File to be edited :: /Sources/Subs.php
Where to be added :: Pay attention to where the // Begin and // End occur.
Code:
array(
'tag' => 'html',
'type' => 'unparsed_content',
'content' => '$1',
'block_level' => true,
'disabled_content' => '$1',
),
// Beginning of Amazon Search Code ..
array(
'tag' => 'amazon',
'type' => 'unparsed_content',
'content' => '<a href="http://www.amazon.ca/gp/search?index=blended&_encoding=UTF8&tag=amazon-search-20&camp=211045&creative=374009&linkCode=qs1&adid=1M7F3E5QVSFP2W9NMEZZ&keywords=$1" target="_blank">$1</a>',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
                'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_content' => '<span style="color: red;">$1</span>',
),
array(
'tag' => 'amazon',
'type' => 'unparsed_equals',
'before' => '<a href="http://www.amazon.ca/gp/search?index=blended&_encoding=UTF8&tag=amazon-search-20&camp=211045&creative=374009&linkCode=qs1&adid=1M7F3E5QVSFP2W9NMEZZ&keywords=$1" target="_blank">',
                'after' => '</a>',
                'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_before' => '<span style="color: red;">',
                'disabled_after' => ' ($1)</span>',
),
// End of Amazon Search Code ..
array(
'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
),
'content' => '<img src="$1" alt="{alt}"{width}{height} border="0" />',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
'disabled_content' => '($1)',
),

For Amazon.COM, Amazon.CA, Amazon.CO.UK, and AMAZON.DE
File to be edited :: /Themes/default/Post.template.php
Where to be added :: Pay attention to where the // Begin and // End occur.
Note :: This code actually makes the BBC button appear.
Code:
$context['bbc_tags'][] = array(
'flash' => array('code' => 'flash', 'before' => '[flash=200,200]', 'after' => '[/flash]', 'description' => $txt[433]),
// Begin Amazon Search Code ..
'amazon' => array('code' => 'amazon', 'before' => '[amazon]', 'after' => '[/amazon]', 'description' => $txt['amazon_bbcode_desc']),
// End Amazon Search Code ..
'stream' => array('code' => 'stream', 'before' => '[stream=475,325]', 'after' => '[/stream]', 'description' => $txt['stream']),
'real' => array('code' => 'real', 'before' => '[real=475,325]', 'after' => '[/real]', 'description' => $txt['real']),
'quick' => array('code' => 'quick', 'before' => '[quick=475,325]', 'after' => '[/quick]', 'description' => $txt['quick']),
'gv' => array('code' => 'gv', 'before' => '[gv=475,325]', 'after' => '[/gv]', 'description' => $txt['gv']),
'yt' => array('code' => 'yt', 'before' => '[yt=425,350]', 'after' => '[/yt]', 'description' => $txt['yt']),
'img' => array('code' => 'img', 'before' => '[img]', 'after' => '[/img]', 'description' => $txt[435]),
'url' => array('code' => 'url', 'before' => '[url]', 'after' => '[/url]', 'description' => $txt[257]),
'email' => array('code' => 'email', 'before' => '[email]', 'after' => '[/email]', 'description' => $txt[258]),
'ftp' => array('code' => 'ftp', 'before' => '[ftp]', 'after' => '[/ftp]', 'description' => $txt[434]),
array(),
'table' => array('code' => 'table', 'before' => '[table]', 'after' => '[/table]', 'description' => $txt[436]),
'tr' => array('code' => 'td', 'before' => '[tr]', 'after' => '[/tr]', 'description' => $txt[449]),
'td' => array('code' => 'td', 'before' => '[td]', 'after' => '[/td]', 'description' => $txt[437]),


For Amazon.COM, Amazon.CA, Amazon.CO.UK, and AMAZON.DE
File to be edited :: /Themes/default/languages/Modifications.english.php
Where to be added :: Add these lines and before the .PHP file closes out, i.e. before the ?> symbol.
Note :: In the code below, change the (USA) to (DE) for German searches. Change the (USA) to (UK) for United Kingdom searches. Change the (USA) to (CA) for Canadian searches.
Code:
// Begin Amazon Search Code ..
$txt['amazon_bbcode_desc'] = 'Amazon Search (USA)';
// End Amazon Search Code ..
« Last Edit: February 28, 2007, 10:03:18 by Nite » Logged



Nite
Jr. Member
**

Points: 0
Offline Offline

Posts: 55



WWW
« Reply #1 on: March 16, 2007, 05:10:01 »

Will someone code this into an SMF mod for release ?

Note that the embedded affiliate ID # can be changed if another SMF admin is an Amazon partner.
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks

TinyPortal v0.9.7 © Bloc
Valid XHTML 1.0! Valid CSS!