Locating specific content inside a category

Hi,

I am using a template system for a website which uses 1 .tpl.php file as the main design. - Rather than create several files I want to use code within the 1 file to determine which page loads what content.

I currently am using a simple line to load the content for a Category:

<?php if ($category_id == 2) { ?>CONTENT HERE<?php } ?>

This works for the index of that category (/cat-name-2/) but it does not work for sub pages (/cat-name-2/sub-page-1.htm)

Does anyone know of a way to set the category and to load all the subpages within that category?

Any help is always appreciated :slight_smile:

Thank you,

Paul

The categories and sub categories are created in a backend admin and stored in MySQL.

To pull the category I use this line:

<?php $category_id = isset($_GET['category_id']) && is_numeric($_GET['category_id']) ? (int) $_GET['category_id'] : 0; ?>

I was hoping there would be some code that will allow the category and all pages within the category to display the specific content.

It does? How?

but it does not work for sub pages (/cat-name-2/sub-page-1.htm)

Does anyone know of a way to set the category and to load all the subpages within that category?

Any help is always appreciated :slight_smile:

Thank you,

Paul

Where do you get the subcategories from? A database?