Welcome to Geeklog Friday, February 15 2019 @ 07:57 pm EST

Geeklog Forums

Affiliates block


Status: offline

Sentinel

Forum User
Junior
Registered: 13/06/07
Posts: 15
Used an Affiliates add on that I found on this site, and it's not working. I need something to create a links block on my page
dadesentinel.com. Any advice would be great.

Here is the code that I put into my geeklog/system/libcustom.php file.
PHP Formatted Code

function phpblock_Affiliate()
{

global $_CONF, $_TABLES, $LANG10;

$result = DB_query( "SELECT lid,url,title,hits from {$_TABLES['links']} WHERE category = 'Affiliates' ORDER BY title" );
$nrows = DB_numRows( $result );

$affil_templates = new Template( $_CONF['path_layout'] . 'stats' );
$affil_templates->set_file( array(
'itemstats'=>'itemstatistics.thtml',
'statrow'=>'singlestat.thtml'
));

if( $nrows > 0 )
{
//uncomment if you would like the links/stats headers to display
//$affil_templates->set_var( 'item_label', $LANG10[19] );
//$affil_templates->set_var( 'stat_name', $LANG10[20] );

for( $i = 0; $i < $nrows; $i++ )
{
$A = DB_fetchArray( $result );

$affil_templates->set_var( 'item_url', $_CONF['site_url'] . '/portal.php?url=' . $A['url'] . '&what=link&item=' . $A['lid'] );
$affil_templates->set_var( 'item_text', stripslashes( str_replace( '$', '$', $A['title'] )));
// uncomment if you would like the stats to display next to the affiliate
//$affil_templates->set_var( 'item_stat', $A['hits'] );

$affil_templates->parse( 'stat_row', 'statrow', true );
}

$affil_templates->parse( 'output', 'itemstats' );

$retval .= $affil_templates->finish( $affil_templates->get_var( 'output' ));
}
else
{
$retval .= $LANG10[21];
}
return $retval;
}

Status: offline

Robin

Forum User
Full Member
Registered: 15/02/02
Posts: 725
Hi there,
I checked the block and looks like it's ok. Meaning it displays links under "Affiliates" category.
There is no error.

"To add Affiliates, add links as your normally would with a category titles 'Affiliates'."

HTH
Robert
Geeklog Polish Support Team

dwcondu

Anonymous
Where might one input code to get these links to open in a new window? I assume the code would be target="_blank." Correct me if I'm wrong but please tell me where to insert the right code.

TIA
dwcondu

dwcondu

Anonymous
Quote by: dwcondu

Where might one input code to get these links to open in a new window? I assume the code would be target="_blank." Correct me if I'm wrong but please tell me where to insert the right code.

TIA
dwcondu


I would appreciate a reply to dwcondu [at] dancompco.com if it's not asking too much.

Status: offline

Robin

Forum User
Full Member
Registered: 15/02/02
Posts: 725
Quote by: dwcondu

Where might one input code to get these links to open in a new window? I assume the code would be target="_blank." Correct me if I'm wrong but please tell me where to insert the right code.



That would go to singlestat.thtml in layout directory.
Currently it's:
PHP Formatted Code
 <tr>
                                    <td>
                                        <a href="{item_url}">{item_text}</a>
                                    </td>
                                    <td class="alignright">{item_stat}</td>
                                </tr>


Change it into this:
PHP Formatted Code
 <tr>
                                    <td>
                                        <a href="{item_url}" target="_blank">{item_text}</a>
                                    </td>
                                    <td class="alignright">{item_stat}</td>
                                </tr>

Geeklog Polish Support Team

All times are EST. The time is now 07:57 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content