Jump to content

PHP Includes


akforce

Recommended Posts

Hey I'm making a website, but i seem have some trouble,

 

I am using php on my menu bar to include the content in the content area,

 

but my problem is i want to include another DIV i have designed into another part of the page, but only for the home, the about page etc will not have this included, so my question is

 

How do i include multiple items on a page but only relative to that page:

 

Here is my current code:

 

This is on my config.php

<?php
function page($page){

$page = $_GET['page'];

switch ($page)
{
//  Main Menu
    case '':
    case 'home':
	include('modules/home.php');
	include('modules/test.php');
	break;
    case 'farms':
	include('modules/farms.php');
	break;
case 'forums':
	include('modules/forums.php');
	break;
case 'news':
	include('modules/news.php');
	break;
}}

 

this is how i have called it on the website:

 

Menu Bar:

        	<div class="links"><a href="index.php?page=home">Home</a></div>
            <div class="links"><a href="index.php?page=farms">Our Farms</a></div>

 

Include in content area:

               <?php page($page); ?>

 

i appreciate any help you can provide, thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/175827-php-includes/
Share on other sites

if you use include to many times you get a error that normal....

 

 

the php functions you can try are the following....

 

include()

include_once()

require()

require_once()

 

There also others like

file_get_contents()

 

 

More advance one

Curl

socket's

 

Link to comment
https://forums.phpfreaks.com/topic/175827-php-includes/#findComment-926516
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.