Welcome to Geeklog Thursday, January 20 2022 @ 12:52 am EST

Geeklog Forums

Modifying links for target=_blank


tokyoahead

Anonymous
Hi

I want to modify the links on my page regarding the links section and the RSS feeds to use target=_blank

is it possible at all to change only those? Which functions do I have to touch?

thanks

Oliver
 Quote

Status: offline

James Fryer

Forum User
Junior
Registered: 06/08/02
Posts: 17
I did this. Here's how I did it. This should be complete, let me know if any problems.

** config.php

Add this:

PHP Formatted Code

// If non-empty, used as target for links
$_CONF['linkstarget'] = '_blank';

 


** public_html/links.php

At about line 170, add the following:

PHP Formatted Code

           if ($nrows < $end) {
                $end = $nrows + 1;
            }
        }

        if (!empty($_CONF['linkstarget']))
            $linkstarget = ' TARGET="' . $_CONF['linkstarget'] . '"';
        else
            $linkstarget = '';
        $linklist->set_var('linkstarget', $linkstarget);
        $currentcategory = '';
        for ($i = 1; $i < $end; $i++) {

 


** public_html/lib-common.php

You need to add code here to make the 'what's new' links open into the target.

At about line 4423 add the following:

PHP Formatted Code


     if( $nrows > 0 )
        {
            if (!empty($_CONF['linkstarget']))
                $linkstarget = ' TARGET="' . $_CONF['linkstarget'] . '"';
            else
                $linkstarget = '';
            $newlinks = array();

 



At about line 4454 add the following:

PHP Formatted Code

                  // Trim the length if over 16 characters                                                                        
                    $itemlen = strlen( $A['title'] );
                    if( $itemlen > 16 )
                    {
                        $newlinks [] = '<a href="' . $lcount . '"' . $linkstarget . ' title="'
                            . $A['title'] . '">' . substr( $A['title'], 0, 16 )
                            . '...</a>' . LB;
                    }
                    else
                    {
                        $newlinks[] = '<a href="' . $lcount . '"' . $linkstarget . '>'
                            . substr( $A['title'], 0, $itemlen ) . '</a>' . LB;
                    }
                }
            }
        }

        if( $foundone == 0 )

 


* layout/.../links/linkdetails.thtml

Change this file to read:

PHP Formatted Code

<li>
  <strong><a href="{link_url}"{linkstarget}>{link_name}</a></strong> ({link_hits})<br>
  {link_description}
</li>        

 

 Quote

All times are EST. The time is now 12:52 am.

  • 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