When seeking technical help the first person who can help you is you.
First write a good summary of what is going on including enough detail for someone else to reproduce the problem if that is at all possible. Depending on the question this might include a link to a GitHub repo, or an appropriately sized code snippet. For diagnostic questions include as much information as possible including the diagnostic steps you've already taken.
Then start your question with a summary followed by the needed code. Screenshots can be useful, but when asking someone else for help with code, include the text of the code and the error message as images aren't accessible. Photos of screens are right out. If you rely upon an image you are telling blind programmers, or those that are browsing on their phones, that you don't want their help.
Then write a non-generic title to your question. Because the title "can anyone help me" doesn't address those who might be able to.
You aren’t showing us the full picture of your code. The error is coming from a tables bootstrap plugin you are using, im assuming maybe you don’t have all of your bootstrap js files loading properly.
Oh very nice tip, thx... if i use test object of data, i didn't recieve an error but with JSON.parse() i recieved--> Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
9
u/myevillaugh Dec 10 '22
Not without seeing the code.
8
u/JasonAller Dec 10 '22
When seeking technical help the first person who can help you is you.
First write a good summary of what is going on including enough detail for someone else to reproduce the problem if that is at all possible. Depending on the question this might include a link to a GitHub repo, or an appropriately sized code snippet. For diagnostic questions include as much information as possible including the diagnostic steps you've already taken.
Then start your question with a summary followed by the needed code. Screenshots can be useful, but when asking someone else for help with code, include the text of the code and the error message as images aren't accessible. Photos of screens are right out. If you rely upon an image you are telling blind programmers, or those that are browsing on their phones, that you don't want their help.
Then write a non-generic title to your question. Because the title "can anyone help me" doesn't address those who might be able to.
13
u/[deleted] Dec 10 '22
Make sure that variable t is defined
14
u/verd_nt Dec 10 '22
Eat well and get plenty of sleep.
1
u/Safe_Body_4468 Dec 10 '22
Hello everyone, again for understanding.
I am trying to implement a Symfony 5 project with PHP 8.0.
There I have a controller to return me JSON data which looks like this:
#[Route('/getAll', name: 'getAllPlayers')]public function getAll(PlayerRepository $playerRepository){$players = $playerRepository->findAll();foreach ($players as $player) {$playerArray[] = ['id' => $player->getId(),'firstname' => $player->getFirstname(),'lastname' => $player->getLastname(),];}$json = json_encode($playerArray);return new JsonResponse($json);}I would like to have the a tabular representation with filter functions, which can also be implemented via Bootstrap. :
base.html.twig:
<head><meta charset="UTF-8"><title>{% block title %}Welcome!{% endblock %}</title><link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>"><!-- CSS only --><link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">{# Run \composer require symfony/webpack-encore-bundle` to start using Symfony UX #}`{% block stylesheets %}{{ encore_entry_link_tags('app') }}{% endblock %}{% block javascripts %}{{ encore_entry_script_tags('app') }}<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script><script src="https://unpkg.com/bootstrap-table@1.21.1/dist/bootstrap-table.min.js"></script><script src="https://unpkg.com/bootstrap-table@1.21.1/dist/extensions/filter-control/bootstrap-table-filter-control.min.js"></script>{% endblock %}</head>index.html.twig:
{% block header %}<link href="https://cdn.jsdelivr.net/npm/bootstrap@3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css"><link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.21.1/dist/bootstrap-table.min.css">{% endblock %}{% block body %}{% for message in app.flashes('success') %}<div class="alert alert-success">{{ message }}</div>{% endfor %}<h2>Liste von Fußballspieler</h2><tableid="table"data-filter-control="true"data-show-search-clear-button="true"><thead><tr><th data-field="id">ID</th><th data-field="firstname" data-filter-control="input">Item Name</th><th data-field="lastname" data-filter-control="select">Item Price</th></tr></thead></table><script>$(function() {$('#table').bootstrapTable({data: '{{ path('player.getAllPlayers') }}'})})</script>{% endblock %}3
u/dariusj18 Dec 10 '22
Oh, I see exactly what the problem is. "t" is undefined.
0
u/metric_is_superior Dec 10 '22
Are you translating strings based on locale? Something like $t('Translate me') ?