Build a Niche Store Affiliate Contest

Add a Trackback link to each Page of your BANS Site

August 28, 2007 | Author: Mark | Filed under: Build a Niche Store Mods

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: (Text File of Code) 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.



Stumble it!

27 people have left comments

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-

Ross Bassette wrote on August 29, 2007 - 1:45 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

Mark wrote on August 29, 2007 - 7:44 am |

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

I will make the change

Thanks

-Ross-

Ross Bassette wrote on August 29, 2007 - 3:38 pm |

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 wrote on September 8, 2007 - 10:37 am |

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

Rochelle wrote on September 8, 2007 - 7:53 pm |

Mark,

I have been trying to get your trackback Mod going on my sites. However, I keep getting the same error:

Parse error: syntax error, unexpected ‘”‘ in /home/rossb1/public_html/test/themes/layout-1-both/footer.php on line 42

I am trying this on mt BANS test site www.ratrodbarn.com/test and have also been getting the same error when installing it on my main site.

Any Suggestions?

-Ross-

Ross wrote on October 11, 2007 - 5:18 pm |

Hi Mark,

I’ve tried what you describe above,
It seems to work for my top link but not for the bottom link.

Can you give me any suggestions?

Randy

Randy wrote on October 21, 2007 - 8:34 am |

Hi Randy -

Toss me the link to your store and I will take a look. I did not see it on the watch site.

Mark

Mark wrote on October 21, 2007 - 8:46 am |

[…] the Page Title MOD to display page-specific dynamic page titles within an H1 […]

[…] the Page Title MOD to display page-specific dynamic page titles within an H1 […]

Hi
A quick question if I may. The title works just fine but the permalink at the bottom returns an error:

Here is the code:

Copyright © -
Permalink:“>title == “){
print SITENAME.”";}?>title();?>

I then refresh my page and I have this error message:

Parse error: syntax error, unexpected ‘”‘ in /home/abc/public_html/moto/themes/layout-1-both/footer.php on line 31

What should I do

Thanks

Jean Marc Gaudreau wrote on October 30, 2007 - 12:28 am |

Please forget the code. It didn’t show the right way. But the error goes to the line where I put the permalink line that you gave us.

Jean Marc

Jean Marc Gaudreau wrote on October 30, 2007 - 12:33 am |

@ Jean -

It looks like the code is a bit skewed due to a copy/paste function.

Did you try copying the code into notepad or from the linked text file above?

If all else fails, just shoot me the login/pw to your admin at mark “at” the nichestorebuilder.com and I will look at it for you.

Mark

Mark wrote on October 30, 2007 - 1:12 pm |

Mark,

Could you possibly put this code in a footer.php file for BANS V2 for us to download? I think the problem is from copying and pasting the second part from this page, even pasted into a notepad file it comes up skewed.

Thanks, Adrienne

Adrienne wrote on November 7, 2007 - 10:18 am |

@ Adrienne -

Thank you for the suggestion - I have included a text file download link.

If you have any problems, please don’t hesitate to ask for help.

Mark

Mark wrote on November 7, 2007 - 4:46 pm |

Mark,

Thank you so much, that did the trick! I really appreciate your help, especially at this time when your father is so ill and you have to be away. You’re a Hero!

Adrienne wrote on November 8, 2007 - 11:23 am |

Hi Mark,

I have another problem. In fixing up my trackback links, I then noticed that my sitemap was gone (I had deleted the code to it in my header file). My site map is back now. The problem is, after I added in the code for my site map I now get the error message below for my permalink at the bottom of my pages. I used code from the text files I downloaded, so it shouldn’t be a problem with that. The page titles at the top of the pages are working fine. Any suggestions?

Fatal error: Cannot redeclare curpageurl() (previously declared in /home/site/public_html/mysite/themes/layout-1-left/header.php:38) in /home/site/public_html/mysite/themes/layout-1-left/footer.php on line 20

Adrienne wrote on November 8, 2007 - 12:59 pm |

Adrienne -

Essentially, what you are being told is that the CurpageURL function is only needed once.

Since you installed both MODS, you could eliminate that portion from one or the other and just be sure it is stated one time in your header file.

If it gives you problems, I would be happy to look at it for you.

Mark

Mark wrote on November 8, 2007 - 3:07 pm |

OK…that did it! Thanks bunches! Now I can move on to updating my other stores…I didn’t want to start until I knew how to do everything right with this one I’ve been creating along with your tutorials.

Thanks again Mark and have a great weekend!

:-)
Adrienne

Adrienne wrote on November 9, 2007 - 10:07 am |

Hi Mark

When pasting in the code for the above mod is the black dot at the begining included ? thats it for now.

PS
Thanks for all of the great information on setting up bans sites, I’m about 3 weeks into my first one. I’m learning a ton of new skills and really enjoy the keyword research and finding ways to slip all in the money phrases. Will probably launch next week. Have plans for at least five more sites maybe more.

JohnT

John wrote on December 5, 2007 - 4:32 pm |

Hi john -

No, the dot is not part of the code. It is best to go back to the top of the post and open the text file associated with the code, you will avoid errant copy/paste code that is common when copying from an html page.

Thanks and good luck with the sites! You wont be disappointed with the results.

Mark

Mark wrote on December 5, 2007 - 5:08 pm |

Hi Mark

It’s me again,

I believe I can do all the steps to get this mod done except the first one as I have never altered a page on my server before. Would you outline the basic steps ?

I’ll be using Cuteftp and eversoft firstpage 06.

Thanks
JohnT

John wrote on December 6, 2007 - 6:45 pm |

Hey Mark

I found some html tutorials and think I can figure this out, thanks for all the great info.

JohnT

John wrote on December 7, 2007 - 4:23 pm |

Looks like it cut off the code in my post. Should have known better. Anyways it’s the code in the “to display on top” section that I can’t find in my header.php file.

Rick wrote on December 8, 2007 - 7:17 pm |

Hi Mark

I used the info here to put the permalinks on 3 of my BANS sites. The first two sites went through perfectly. The last one I did shows up, but now the scripting is messed up. I am using the “layout-1-both” template. When I made all the changes the site is broken into three sections now. The top shows the logo, Store Pages, and Ads. The middle shows the eBay listings. The end shows my ads which would normally be on the right side of the site. Everything shows up including the permalinks. Do you know how I can make it one whole nice site again?
Thanks

Brad wrote on February 13, 2008 - 5:29 pm |

Hi Mark,

I get the first part of the change to work OK.

When I try to do part 2:

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

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

title();?>
Save your header… Check the site to be sure it is working, Done

My header file is different than what you describe.

My site is 2.0

Thanks,

Randy

Randy wrote on February 19, 2008 - 10:37 pm |
SUBSCRIBE TO MY FEED

 Subscribe in a reader