Changed to RegisterRoute, now menu not working.

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Cobby
Forum Members
Forum Members
Posts: 23
Joined: Sun Jun 17, 2007 5:15 am

Changed to RegisterRoute, now menu not working.

Post by Cobby »

Hi,

Developing my own module and haven't had much experience with the module API. When I first started off, I was using GET variables and finding their in value the DoAction function.

I have since changed to RegisterRoute to allow for pretty URLs. That all working fine, except one part; the CMS no longer recognises that I am on the categories page (part of my module) and instead defaults to home.

What do I have to set in order for it to know what page I am on?

Code: Select all

<?php

	function SetParameters(){

		$this->CreateParameter('catid', $_GET['catid']);
		$this->CreateParameter('prodid', $_GET['prodid']);
		
		$this->RegisterRoute('/store.php\/$/', array('action'=>'default'));
		
		$this->RegisterRoute('/store.php\/(?P<catid>[0-9]+)$/', array('action'=>'viewcat'));
	
		$this->RegisterRoute('/store.php\/(?P<catid>[0-9]+)\/(?P<prodid>[0-9]+)$/', array('action'=>'viewprod'));
		

	}

?>

Cheers,
Cobby
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Changed to RegisterRoute, now menu not working.

Post by calguy1000 »

The module api isn't very well documented in areas like this.

I'd suggest you look at the source of other modules that handle pretty urls in a better way.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “Developers Discussion”