php - Having includes with variables in two places at once -
I have a small place here. I am creating custom CMS for one of my websites.
The code below is for the main index page:
& Lt; Hour / & gt; & Lt; Br / & gt; & Lt; Div id = "content" & gt; & Lt ;? Php resonance $ content ['content']; ? & Gt; & Lt; / Div & gt; By & lt;? } Other {include ('/ include error / 404.php');}} (include '/ footer.php'); ? & Gt;
The file contains the code to resize the variable in / header.php, such as page title and meta content.
The problem is that when What do I do? You can not actually write code in this way. It's OK to start, but you will soon find out that it is difficult to maintain. In general it is to split it in few steps. Each of these contains the Once you have this code, you can divide the code even further. Instead of loading the page directly from index.php, include another file that defines a function like Then there is some more change and you realize that you are using the approach :) Databases are loading functions from your database, your model , smari templates view and those PHP files that put them together Controllers . is included ("include / header.php"); That is, where the situations are outside, it will not echo the varables, obviously, however, I can not include in the if condition otherwise, the home page, for which no URL variable is required, these conditions Will show up without
include / template / homepage.php < / Code>
include / template / page .php
included / template / 404.php
load_page ($ name)
and returns page details.
Comments
Post a Comment