Permalink issue - need some help

2 replies
Hi everyone,
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");
}
#issue #permalink
  • Profile picture of the author JohnTimmins
    Woo... I guess you should approach your co-programmers... I am new to PHP but I love to learn ASP as well...
    Signature
    {{ DiscussionBoard.errors[7492091].message }}
  • Profile picture of the author John Romaine
    I have a programmer but he's not available at the moment. Was hoping to have someone help out with this tonight.
    Signature

    BS free SEO services, training and advice - SEO Point

    {{ DiscussionBoard.errors[7492113].message }}

Trending Topics