How to Add Dynamic Header and Footer |
(03-02-2018, 03:35 PM)wallacesilva09 Wrote: I solved this problem with MY_Controller.php in folder app/core/ I created a method/action with this: I believe that it is necessary to explain something before showing the method I use. I started with CI2 and had close to zero knowledge of PHP. Then version 3.0 emerged, and I found myself at a crossroads: either I dived deep into learning CI or PHP, but it soon became clear that only the last option, PHP would be adequate. CodeIgniter is a powerful productivity tool, without a doubt, the better I understand it, the higher my productivity will be, but there is a limit. With each new version, some things stop being used and new ones appear. Most importantly, it is a tool designed with PHP in mind, not the other way around. My knowledge of PHP remains close to zero, but it is my priority and where should I find solutions to problems, regardless of the framework used or even without any. I say this because I see that when faced with a problem whose solution is up to PHP, the solution is sought in the framework, CI. New version .... New framework ... Wildlife, without framework ... The solution I use (on the home page): Controller: PHP Code: $header = array ( sometimes it´s very, very complex: PHP Code: foreach ($this->album_model->get_name() as $row); And, of course, a single header meets every need. PHP Code: <head> I have a blog, the placeholder will be ... Search the blog; A specific area to search for backups, the placeholder will be .. Search backups No matter which framework or its version, it is a solution, I can say, definitive. It is important to consider that anyone who knows PHP will be able to analyze and, if applicable, make changes. Meets documentation requirements for systems and procedures. OK, I'm not a professional, but nothing stops me from trying to think like one.
Why do not you use ajax to load the content? Insert this script inside the head tags and the file should load.
<script> $(function(){ $.ajax({ type: "GET", url: "header/footer/header.html", dataType: "html", success: function(answer) { $("body").append(answer); }, error: function(){ alert("failed call!!!"); } }); return false; }); </script> Omegle Bazoocam Chatrandom
(03-02-2018, 10:56 AM)superbrands Wrote: Here is my code: mini militia I think you should need to change some basic Home.php codes to solve this issue. |
Welcome Guest, Not a member yet? Register Sign In |