Php website on page for design

I ended up creating a php website with 6 pages, and the page structure is the same for each of them, the only thing that changes is the content, that is, the same header, the same design and the same footer design, the only thing that changes, how I have already said, this is the content itself.

so I thought, instead of having many pages, I could only have one design page and change only the content, what do you recommend? and how to do this ?, and also not plan to install anything like Typo3, wordpress, joomla or anything else on my server, so I want something that I could do using php idk. thanks!

+1
source share
3 answers

The easiest solution is to create separate files.

  • header.php
  • footer.php
  • menu.php

In header.php put your code from the header

<?php ?> <HTML> <HEAD> </HEAD> <BODY> ... <? ?> 

The same goes for footer and menu files.

Then you can use it by turning them on.

Your index.php might look like this.

 <?php include("header.php"); include("menu.php"); ?> <h1> This is my content </h1> <?php include("footer.php"); ?> 

This is the easiest option that I think for those who do not want to spend using templates, CMS, etc. You can also create a function called a title that accepts the title $ title and change of your window. To you.

+3
source

Sounds like you want AJAX. Use prototype . You can make one page and then use a prototype to replace content (which may include a PHP page) based on user clicks.

0
source

Simple and simple solution:

create footer.php and header.php

and in header.php you might have something like this:

 <?php function top_header($title) { ?> <html> <head> <title> <?php echo $title ?> </title> </head> <body> <?php } ?> 

footer.php

 <?php function footer() { ?> </body> </html> <?php } ?> 

Your index.php might look like this:

 <?php include("header.php"); include("footer.php"); top_header("Title of the page"); ?> Hello World! <?php footer(); ?> 
0
source

All Articles