Categories: Sorting & Displaying Content

Because Structure relies on exact URLs, the normal way of doing dynamic categories will not work. You can easily replicate this functionality by passing strings. Enable PHP in your template and set parsing to input, then use the following:

Category Links

Link to your categories in the following format: http://domain.com/path/to/page?category=3

In this, 3 is the number of the category you want to display. This can be created dynamically with EE tags.

Displaying The Category Content


		{exp:weblog:entries weblog="your-weblog" category="<?php echo $_GET['category']; ?>" dynamic="off"}
		{title}
		{/exp:weblog:entries}
		

NOTE: The above character entities need to be replaced with actual brackets, and are blocked by EE as a security measure

Converting To Clean URLs

In your htaccess file, place the following code at the end:


		RewriteRule ^path/to/page/([0-9]{4})$ /path/to/page?category=$1 [L]
		

This will make your category URL look like: /path/to/page/3

Note: This must appear after the rewrite rules:


		RewriteEngine On
		RewriteBase /