@Template symfony2 500 internal server error
Hello i have used this
http://www.lucas.courot.com/how-to-create-a-contact-form-using-symfony2.html
tutorial for a contact form and in my wamp machine i make everything work
okay. Now i uploaded the site to nginx server configured and the site is
working okay except the contact page. httt://intelmarketing.es when i try
to click to contact it gets the
Oops! An Error Occurred
The server returned a "500 Internal Server Error".
Something is broken. Please e-mail us at [email] and let us know what you
were doing when this error occurred. We will fix it as soon as possible.
Sorry for any inconvenience caused.
and i think is something with the @template path that i'm using it
here is the code that is working on wamp server but i don't know whats is
wrong when it goes online..
<?php
namespace Aleksandar\IntelMarketingBundle\Controller;
use Aleksandar\IntelMarketingBundle\Form\Type\ContactType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
class DefaultController extends Controller
{
/**
* @Route("/contact", _name="contact")
* @Template("AleksandarIntelMarketingBundle::contact.html.php")
*/
public function contactAction(Request $request)
{
$form = $this->createForm(new ContactType());
if ($request->isMethod('POST')) {
$form->bind($request);
if ($form->isValid()) {
$message = \Swift_Message::newInstance()
->setSubject($form->get('subject')->getData())
->setFrom($form->get('email')->getData())
->setTo('aleksandar@intelmarketing.es')
->setBody(
$this->renderView(
'AleksandarIntelMarketingBundle:Mail:contact.html.php',
array(
'ip' => $request->getClientIp(),
'name' => $form->get('name')->getData(),
'message' => $form->get('message')->getData()
)
)
);
$this->get('mailer')->send($message);
$request->getSession()->getFlashBag()->add('success', 'Your
email has been sent! Thanks!');
return
$this->redirect($this->generateUrl('aleksandar_intel_marketing_contactpage'));
}
}
return array(
'form' => $form->createView()
);
}
}
No comments:
Post a Comment