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
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

Link to comment
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.