src/Controller/WebsiteController.php line 130

  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Component\HttpFoundation\Request;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. class WebsiteController extends BaseController
  7. {
  8.     #[Route('/'name'home')]
  9.     public function index(Request $request)
  10.     {
  11.         $res $this->render('website/index.html.twig');
  12.         return $this->eTagRes($res$request1);
  13.     }
  14.     public function navbar()
  15.     {
  16.         $sub1 = [
  17.             'sub1' => array('name' => "About Us 1"'twig' => 'website/about.html.twig'),
  18.             'sub2' => array('name' => "Contact 2"'twig' => 'website/contact.html.twig'),
  19.             'sub3' => array('name' => "Products 3"'twig' => 'website/products.html.twig'),
  20.         ];
  21.         $nav = [
  22.             'about' => array('name' => "About Us"'twig' => 'website/about.html.twig'),
  23.             'contact' => array('name' => "Contact Us"'twig' => 'website/contact.html.twig'),
  24.             'products' => array('name' => "Products"'twig' => 'website/products.html.twig'),
  25.             'consumer-education' => array('name' => "Consumer Education"'twig' => 'website/consumer-education.html.twig'),
  26.             'testimonials' => array('name' => "Testimonials"'twig' => 'website/testimonials.html.twig'),
  27.             'more' => array('name' => "More"'sub' => true'sub' => $sub1),
  28.             'portfolio' => array('twig' => 'website/portfolio.html.twig'),
  29.             'contact-us' => array('twig' => 'website/contact-us.html.twig'),
  30.         ];
  31.     }
  32.     #[Route('/{page}.html'name'page')]
  33.     public function page(Request $request)
  34.     {
  35.         $page $request->get('page');
  36.         $pageMap = [
  37.             'about' => 'website/about.html.twig',
  38.             'portfolio' => 'website/portfolio.html.twig',
  39.             'testimonials' => 'website/testimonials.html.twig',
  40.             'consumer-education' => 'website/consumer-education.html.twig',
  41.             'products' => 'website/products.html.twig',
  42.             'contact-us' => 'website/contact-us.html.twig',
  43.             'term-conditions' => 'website/toc.html.twig',
  44.             'privacy' => 'website/pp.html.twig',
  45.             'refund' => 'website/refund.html.twig',
  46.         ];
  47.         if (isset($pageMap[$page])) {
  48.             $res $this->render($pageMap[$page], ['page' => $page]);
  49.             return $this->eTagRes($res$request1);
  50.         } else {
  51.             return $this->render('website/404.html.twig');
  52.         }
  53.     }
  54.     #[Route('/minify/css'name'minify_css')]
  55.     public function minifyCss(Request $request)
  56.     {
  57.         $basePath '../public/';
  58.         if ($request->get('filePath')) {
  59.             $filePath $request->get('filePath');
  60.             $style file_get_contents($basePath $filePath);
  61.         }
  62.         $minified $style;
  63.         $minified str_replace("\n"""$minified);
  64.         $minified str_replace("  "" "$minified);
  65.         $minified str_replace("  "" "$minified);
  66.         $minified str_replace(" {""{"$minified);
  67.         $minified str_replace("{ ""{"$minified);
  68.         $minified str_replace(" }""}"$minified);
  69.         $minified str_replace("} ""}"$minified);
  70.         $minified str_replace(", "","$minified);
  71.         $minified str_replace("; "";"$minified);
  72.         $minified str_replace(": "":"$minified);
  73.         // Write it
  74.         // header("Content-type: text/css; charset: UTF-8");
  75.         // echo $minified;
  76.         $res = new Response($minified200, ['Content-Type' => 'text/css']);
  77.         return $this->eTagRes($res$request);
  78.     }
  79.     #[Route('/avif'name'avif')]
  80.     public function avif(Request $request)
  81.     {
  82.         $basePath '../public/';
  83.         if ($request->get('imgPath')) {
  84.             $filePath $request->get('imgPath');
  85.         } else {
  86.             return null;
  87.         }
  88.         ob_start();
  89.         $im imagecreatefromstring(file_get_contents($basePath $filePath));
  90.         //imagewebp($im,null,50,10);
  91.         imagewebp($im);
  92.         $content ob_get_contents();
  93.         ob_end_clean();
  94.         $res = new Response($content200, ['Content-Type' => 'image/avif']);
  95.         return $res;
  96.     }
  97.     #[Route('/webp'name'webp')]
  98.     public function webp(Request $request)
  99.     {
  100.         $basePath '../public/';
  101.         if ($request->get('imgPath')) {
  102.             $filePath $request->get('imgPath');
  103.         } else {
  104.             return null;
  105.         }
  106.         ob_start();
  107.         $im imagecreatefromstring(file_get_contents($basePath $filePath));
  108.         imagewebp($imnull80);
  109.         $content ob_get_contents();
  110.         ob_end_clean();
  111.         $res = new Response($content200, ['Content-Type' => 'image/webp']);
  112.         return $this->eTagRes($res$requesttrue);
  113.     }
  114.     #[Route('/product/{slug}.html'name'pro_single')]
  115.     public function productSingle(Request $request)
  116.     {
  117.         $slug $request->get('slug');
  118.         $products = [
  119.             'ordinary-gear-makhi' => [
  120.                 'name' => 'Ordinary Gear Makhi',
  121.                 'short_description' => 'We bring forth quality Ordinary Gear Makhi, which is verified on various parameters such as hardness, structure, shape, size, raw materials, and many more. We offer Ordinary Gear Makhi at affordable price.',
  122.                 'description' => '<div><p>We bring forth quality&nbsp;<strong>Ordinary Gear Makhi</strong>, which is verified on various parameters such as hardness, structure, shape, size, raw materials, and many more. We offer Ordinary Gear Makhi at affordable price.<br><br><strong>Used In</strong></p>
  123.                     <ul>
  124.                     <li>Two wheeler and Three Wheeler behind the Clutch Wire</li>
  125.                     </ul>
  126.                     <p><br><strong>Function</strong></p>
  127.                     <ul>
  128.                     <li>Its main functioning is to control the break of the two or three wheeler without its function we cant us the break functioning for stopping our vehicle</li>
  129.                     </ul></div>',
  130.                 'image' => 'ordinary_gear_makhi.jpg',
  131.             ],
  132.             'special-gear-makhi' => [
  133.                 'name' => 'Special Gear Makhi',
  134.                 'short_description' => 'We offer Special Gear Makhi that is made from optimum quality materials that ensure high durability. Special Gear Makhi can availed from us in customized forms as per specifications required by the customers',
  135.                 'description' => '<div><p>We offer&nbsp;<strong>Special Gear Makhi</strong>&nbsp;that is made from optimum quality materials that ensure high durability. Special Gear Makhi can availed from us in customized forms as per specifications required by the customers<br><strong>Used In</strong></p>
  136. <ul>
  137. <li>Two wheeler and Three Wheeler behind the Clutch Wire</li>
  138. </ul>
  139. <p><strong>Function</strong></p>
  140. <ul>
  141. <li>Its main functioning is to control the break of the two or three wheeler without its function we cant us the break functioning for stopping our vehicl.</li>
  142. </ul>
  143.             </div>',
  144.                 'image' => 'special_gear.jpg',
  145.             ],
  146.             'ape-gear-makhi' => [
  147.                 'name' => 'Ape Gear Makhi',
  148.                 'short_description' => 'We provide the clients with Ape Gear Makhi, which is manufactured in compliance with set industrial standards. This Ape Gear Makhi can be availed at reasonable price.',
  149.                 'description' => '<div><p>We provide the clients with&nbsp;<strong>Ape Gear Makhi</strong>, which is manufactured in compliance with set industrial standards. This Ape Gear Makhi can be availed at reasonable price.<br><br><strong>Used In</strong></p>
  150. <ul>
  151. <li>Two wheeler and Three Wheeler behind the Clutch Wire</li>
  152. </ul>
  153. <p><br><strong>Function</strong></p>
  154. <ul>
  155. <li>Its main functioning is to control the break of the two or three wheeler without its function we cant us the break functioning for stopping our vehicle.</li>
  156. </ul>
  157.             </div>',
  158.                 'image' => 'ape_gear_makhi.jpg',
  159.             ],
  160.             'tvs-gear-makhi' => [
  161.                 'name' => 'TVS Gear Makhi',
  162.                 'short_description' => 'We provide the clients with TVS/CNG Gear Makhi, which is manufactured in compliance with set industrial standards. This TVS/CNG Gear Makhi can be availed at a reasonable price.',
  163.                 'description' => '<div><p>We provide the clients with&nbsp;<strong>Ape Gear Makhi</strong>, which is manufactured in compliance with set industrial standards. This Ape Gear Makhi can be availed at reasonable price.<br><br><strong>Used In</strong></p>
  164. <ul>
  165. <li>Two wheeler and Three Wheeler behind the Clutch Wire</li>
  166. </ul>
  167. <p><br><strong>Function</strong></p>
  168. <ul>
  169. <li>Its main functioning is to control the break of the two or three wheeler without its function we cant us the break functioning for stopping our vehicle.</li>
  170. </ul>
  171.             </div>',
  172.                 'image' => 'cng.png',
  173.             ],
  174.             'accelator-adjuster' => [
  175.                 'name' => 'Accelator Adjuster',
  176.                 'short_description' => 'We bring forth quality Accelerator/Clutch Adjuster (Makhi), which is verified on various parameters such as hardness, structure, shape, size, raw materials, and many more. We offer Accelerator/Clutch Adjuster (Makhi)i at affordable price.',
  177.                 'description' => '<div><p>We bring forth quality&nbsp;Accelerator/Clutch Adjuster (Makhi), which is verified on various parameters such as hardness, structure, shape, size, raw materials, and many more. We offer Ordinary Gear Makhi at affordable price.<br><br><span>Used In</span></p>
  178. <ul>
  179. <li>Two wheeler and Three Wheeler behind the Clutch Wire</li>
  180. </ul>
  181. <p><br><span>Function</span></p>
  182. <ul>
  183. <li>Its main functioning is to control the break of the two or three wheeler without its function we cant us the break functioning for stopping our vehicle</li>
  184. </ul>
  185.             </div>',
  186.                 'image' => 'm2.jpg',
  187.             ],
  188.             'brake-rods'=>[
  189.                 'name'=>'Brake Rods',
  190.                 'short_description' => 'Brake Rods',
  191.                 'description' =>"<div><p><span>Spare Parts Available for Following Models: all Hero Honda Models all Honda Models (indian Models) all Bajaj Models all Tvs Models all Suzuki Models (indian Models) all Lml Models. spare Parts for Following Motor Cycle Models hero Honda:- cd-100, Cd-100-ss, Cd-deluxe, Cd-dawn, Achiever, Joy, Splendor, Super Splendor, Splendor+, Splendor Nxg, Splendor – Y2k, Cbz, Cbz –xtreme, Passion, Passion +, Karizma, Glamour, Glamour Pgm Fi, Hunk, Sleek, Ambition, Ambition -135. bajaj:- kb-100, Kb-4s, Boxer, Boxer-at, Boxer-ct, Boxer-ar, Caliber, Caliber-115, Ct-100, Ct-100 Dlx, Pulsar 150/180, Pulsar 150/180/200/220 Dtsi, Discover 110/112, Discover 125/135 Dtsi, Byk, Wind 125, Xcd 125 Dtsi, Platina, Platina 125 Dtsi, Eliminator, Avenger Dtsi 200. tvs:- victor, Victor Gl110, Victor Gx 110, Victor Glx 125, Star, Star City, Star Sports, Centra, Apache 150, Fiero, Fiero F-2, Flame 125. suzuki:- ax-100, Max-100, Shogun, Samurai, Heat, Zeus yamaha:- rx-100, Rxg, Rxz, Crux, Ybx, Enticer, Libero, Fazer honda:-unicorn, Shine lml:- Freedom following Parts Available: air Filter, Axle Nuts &amp; Axles with Nut Front &amp; Rear, Brake Rod Assy. Brake Pedal, Brake Pedal Rubber, Brake Shoe Set Front &amp; Rear, Brake Cams Front &amp; Rear, Chain Adjuster, C.d.i. Unit, Charging Coil, Clutch Plate Set, Clutch Hub, Connecting Rod, Control Cables, Chain Lock, Cylinders, Drum Rubber, Flashers/relay, Front Fork Boots, Front Fork Oil Seals, Foot Rest Front &amp; Rear, Fuel Cock, Fender (mudguard) F &amp; R, Foundation Axle, Gear Shaft Assy, Gear Change Lever, Gasket, Handle Bar, Handle Bar Switch L.h &amp; R.h, Handle Cone Set, Half Axle (axle Sleeve), Handle Lever L.h &amp; R.h, Handle Lever Holder (yoke) L.h &amp; R.h, Head Light Assy, H. L. Doom (cowl), H. L. Mask (visor), Hub F &amp; R, Ignition Coil, H. L. Holder, Ignition Switch, Kick Axle Shaft, Kick Pedal, Kick Boss, Kick Pedal Rubber, Light Coil, Main Stands, Main Stands Pin, Magnet Wires, Piston &amp; Piston Rings, Rear View Mirror, Petrol Tank Lid, Oil Seals, Oil Filter, Pick-up-coil, Plug Cap, Regulator Rectifier, Electronic Rectifiers, Side Panel, Speedometer Assy., Speedometer Worm Set, Signal Light, Sprocket Front &amp; Rear, Sprocket Lock Kit Front &amp; Rear, Sprocket &amp; Chain Set, Spokes, Side Stands, Valves in &amp; Exh, Tail Light. Wheel Rim, Wiring Harness.</span></p>
  192.             </div>",
  193.             'image' => 'brack-rod-full.jpg'
  194.             ],
  195.             'brake-rods-nut-pin'=>[
  196.                 'name'=>'Brake Rods (Nut & Pin)',
  197.                 'short_description' => 'Brake Rods (Nut & Pin)',
  198.                 'description' => 'Brake Rods (Nut & Pin)',
  199.                 'image' => 'brack-rod-parts.jpg'
  200.             ],
  201.             'brake-rods-nut'=>[
  202.                 'name'=>'Brake Rods (Nut)',
  203.                 'short_description' => 'Brake Rods (Nut)',
  204.                 'description' => 'Brake Rods (Nut)',
  205.                 'image' => 'brack-rod.jpg'
  206.             ],
  207.             'cable-adjuster'=>[
  208.                 'name'=>'Cable Adjuster',
  209.                 'short_description' => 'Cable Adjusters, Universal all Vehicles, 5 mm (8 number), 6 mm (10 number), 7 mm (11 number), and 8 mm (13 number)',
  210.                 'description' => '<div><p><span><span>Cable Adjusters,&nbsp;<span>Universal all Vehicles,</span>&nbsp;</span>5 mm (8 number), 6 mm (10 number), 7 mm (11 number), and 8 mm (13 number)</span></p>
  211.             </div>',
  212.                 'image' => 'cable-ad.jpg'
  213.             ],
  214.             'fli-kal-makhi'=>[
  215.                 'name'=>'FLI KAL and Kerala (Makhi)',
  216.                 'short_description' => 'FLI KAL and Kerala (Makhi), Used for Tightening Gear Wire, Mild Steel for FLI, KAL and Kerala Three Wheelers',
  217.                 'description' => '<div><p>FLI KAL and Kerala (Makhi), Used for Tightening Gear Wire, Mild Steel for FLI, KAL and Kerala Three Wheelers</p></div>',
  218.                 'image' => 'FLI-makhi.jpg'
  219.             ]
  220.         ];
  221.         if (isset($products[$slug])) {
  222.             $res $this->render('website/product-single.html.twig', ['product' => $products[$slug]]);
  223.             return $this->eTagRes($res$request1);
  224.         } else {
  225.             return $this->render('website/404.html.twig');
  226.         }
  227.     }
  228. }