I have a situation where a client needs interlinking sets that are displayed on his footer, but every page it needs a completely different interlinking set. So we decided we would just throw all of our interlink sets in arrays and call them out in a quick PHP snippet. SUCCESS! It works, but now we have an even bigger issue. With the site racking up well over 500 pages, the manual labor needed to input each interlinking set is going to consume to much time. So my goal is to develop a PHP script that will take an interlinking set (see below) and place into an array (see below) and all we then need to do is go through each page and look to see if it has an interlinking set at the footer if it doesn’t we will write a quick snippet which will take far less time then programming all of the interlinking sets.
Here is what the interlinking set looks like (from our source code)
<!-- begin_block_7-->
<h2>Cost Reduction Resources</h2>
<a href="http://www.sourceconsulting.com/">shipping charges</a> ||
<a href="http://www.sourceconsulting.com/shipping-costs-calculators/fedex-ups-rates-calculator">ups shipping</a> ||
<a href="http://www.sourceconsulting.com/carrier-contract-negotiation">freight delivery</a> ||
<a href="http://www.sourceconsulting.com/parcel-freight-bill-audit">freight payment companies</a> ||
<a href="http://www.sourceconsulting.com/shipping-costs-calculators">compare shipping costs</a>
<!-- end_block_7 -->
We need to take that interlinking set and place it into an array like this
$interlinking_set_1 = array ( "<a href='http://www.sourceconsulting.com'>cost freight shipping</a><br/>",
"<a href='http://www.sourceconsulting.com/carrier-contract-negotiation'>trucking freight rates</a><br/>",
"<a href='http://www.sourceconsulting.com/shipping-costs-calculators/fedex-ups-rates-calculator'>ups shipping calculator</a><br/>",
"<a href='http://www.sourceconsulting.com/parcel-freight-bill-audit'>air freight carrier</a><br/>",
"<a href='http://www.sourceconsulting.com/reduce-shipping-costs'>shipping costs</a><br/>",
"<a href='http://www.sourceconsulting.com/shipping-costs-calculators'>freight rate calculator</a><br/>"
);
I know that this will definitely use regex which is why I included it as a tag. I’m at a complete lose as to how to do this. We have well over 500 interlinking sets that need to be inputted into an array. We have already spent over 10 man hours doing this and there must be a simpler solution. I’m not asking for someone to write the script for me just give me a “comprehensible” idea that can be put into effect with out tons of hours.
Thanks
Dyllen
That’ll get you your links and output them