Permalink issue - need some help
I'm an old school asp programmer, so in terms of PHP I'm totally lost. I'm running custom blog software that I've just recently made some changes to, and now it seems I've hit the wall.
I have the following snippet of code that I need to point at certain pages, but I'm totally lost.
<a href="/<?php echo permalink($rstDBEdit);?>" title="<?php echo $rstDBEdit["podcast_title"];?>"><?php echo $rstDBEdit["podcast_title"];?></a>
...and here's the function that calls the permalink stuff.
function permalink($a)
{
// need to get category
$r=query_wrapper("SELECT * FROM blog_category WHERE cat_ID = ?",$a["article_category"]);
$c=mysql_fetch_assoc($r);
if(!$c)$c=array("cat_category"=>"-");
$c=preg_replace('@[^\w\s]@si','-',$c["cat_category"]);
$c=preg_replace('@\s+@si','-',$c);
$p=preg_replace('@[^\w\s]@si','',$a['article_title']);
$p=preg_replace('@\s+@si','-',$p);
return strtolower("$c/$a[article_ID]/$p.php");
}
The problem is, I've just added podcasts to my site, and now I would like to use the same function to call entries to the podcast table within the database.
I'm completely lost, how do I do this?
Could I do a permalink ($b) or something?????
function permalink($b)
{
// need to get category
$r=query_wrapper("SELECT * FROM blog_category WHERE cat_ID = ?",$a["podcast_category"]);
$c=mysql_fetch_assoc($r);
if(!$c)$c=array("cat_category"=>"-");
$c=preg_replace('@[^\w\s]@si','-',$c["cat_category"]);
$c=preg_replace('@\s+@si','-',$c);
$p=preg_replace('@[^\w\s]@si','',$a['podcast_title']);
$p=preg_replace('@\s+@si','-',$p);
return strtolower("$c/$a[podcast_ID]/$p.php");
}
BS free SEO services, training and advice - SEO Point