![]() |
How to disassemble html skills? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31) +--- Thread: How to disassemble html skills? (/showthread.php?tid=74228) |
How to disassemble html skills? - rfrkk - 08-29-2019 There are dozens of php html structures as follows... <body> <section></section> <nav></nav> <section></section> ... </body> Where <nav></nav> is the shared part. The menu content in nav also uses the php template syntax <?php xxxx ?> I put the content into nav.php and put it in view/common/nav.php Consult https://codeigniter4.github.io/userguide/outgoing/index.html I hope to insert the code from here. <body> <section></section> Insert code to come in here <section></section> ... </body> , and keep html integrity, What should be done best? RE: How to disassemble html skills? - ciadmin - 08-29-2019 One possibility is to use the View Parser (https://codeigniter4.github.io/userguide/outgoing/view_parser.html) Build your view as Code: <body> and then render the view with the nested content: Code: $parser = \Config\Services::parser(); This technique is used in the CodeIgniter website (CI4 version being published very soon). RE: How to disassemble html skills? - rfrkk - 08-30-2019 (08-29-2019, 09:19 PM)ciadmin Wrote: One possibility is to use the View Parser (https://codeigniter4.github.io/userguide/outgoing/view_parser.html) So great! |