Jump to content

Own controller doesn't work


Geppert_Dev
 Share

Recommended Posts

Hi. I have such a problem. I did all in right way (in my last module it worked, because I took a pattern from it).

Firstly in main file of my module (here I name it myexamplemodule) myexamplemodule.php I have this line:

$this->context->link->getModuleLink('myexamplemodule', 'new');

And the link created is:

http://url-to-my-presta/index.php?fc=module&module=myexamplemodule&controller=new&id_lang=1

And then in module's root folder named also myexamplemodule I have:

controllers > front > new.php

and that file contains:

<?php
class MyExampleModuleNewModuleFrontController extends ModuleFrontController{
	
	public function initContent()
	{
		parent::initContent();
		
		$this->setTemplate('myexamplecontent.tpl');
	}
	
}

Then the next folder in module's root:

views > templates > front > myexamplecontent.tpl

And that file contains:

<p>My example content.</p>

That's all I have done. When I enter the link created above it shows the blank white page... This is the same structure as I did in my last coded module but here it doesn't work and I don't know why... Some ideas?

Share this post


Link to post
Share on other sites

If you are getting white page then enable debug mode and see what errors come up.

So check https://www.prestashop.com/forums/topic/224525-how-to-turn-on-error-reporting-for-debug-information-blank-page-500-internal-server-error/ .

 

Also think your controller could be named MyexamplemoduleNewModuleFrontController but not sure 

if that is causing error.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More