Add a Trackback link to each Page of your BANS Site

Add a Link-Back to the Bottom of your Store (Skill : 4)
The whole reason behind the link back is for search engine spiders. One of the methods I have used for years is to try and get the FIRST and LAST bit of text a spider reads, in line with the meta and content of the page itself.  When the opportunity presents itself to have the LAST bit of text in the form of a perma-link, or link back to the same page… why not invite the spider to that info as well?

How to do it! (Part 1: Download or open in text file)
In the cont/ folder of the BANS site, open the “FrontControl.php” file and look around line number 94 or search for the string: “function meta()” Directly above the string, you will need to paste the following code from the text file above:

  • //Added for Functional Titles
     function title(){
          global $checkFile;
          $data = new DB;
          $data1 = new DB;
          if (is_numeric($checkFile)) {
             $f = “”.$this->getPageArea(“title”,$checkFile,”id”).”";
          return $f;
          } elseif($this->id == MAINCAT && $this->q == ”){
             $f = “”.$this->getPageInfo(‘title’,”id=’1””).”";
       }
       else {
             if($this->title == ”){
                if ($this->catid != MAINCAT)
                {$data->q(“SELECT * FROM categories WHERE id  = ‘”.$this->id.”‘ “) or die(mysql_error());
                while($info = $data->nx())
                {if (SITENAME == “”) $f .= “”;
                else $f .= SITENAME.” – “; $f .= “”.$info['cat_name'] . “”;
                $data1->q(“SELECT * FROM categories WHERE id  = ‘”.$info['parent_id'].”‘ “) or die(mysql_error());
                while($parinfo = $data1->nx())
                { $f .= ” – “.$parinfo['cat_name'] . ” “;}}}
                else {$data->q(“SELECT * FROM categories WHERE id  = ‘”.$maincatid.”‘ “) or die(mysql_error());
                while($info = $data->nx())
                {if (SITENAME == “”) $f .= “”;
                else $f .= SITENAME.” – “; $f .= “$this->q “.$info['cat_name'] . ” “;}}
                if ($this->catid == ‘0′)   $f .= SITENAME.” – “.$this->q;}
                else{
                   $f .= $this->title;
     }}
     return $f;
       }
    //end Functional Titles

Now that you have a way to display the page titles on an individual page basis, you need to call onto your site to be displayed. I personally prefer to call it twice – Once at the beginning and once at the end, with the end call having the return link to the same page.

To display on top:
Go into your Build a Niche Store admin and edit your template header file.  Around line 13, you will see:

<table align=”center” border=”0″ cellpadding=”0″ cellspacing=”0″ width=”780″>
  <tbody>
    <tr>

To add a NEW row to the very top of your page, place the following code BETWEEN the <tbody> and first <tr> tag.

  • <tr><td><?=$front->title();?></td></tr>

Save your header… Check the site to be sure it is working, Done

To display as a permalink on the bottom of each page: (Download or Open in text file)
There are actually 2 parts to this function, grabbing the current page and displaying the permalink. In your BANS admin, open your footer file from your template section.

Part 1: To grab the current page, add the following code right before the area you wish to display the permalink.

  • <?php
    function curPageURL() {
     $pageURL = ‘http’;
     if ($_SERVER["HTTPS"] == “on”) {$pageURL .= “s”;}
     $pageURL .= “://”;
     if ($_SERVER["SERVER_PORT"] != “80″) {
      $pageURL .= $_SERVER["SERVER_NAME"].”:”.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
     } else {
      $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
     }
     return $pageURL;
    }
    ?>

Now that you have told the server to store the current page, you can use it in your permalink.

Part 2: Choose the section that you want your link to appear, ideally, it will be the last thing any visitor or search engine will see on your page. Paste the following code:

  • PermaLink:<a href=”<?php echo curPageURL();?>”><?php if ($front->title == ”){ print SITENAME.”";}?><?=$front->title();?></a>

Save your footer file and you are done.

Previously Published Articles You May Like to Read:

Rate This Post

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

13 Comments »

  • Ross Bassette said:

    Mark,

    I tried doing the changes exactly as you described. However, for the top display, it would not show at all. For the display at the bottom of the page, it was printing out the url twice. I will post the code from my
    header,frontcontrol and footer files later this week, if you are interested in taking a look. after I get some sleep.

    -Ross-

  • Mark said:

    Ross -

    I love your Niche… I visited the site this morning and got lost for an hour looking at some wonderful cars!

    For some reason – you main home page is not displaying correctly, but every other page does fine! After looking at your code, the main page “Description” (Meta-Description) has the following:

    1,000’s of rat rods for sale…

    You need to spell the word thousands, versus using the apostrophe – it is closing the tag and causing the page to skew.

    Mark

  • Ross Bassette said:

    I will make the change

    Thanks

    -Ross-

  • Rochelle said:

    Hi Mark,

    I noticed a difference between the text you posted for the “FrontControl.php” page. The text you have on this page shows the code ending with “//end Functional Titles” but this is not in the code from the text document just above it. Is this needed to end (or close) the code?

    Thank you for all you’ve done and shared here.

    Rochelle

  • Rochelle said:

    Mark,

    I was able to get this working with my v1.3 store but it won’t for my v2.0. Is there something different I need to do for the new version?

    Thank you,
    Rochelle

  • Sands2k said:

    Thank you for this!

    So level 4 of 5 or 10!

  • Jason Michalek said:

    I’m trying to implement this mod after I’ve already placed the sitemap mod on my site.

    I’m getting this error now:

    Fatal error: Cannot redeclare curpageurl() (previously declared…

    How can I fix this?

    Thanks,
    Jason Michalek

  • Mark said:

    Jason -

    You should be able to eliminate the portion that gets the current page from the header section of the page (Part 1 above)

    Since you already have the sitemap mod installed, the curpage section is already declared.

    If you see two instances, just remove one of them.

    If you have any problems – use the contact page above and send me the url.

    Thanks,

    Mark

  • Steve said:

    Hello Mark,
    This is the first time I have attempted this mod and am doing it on a new site. I couldn’t find the code for the header insert in the template and when I inserted the code in the footer I got the following error- Parse error: syntax error, unexpected ‘:’ in /home/steves2t/public_html/mobilityscooters4sale/themes/layout-1-left/footer.php on line 22.
    Any idea what I am doing wrong? Be gentle I am completely new to this!
    Regards
    Steve

  • janet said:

    I tried this too and got the same error as Steve when I put the code in the footer. I’d really like to get this working!
    janet

  • Matt said:

    Also, failed to work. Because of new templates?

  • Build a Niche Store Mods | Domain Monetization - The Project of Time said:

    [...] Add a Link-Back to the Bottom of your Store (Skill : 4) [...]

  • Niche Store Strategies » Blog Archive » Add Permalinks (or Link-Backs) to your Site said:

    [...] BANS member Mark (aka meeymydomains) has given us many excellent mods for our sites. This one, though, seems to be difficult for members to impliment. I took an afternoon and wrote up my own instructions for this mod and it has worked for me. Here are my instructions for Mark’s mod (you can see his instructions here). [...]

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.