TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 18, 2024, 02:33:15 PM

Login with username, password and session length
Members
  • Total Members: 3,886
  • Latest: Grendor
Stats
  • Total Posts: 195,189
  • Total Topics: 21,220
  • Online today: 112
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 56
  • Total: 57
  • @rjen

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

Started by nite0859, February 28, 2007, 04:46:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nite0859

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.

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.

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.

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.

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.

$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.

// Begin Amazon Search Code ..
$txt['amazon_bbcode_desc'] = 'Amazon Search (USA)';
// End Amazon Search Code ..

RoarinRow


SMF 2.0 RC3
TP 1.0 beta 5-1
Wordpress 3.0