Jump to content


Photo

Hii i am new to php....


  • Please log in to reply
3 replies to this topic

Poll: how to load page through index.php something like index.php>the page (0 member(s) have cast votes)

how to load page through index.php something like index.php>the page

  1. a (0 votes [0.00%])

    Percentage of vote: 0.00%

  2. d (0 votes [0.00%])

    Percentage of vote: 0.00%

Vote Guests cannot vote

#1 truenitin

truenitin
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 04 July 2006 - 10:34 AM

i am new to new php i am trying to learn to load pages through index.php. Help me out...

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 July 2006 - 10:39 AM

Could you please provide more infomation as your question is a little vague.

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 04 July 2006 - 10:46 AM

you add a link to goto another page ok.

example

first make a page called test.php

<?
echo " hello  i love php ";

?>

in index.php add a link like
<?

echo "<a href='test.php'>go to test page please</a";

?>


or to make more complex and more relable use a template to all pages.


make page

test1.php
<?
echo " this is my test page";
?>

test2.php
<?
echo " this is another test page";
?>

test3.php
<?
echo " this is the 3rd test page";
?>

thats the pages done

now the header to include in index.php


header.php
<?

echo "<a href='test1.php'>go to test page please</a";
echo "<a href='test2.php'>go to test page please</a";
echo "<a href='test3.php'>go to test page please</a";
?>

now the headers done i need index.php to get the header to link to all pages.

header.php

<?

// include is a php statement to add an extenal page to a page.

include("header.php");

?>

thats it now you got 3 pages from header.php linked to index.php

now if you add the include("header.php"); to all the other pages you got a link template ok.

please note// all links need a > at the end can not post on forum ok.

good luck mate.

If you want to no how to pass data from one page to another please look up sessions ok.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 truenitin

truenitin
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 04 July 2006 - 01:19 PM

it is something like this

i want the index page as the main page

i want the header and footer to be included in all the pages.

now i have a login file mainlogin.php

the header has the main menu.

the main menu has member login which will call the mainlogin.php

now when i click on member login it should call mainlogin.php

i can add the link to it as /mainlogin.php

but i

i want the mainlogin to be read dynamically by doing something like this

index.php code.

<?php

$p = $_GET['page'];


if (strpos($p,"..")) {
    die("Bad page request");
}

if (!$p) $p = "index";
$content_file=$_SERVER["DOCUMENT_ROOT"]."/".$p.".php";
if (!file_exists($content_file)) {
    header("Location: {$_SERVER["PHP_SELF"]}");
    exit();
}

$title = ($p) ? "$p - My Site!" : "Main page - My Site!";
include("header.php");
include($content_file);
include("footer.php");
?>

how will this code read my mainlogin.php file when i click on member login.
i want the link dynamic in my menu.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users