Manually Constructing Links

12 posts by 3 authors in: Forums > CMS Builder
Last Post: May 10, 2010   (RSS)

By mark99 - May 8, 2010 - edited: May 8, 2010

I'm not sure if that will work for my needs, anyway I've partly solved the problem with this code (based on a separate code test), except for one big problem:

$numx = $isp_listRecord['num'];
$test = $isp_listRecord['title'] = preg_replace("/[ ]/", "-", $isp_listRecord['title']);
$replace = array();
$replace['Fixed Line Broadband'] = "<a href=http://www.*******************/ISP_Detail.php?"."$test-$numx".">"."Fixed Line Broadband"."</a>";
$replace['Fixed Line Broadband Bundle'] = "<a href=*************************/ISP_Detail_Bundle.php?"."$test-$numx".">"."Fixed Line Broadband Bundle"."</a>";
$replace['Mobile Broadband'] = "<a href=http://www.*******************/ISP_Detail_Mobile.php?"."$test-$numx".">"."Mobile Broadband"."</a>";
$replace['Unmetered Dialup'] = "<a href=http://www.*******************/ISP_Detail_Unmetered.php?"."$test-$numx".">"."Unmetered Dialup"."</a>";

$text = join(', ', getListLabels('isp_list', 'category', $isp_listRecord['category']));

foreach ($replace as $k=>$v)
$text = str_replace($k, $v, $text);
echo $text;

Now this will convert my output of categories to linked words as intended, except some of my catergories like 'Fixed Line Broadband' and 'Fixed Line Broadband Bundle' cross over (too similar). The result is that the script replaces Fixed Line Broadband with a linked version for both but leaves 'Bundle' unlinked and of course they both go to the same category when they're too different cats. What I need is to somehow tell my code to do a more precise match, any ideas? I could just change the categories to 'Fixed-Line-Broadband-Bundle' but that's very ugly and harms my SEO.

Note that in trying to do a more precise match there can be problems as some category names are followed immediately by commas, which might confuse some solutions.

Re: [mark99] Manually Constructing Links

By Jason - May 10, 2010


Could you email me a link to what you have so far so I can take a look. You can email me at

Jason Sauchuk - Project Manager

Hire me! Save time by getting our experts to help with your project.