Get Journals by Categories

Dear All,

I am trying to get/display Journals by Categories.

I believe we can add Jounal Category on Setup 1.1 but i cannot find samples or instructions on how to display journals by categories on the homepage.

Cheers!

Enabling and creating categories in the Site Admin creates a new menu bar item “Categories” and enables the the categorization of Journals in Journal Setup 1.1.

I believe the Categories page off of the menu bar only lists the Categories and the number of categorized journals. It sounds like you are wanting to mash-up the display of the Categories page and the homepage. One challenge will be that journals can be members of multiple categories.

See:

and

vs.

and

@ctgraham

Thanks!

I got it with this code. This displays all the journals under category id 328

	$categoryId = 328;

	$this->validate();
	$this->setupTemplate($request, true, 'categoryList');

	$site =& $request->getSite();
	$journal =& $request->getJournal();

	$categoryDao =& DAORegistry::getDAO('CategoryDAO');
	$cache =& $categoryDao->getCache();

	if ($journal || !$site->getSetting('categoriesEnabled') || !$cache || !isset($cache[$categoryId])) {
		$request->redirect('index');
	}

	$journals =& $cache[$categoryId]['journals'];
1 Like