Jump to content

Smarty Question


adamjblakey

Recommended Posts

Hi,

 

The code below i have used in a none smarty site which is used to display categories and subcategories which works fine but now i want to use it in a smarty template site but am unsure how to assign these correctly and how to display them.

 

<?php
$strippagename = str_replace("-", " ",$_GET['title']);
         $sql = "SELECT category, GROUP_CONCAT(DISTINCT '<a href=\"/recipessubcat/',REPLACE(category2,' ','-'),'.html\" class=\"subcategories\">',category2,'</a>' ORDER BY category2 SEPARATOR ', ') as subcats FROM recipes GROUP BY category" ;
            $res = mysql_query($sql) or die (mysql_error()."<p>$sql</p>");
            $k=0;
while (list($cat, $subs) = mysql_fetch_row($res))
{

   $cat_url = strtr($cat, "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ. ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz--");
$cat_url = ereg_replace('[^a-zA-Z0-9_-]', '', $cat_url);
    echo "<div style='float: left; padding:6px; width: 30%; '>
    <a href='recipescat/$cat_url.html' class='categories'><h1>$cat</h1></a>$subs</div>";

    $k++;
    if ($k % 3 == 0) echo "<br style='clear:both' />\n";

      }         
?>

 

Any help would be much appreciated.

Cheers,

Adam

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.