Popular Posts
Recent Posts
Tools for Niche Site Success Hostgator Unlimited Hosting

Add a Trackback link to each Page of your BANS Site

August 28, 2007

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.

Popularity: 21% [?]

If you enjoyed this post, make sure you subscribe to my RSS feed!

Comments

12 Responses to “Add a Trackback link to each Page of your BANS Site”

  1. Ross Bassette on August 29th, 2007 1:45 am

    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-

  2. Mark on August 29th, 2007 7:44 am

    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

  3. Build a Niche Store Mods | Domain Monetization - The Project of Time on August 29th, 2007 2:00 pm

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

  4. Ross Bassette on August 29th, 2007 3:38 pm

    I will make the change

    Thanks

    -Ross-

  5. Rochelle on September 8th, 2007 10:37 am

    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

  6. Rochelle on September 8th, 2007 7:53 pm

    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

  7. Sands2k on October 23rd, 2007 11:32 pm

    Thank you for this!

    So level 4 of 5 or 10!

  8. Jason Michalek on November 14th, 2007 8:14 pm

    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

  9. Mark on November 14th, 2007 8:38 pm

    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

  10. Steve on December 16th, 2007 8:13 am

    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

  11. janet on December 18th, 2007 12:53 am

    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

  12. Niche Store Strategies » Blog Archive » Add Permalinks (or Link-Backs) to your Site on January 29th, 2008 6:37 pm

    […] 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). […]

Got something to say?





Subscribe to The Niche Store Builder Site

Subscribe to the Niche Store BuilderDon't miss a single post about Developing your Niche Store or Website! Subscribe today and start Making Money!

Featured Links and Resources

Featured Niche Store of the Month

Current Niche Projects

Top Niche Builder Commentators

Last 10 Comments

Blogroll

Niche Builder Categories