Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.