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?

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.