Jump to content

Displaying function help


graham23s

Recommended Posts

Hi Guys,

 

I'm trying to tuen my links into SEO friendly ones, everything works fine untill:

 

// GET THE PRODUCTS RANDOMLY AND PUT THEM IN A VARIABLE
$productDisplay = "<form action='cart.php' method='POST' name='fcp-add-cart-form' />
                    <input type='hidden' name='fcp-cart-trigger' value='1' />
                    <input type='hidden' name='fcp-cart-trigger-product-id' value='$pID' />
                    <input type='hidden' name='fcp-cart-trigger-quantity' value='1' />
                    <table class='$borderColor' border='0' cellpadding='20' cellspaing='0' />
                    <tr>
                    <td align='center'><img src='imgProducts/img-th/$pTH' border='0'></td><td class='fcp-product-display' align='center'>" . generate_seo_friendly_links($pNM, $pID) . "</td>
                    </tr>
                    <tr>
                    <td align='center'><div class='TopSellerNumber'>£$pPR</div></td><td align='center'>$pBtn</td>
                    </td>
                    </tr>
                    </table>
                    </form>";  

 

this bit: " . generate_seo_friendly_links($pNM, $pID) . "

 

if i echo the product name like normal the name is displayed within the table, but when i do the above all the return values are somehow out the table, the function is:

 

function generate_seo_friendly_links($pNM, $pID)
{
  
  // Clean up the product names
  $replacedNM = str_replace(" ", "-", $pNM);
  
  print "<a href='$replacedNM-$pID.html'>$pNM</a>";

}

 

i can't see how returning the URL ammended somehow throws the table out of whack

 

thanks for any help guys

 

Graham

Link to comment
https://forums.phpfreaks.com/topic/156326-displaying-function-help/
Share on other sites

Sorry guys fixed it, i did:

 

function generate_seo_friendly_links($pNM, $pID)
{
  
  // Clean up the product names
  $replacedNM = str_replace(" ", "-", $pNM);
  
  $brandNewSEOFriendlyURL = "<a href='$replacedNM-$pID.html'>$pNM</a>";
  
  return $brandNewSEOFriendlyURL;

}

 

cheers

 

Graham

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.