1 Vote Vote

how to loop subcategories with their categories?

Posted by topdog 409 days ago Questions| file page template All

EDIT: ok let me be a bit more clear i have a html file name file.html it is like this:

{category} {sybcategory}

and i have a index file which is like this:

class template { var $page;

function add_file($file){
    $this->page = file_get_contents($file);
    return $this->page;
}

function vars($array)
{
    foreach($array as $key => $value)
    {
        $this->page = str_replace('{'.$key.'}', $value, $this->page);
    }
    echo $this->page;
}

}

$template = new template();

$template->add_file('file.html');

$template->file_vars(array('category' => $row_cat['title'], 'subcategory' => $row_subcat['title']));

now, this only outputs the title and the subcategory only once how do i loop that and i have not added the mysql query here because i don't wanna waste your more time please if you know how to do it then let me know.

Originally asked by: Keshav Nair on Stack Overflow

Discuss Bury


Who Voted for this Question