PHP code to create an online tour of website pages

I felt like doing some programming today.  So, I decided to add an online tour to one of my websites, www.XwayXway.com, which is a geo-domain about Stanley Park in Vancouver, B.C., Canada.  I wanted to have links on every .html page that the user can click on to view all the pages of the web site in a particular order.

I decided to do this task using PHP so I didn’t have to duplicate code in every .html file and it would be easier to maintain having one file with the order of all the .html files.  Also,  I had already enabled PHP for my websites on my web host so it was available to use.

First, I created a PHP file called: PHP_StanleyParkTourBottom.php

First, to make it generic, I needed to determine what .html page the user was on:

//get the webpage name, e.g. index.html

$url = $_SERVER[‘REQUEST_URI’];
//strip off the first backslash
$url = trim(str_replace(“/”,””,$url));
//make it uppercase
$url = strtoupper($url);
//echo $url;

This involved a call to the server.  I also stripped off the leading “/” and made it uppercase.

Next, I needed to handle the main webpage to start the tuturial:

//main page may be index.html or blank
if ($url == “INDEX.HTML” or $url == “”)
{
//create the table for the main web page
echo “<!–NAVIGATION–>”;
echo “<p id=\”StanleyParkTourBottomHeading\”>”;
echo “Stanley Park Tour”;
echo “</p>”;
echo “<table id=\”tblStanleyParkTourBottom\”>”;
echo “<tr>”;
echo “<td class=\”tdStanleyParkTourBottom\”><a href=\”XwayXway_Stanley_Park_Tours.html\”>Click Here to Start Free Online Tour of Stanley Park</a></td>”;
echo “</tr>”;
echo “</table>”;
echo “<!–NAVIGATION-END–>”;
}

I decided to use a table.  What you don’t see here is the CSS to make a thick border around the “Click here…” part to make it stand out.  I used “echo” statements to produce the HTML code.  It was a little tricky getting the double-quotes correct.  Remember you have to use \” to do a literal double-quote.

Then, I needed to handle the other .html webpages:

