Good evening. Faced a problem. I will try to illustrate with a piece of pseudo-code.

  • smarty-> debugging = true;
  • smarty-> caching = FALSE;
  • Updating the page on AJAX

    $ request_to_wiki ["answer3"] = "answer"; // the database already has "answer1" and answer2 "$ record_in_base = $ request_to_wiki [" answer3 "]; $ request_to_wiki [" request_to_base "] = array // request to the database in order // to get all the data, // including just recorded (one of the fields is generated by mysql itself) ("answer1"
    "Answer2" "Answer3");

    I pass to the smarty $ template request_to_wiki ["request_to_baze"] are displayed only

    "answer1"
    "answer2".

Moreover, if you make var_dump ($ request_to_vikipedii ["request_to_base"]) there are all the answers. Because you can see that the entire array is transferred, except for the last value. If you repeat the iteration and get the "answer4" , then Smarti will show

"ответ1" "ответ2" "ответ3" 

What could be the problem? Thank you in advance

  • If you have an array in the script and you pass it through $ smarty-> assign ('wikipedia_query', $ request_to_vikipedia ["request_to_base"]), then there should be no problem with using this array in smarty through the $ wikipedia_query variable. - alexkad
  • Yes, I convey exactly as you said. But the problem, alas, is. In the body of the script, var_damp shows that $ request_to_vikipedia ["request_to_base"] ("answer1", "answer2"). And the Smarti debug page shows that $ request_to_vikipedia ["request_to_base"] ("answer1"). Those. the mapping is "lagging behind" by one request. Can this be some kind of caching on the server side? - Alexey

1 answer 1

The fool himself, was a logical error in the code. I had to take the last element of the array $ request_to_vikipedii ["request_to_baze"] and I took advantage of array_pop , without carefully reading in the description of the function that it extracts and returns the last element of the array.