In the method selectMarks () in the backend Controller of thinkphp, the html code printed by printf is not displayed in the front-end body. who knows how to adjust the format? The following is the code: // The main cause is to determine whether the HTML coding code of printf starts to reach the front end. the front end is selectmarks.html, which is blank. I want to introduce a uniform webpage style at the front end: the style defined elsewhere in the bolck is consistent with the title header displayed
// Here is the html code
Backend pseudo code: selectMarks (){
Model
.
.
Printf (" ");
Printf (" ");
Foreach ($ list as $ key => $ value) {// Role 1 has two modules: the net login module.
// Net is displayed in the following example. login is displayed, and other modules are not displayed if login is not displayed.
$ Mid = $ value ['mid '];
$ Marks = $ value ['Mark'];
$ Ro = 1;
If ($ ro = 1 ){
// Role 1 only has two modules: net and login.
Foreach ($ arr as $ k =>$ v ){
If ($ mid = $ k ){
// Module net login user
Printf (" % S
\ N ", $ k, 'checked', $ k );
Foreach ($ v as $ key => $ value ){
Printf (" % S
\ N ", $ value ['Mark'], $ marks & $ value ['Mark']? 'Checked': '', $ value ['name']);
}
}
}
}
}
Printf (" ");
$ This-> display ();
}
//////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// ///////////////////////////
My front-end display page effect and view the webpage source code effect are as follows:
Page display:
View the webpage source code:
Reply to discussion (solution)
Don't paste it ...........................
Combine variables in the controller by using $ this-> assign ('str', $ str );
Output variables in the template. {$ Str}
Why must we set the style and display controls in the controller together? The assembled data stored in the controller can be cyclically stored in the template,
No. |
Name |
Status |
Remarks |
Operation |
|
{$ One. id} |
{$ One. name} |
Normal Disable |
{$ One. remark} |
SlidesData ListMove upMove downEditDelete |
The name = "result" is the variable you allocate in the controller (that is, the data you want to display)
I don't know what to do with the front-end. I will try the method on the third floor tomorrow. the style in the controller is not flexible and the learning is in progress.
The backend uses the json returned from the database and then returns it to the front end. the front end traverses the data through the foreach or volist label.
It is best not to put the controller on it. it is too inflexible.