else
{
//first get the previous and next page urls
switch ($url)
{
case “XWAYXWAY_STANLEY_PARK_TOURS.HTML”:
$urlPrevious = “index.html”;
$urlNext = “XwayXway_Stanley_Park_Horse_Drawn_Tours.html”;
break;
case “XWAYXWAY_STANLEY_PARK_HORSE_DRAWN_TOURS.HTML”:
$urlPrevious = “XwayXway_Stanley_Park_Tours.html”;
$urlNext = “XwayXway_Stanley_Park_Aerodynamic_Forms_In_Space_Art.html”;
break;

…   about 100 more cases …

default:
$urlPrevious = “”;
$urlNext = “”;
}

I decided to use a switch statement within the PHP.  I could have created a MySql database and table, but decided that would be overkill.  The switch statement contained the html pages that are on the website.  For each one, the previous and next html pages were defined.  There were some pages that I didn’t want in the tour.  These pages will default to no previous and next page.

Then, I needed to create the tables with the specific previous and next values:

if (!($urlPrevious == “” and $urlNext == “”))
{
//create the table for the current web page
echo “<!–NAVIGATION–>”;
echo “<p id=\”StanleyParkTourBottomHeading\”>”;
echo “Stanley Park Tour”;
echo “</p>”;
echo “<table id=\”tblStanleyParkTourBottom\”>”;
echo “<tr>”;
echo “<td class=\”tdStanleyParkTourBottom\”><a href=\”” . $urlPrevious . “\”>Previous</a></td>”;
echo “<td class=\”tdStanleyParkTourBottom\”><a href=\”” . $urlNext . “\”>Next</a></td>”;
echo “</tr>”;
echo “</table>”;
echo “<!–NAVIGATION-END–>”;
}

Later, I decided to add in a section for the pages that I didn’t include in the tour.  They would just have a link to start the tour similar to the main web page.
else
{
//create the table for the tour start for pages not in the tour
echo “<!–NAVIGATION–>”;
echo “<p id=\”StanleyParkTourBottomHeading\”>”;
echo “Stanley Park Tour”;
echo “</p>”;
echo “<table id=\”tblStanleyParkTourBottom\”>”;
echo “<tr>”;
echo “<td class=\”tdStanleyParkTourBottom\”><a href=\”XwayXway_Stanley_Park_Tours.html\”>Click Here to Start Free Online Tour of Stanley Park</a></td>”;
echo “</tr>”;
echo “</table>”;
echo “<!–NAVIGATION-END–>”;
}

Then, I needed to add the following PHP include statement to each of the 100+ html files on my website:

<?php include(‘PHP_StanleyParkTourBottom.php’); ?>

So, that completes  It was a little tedious adding in all the cases and adding the 1 line to over 100 files, but I am happy with the result.  I’m hoping that the tour will increase the page views and clicks on ads on www.XwayXway.com

Who knew?… I am an All-Star… well according to my LinkedIn Profile Strength!

I was out for coffee with a colleague doing some networking.  I was telling her how I was spending an hour a day on my LinkedIn Profile to see if it would generate some business leads.  Another colleague of ours had told us that he got all his work the last few years from LinkedIn.  So, I thought that I would put in the effort to have a great LinkedIn profile.

My colleague was new to LinkedIn so I thought that I was an ‘expert’ compared to her.  Then, she says, what is your LinkedIn Profile Strength?  I was stunned!  She knew something that I didn’t about LinkedIn.  I didn’t know what a LinkedIn Profile Strength was.  She said that it showed on the right-hand side of your profile page in LinkedIn.  When I went home, I signed into LinkedIn, clicked the Profile tab, and there it was on the right-hand side….I was an All-Star!  Yeah baby!

Your Profile Strength shows within a circle.  If you aren’t yet an All-Star then the circle is not filled up.  If you move your mouse over the circle it tells you the next level that you can attain.  Supposedly, it also gives you a link to suggest improvements to your profile.  The profile strength levels you can have are: Beginner, Intermediate, Expert, and All Star.

How did I become an All-Star?  I did a little research and being an All-Star relates to how complete your profile is.  You need to have a photo, title, industry, a summary, some experience, some skills, and education entered.  You also have to 50 connections.  There are probably some other requirements also, but these are the main ones.

What does it mean to be an All-Star?  Now, below the circle a link to ‘Share your profile’.  Clicking on this link opens a window that allows you to share your LinkedIn Profile on Facebook and Twitter.  There is a generic message followed by a link to your profile, e.g. ‘Check out my professional profile and connect with me on LinkedIn http://lnkd.in/R3YYeX’.  You can change the message to say whatever you want.  In addition to be allowed to share your profile, you also will rank higher in searches in LinkedIn.  One job seeker wrote in a blog post that after achieving All-Star status, he was contacted much more from Fortune 500 companies.

So, it is good to be an ‘All-Star‘!

 

 

Tips for Building Social Media Communities

I’ve been trying to learn more about Social Media lately.  One of the ways that I have been doing this is by participating in a Social Media Podcast.  This podcast is called the Bunker Project and takes place bi-weekly in the back storage room (aka. the Bunker) of a bar in the Barclay Hotel on Robson Street in Vancouver, British Columbia, Canada.

Many of the regular participants have huge Social Media Communities.  One person has over 100,000 Twitter followers and is one of the top Social Media influencers in the world.   Another participant, has a huge LinkedIn following and a noted LinkedIn Expert.  The hosts have done hundreds of Podcasts and are frequent social media contributers.  Other participants include SEO experts and Games developers.   So, these are obviously people with lots of social media experience!

A recent podcast was about building communities in Social Media.  Each participant was asked to give a tip about building social media communities.  These tips were so good, I thought I would write this blog post to share them.

Tips for building Social Media communities:

1. Don’t Spam.  If all you do is bother people and try to sell something you won’t build a good community.

2. Don’t Put a hashtag (#) in front of every word in your Tweets in Twitter.  This is just bad etiquette and makes your Tweet hard to read.

3. Don’t post the same thing to multiple social media sites (e.g. Twitter, LinkedIn, Facebook, Google+, etc.) in a short period of time.  Your community will probably be following you on multiple social media sites and they don’t want to get the exact same post within a few minutes.

4. Give more than you take.  Contribute to your community and you will build your community!

5. Don’t post too many items in a row in a short period of time.  There are tools, e.g. Buffer, that can space out your postings.

6. Like your community.  If you don’t really like your community, what is the point in building a large community?

7. Meet people in your community.  Personal contact with people in your community will raise your standing in the community and help to build your community.  This is easier if your community is local, but if it isn’t you can always go to a convention or meet people in your community when travelling!

These are some of the tips that I have picked up by participating in a community.