module url question

Developer Networks
Developer Networks
@developer-networks
10 years ago
566 posts
I am creating a module and my urls to the module are not reachable.

It lands me on a 404 error.

myModuleTest/templates/mypage.tpl

where myModuleTest url = moduletest

so if i type in

www.mysite.com/moduletest/mypage

I get a 404 error.


I am able to reach the pages by typing in the long address but how do I get the routing system to work with my module?

Do I need a magic view for each one?


updated by @developer-networks: 04/19/14 09:19:57PM
paul
@paul
10 years ago
4,326 posts
I don't think you can run module templates directly.
You can call module 'views' to do the job, which is preferable as templates usually need some smarty parameters to work with.

http://mysite.com/moduletest/mypage will take you to the function (in the module's index.php) view_myModuleTest_mypage()

So then, in that function -
function view_myModuleTest_mypage($_post, $_user, $_conf)
{ $_tmp = array(); // Do whatever needs to be done to build the template smarty parameters into the $_tmp array // parse the template return jrCore_parse_template("mypage.tpl", $_tmp, 'myModuleTest'); }

hth
Pa


--
Paul Asher - JR Developer and System Import Specialist
Developer Networks
Developer Networks
@developer-networks
10 years ago
566 posts
Thank you

Tags