src/Controller/ContactController.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. /**
  6.  * @Route("/kontakt", name="contact_")
  7.  */
  8. class ContactController extends AbstractController
  9. {
  10.     /**
  11.      * @Route("/", name="index")
  12.      */
  13.     public function index()
  14.     {
  15.         /* Get meta from api */
  16.         $metaJson null;
  17.         try {
  18.             $metaJsonPath = @file_get_contents('https://api.ctc-rheda.de/api/singletons/get/contact?token=863f1ccdb97de3b924e07b600ce0f5');
  19.             if ($metaJsonPath !== false) {
  20.                 $metaJson json_decode($metaJsonPathtrue);
  21.             }
  22.         } catch (\Exception $e) {
  23.             error_log('API Error in ContactController: ' $e->getMessage());
  24.         }
  25.         
  26.         // Fallback if API is not available
  27.         if ($metaJson === null) {
  28.             $metaJson = [
  29.                 'title' => 'Kontakt',
  30.                 'description' => 'Kontakt zum Cor Tennisclub aufnehmen.',
  31.                 'keywords' => 'Tennis, Kontakt, CTC, Rheda'
  32.             ];
  33.         }
  34.         return $this->render('pages/footer/contact.html.twig', [
  35.             'page' => array(
  36.                 'title' => 'Kontakt',
  37.                 'description' => 'Kontakt zum Cor Tennisclub aufnehmen.',
  38.                 'meta' => $metaJson
  39.             )
  40.         ]);
  41.     }
  42. }