Jump to content

HTML in url


graham23s

Recommended Posts

Hi Guys,

 

My categories on my site look like:

 

86-Health-%3E-Fitness.html it should be: 86-Health->-Fitness.html the funny thing is when i print it to screen it shows as > but when it's in the url it shows as: %3E

 

I feed this into my function:

 

			<?php
			// LOOP OUT THE CATEGORIES
			$qC = "SELECT * FROM `fcs_categories` ORDER BY `category_name` ASC";
			$rC = mysql_query($qC) or die (mysql_error());

			// LOOP
			while ($aC = mysql_fetch_array($rC))
			{
			  // VARS
			  $catID = $aC['id'];
			  $catNM = $aC['category_name'];
			  
			  // Call the function
			  $links = generate_seo_friendly_category_links($catNM, $catID);
			  
			  // Print the links
	      print "<li class=\"\">$links</li>\n";	
                 
         }
          
        ?>

 

Then the function that converts to seo friendly urls

 

function generate_seo_friendly_category_links($catNM, $catID)
{
  
  // Clean up the product names
  $replacedNM = str_replace(" ", "-", $catNM);

  // Trim the white space
  $nameTrimmed = trim($replacedNM);
  
  // The string together
  $brandNewSEOFriendlyURLCat = "<a href='$catID-$nameTrimmed.html'>$catNM</a>";

  return $brandNewSEOFriendlyURLCat;

}

 

is there a way the url can show the symbol > rather than the unsightly %3E

 

thanks a lot guys

 

Graham

Link to comment
https://forums.phpfreaks.com/topic/179093-html-in-url/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.