meerdre pagina`s in php scripje

Status
Niet open voor verdere reacties.

xvilo

Gebruiker
Lid geworden
14 dec 2008
Berichten
492
hoi,
weet ieamd misschien een sript waar mee je
bijvoorbeeld ????.php?=game:....
en altijd met de zelfde layout:
************************************************************************************
ik hoop dat iemand iets voor mij weet
al vast heel erg bedankt
 
Laatst bewerkt:
Waar de content moet komen te staan:

PHP:
<?php
if(isset($_GET['p'])) {
switch(strtolower($_GET['p'])) {
case 'pagina_naam':
include("pagina_naam.php");
break;
case 'pagina_naam2':
echo "Hallo";
break;
}
} else {
echo 'Er wordt geen gebruik gemaakt van ?p=';
}
?>

Pagina's kunnen opgeroepen worden op deze manier: index.php?p=pagina_naam

Succes!
 
Waar de content moet komen te staan:

PHP:
<?php
if(isset($_GET['p'])) {
switch(strtolower($_GET['p'])) {
case 'pagina_naam':
include("pagina_naam.php");
break;
case 'pagina_naam2':
echo "Hallo";
break;
}
} else {
echo 'Er wordt geen gebruik gemaakt van ?p=';
}
?>

Pagina's kunnen opgeroepen worden op deze manier: index.php?p=pagina_naam

Succes!

sorry maar ik snap er geen snars van
poging:
word dit dan de niuew code:
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
<style type="text/css"> 
<!-- 
body  {
    font: 100% Verdana, Arial, Helvetica, sans-serif;
    background: #666666;
    margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
    padding: 0;
    text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
    color: #000000;
    background-image: url(bg.jpg);
    background-color: #18191D;
    background-repeat: no-repeat;
}
 
/* Tips for Elastic layouts 
1. Since the elastic layouts overall sizing is based on the user's default fonts size, they are more unpredictable. Used correctly, they are also more accessible for those that need larger fonts size since the line length remains proportionate.
2. Sizing of divs in this layout are based on the 100% font size in the body element. If you decrease the text size overall by using a font-size: 80% on the body element or the #container, remember that the entire layout will downsize proportionately. You may want to increase the widths of the various divs to compensate for this.
3. If font sizing is changed in differing amounts on each div instead of on the overall design (ie: #sidebar1 is given a 70% font size and #mainContent is given an 85% font size), this will proportionately change each of the divs overall size. You may want to adjust these divs based on your final font sizing.
*/
.twoColElsLt #container { 
    width: 46em;  /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */
    background:;
    margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
    border: 1px solid #000000;
    text-align: left; /* this overrides the text-align: center on the body element. */
} 
 
/* Tips for sidebar1:
1. Be aware that if you set a font-size value on this div, the overall width of the div will be adjusted accordingly.
2. Since we are working in ems, it's best not to use padding on the sidebar itself. It will be added to the width for standards compliant browsers creating an unknown actual width. 
3. Space between the side of the div and the elements within it can be created by placing a left and right margin on those elements as seen in the ".twoColElsLt #sidebar1 p" rule.
*/
.twoColElsLt #sidebar1 {
    float: left; 
    width: 12em; /* since this element is floated, a width must be given */
    background: #f00; /* the background color will be displayed for the length of the content in the column, but no further */
    padding: 15px 0; /* top and bottom padding create visual space within this div */
}
.twoColElsLt #sidebar1 h3, .twoColElsLt #sidebar1 p {
    margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */
    margin-right: 10px;
}
 
/* Tips for mainContent:
1. If you give this #mainContent div a font-size value different than the #sidebar1 div, the margins of the #mainContent div will be based on its font-size and the width of the #sidebar1 div will be based on its font-size. You may wish to adjust the values of these divs.
2. The space between the mainContent and sidebar1 is created with the left margin on the mainContent div.  No matter how much content the sidebar1 div contains, the column space will remain. You can remove this left margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends.
3. To avoid float drop, you may need to test to determine the approximate maximum image/element size since this layout is based on the user's font sizing combined with the values you set. However, if the user has their browser font size set lower than normal, less space will be available in the #mainContent div than you may see on testing.
4. In the Internet Explorer Conditional Comment below, the zoom property is used to give the mainContent "hasLayout." This avoids several IE-specific bugs that may occur.
*/
.twoColElsLt #mainContent {
    margin: 0 1.5em 0 13em; /* the right margin can be given in ems or pixels. It creates the space down the right side of the page. */
} 
 
/* Miscellaneous classes for reuse */
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
    float: right;
    margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
    float: left;
    margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
    clear:both;
    height:0;
    font-size: 1px;
    line-height: 0px;
}
a:link {
    color: #000;
    text-decoration: none;
}
a:visited {
    text-decoration: none;
    color: #000;
}
a:hover {
    text-decoration: none;
    color: #000;
}
a:active {
    text-decoration: none;
    color: #000;
}
--> 
</style><!--[if IE]>
<style type="text/css"> 
/* place css fixes for all versions of IE in this conditional comment */
.twoColElsLt #sidebar1 { padding-top: 30px; }
.twoColElsLt #mainContent { zoom: 1; padding-top: 15px; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]--></head>
<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="100">
  <param name="movie" value="flahs/hoofd.swf" />
  <param name="quality" value="high" />
  <param name="wmode" value="opaque" />
  <param name="swfversion" value="6.0.65.0" />
  <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
  <param name="expressinstall" value="Scripts/expressInstall.swf" />
  <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
  <!--[if !IE]>-->
  <object type="application/x-shockwave-flash" data="flash/hoofd.swf" width="800" height="100">
    <!--<![endif]-->
    <param name="quality" value="high" />
    <param name="wmode" value="opaque" />
    <param name="swfversion" value="6.0.65.0" />
    <param name="expressinstall" value="Scripts/expressInstall.swf" />
    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
    <div>
      <h4>Content on this page requires a newer version of Adobe Flash Player.
      je hebt adobe flash player nodig</h4>
      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
    </div>
    <!--[if !IE]>-->
  </object>
  <!--<![endif]-->
</object>
<body class="twoColElsLt">
 
<div id="container">
  <div id="sidebar1">
    <h3>menu. </h3>
    <p><a href="index.php">home</a></p>
    <p><a href="media-bar.html">video</a>    </p>
    <p><a href="media-bar.html">media-bar</a></p>
    <p>games
  <!-- end #sidebar1 -->
    </p>
    <p>google:</p><div id="cse" style="width: 100%;">Loading</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
   google.load('search', '1');
   google.setOnLoadCallback(function(){
      new google.search.CustomSearchControl('004013244498531771271:ay98h2k1mvy').draw('cse');
   }, true);
</script>
  </div>
  <div id="mainContent">
    <h1>games</h1>
<?php
if(isset($_GET['p'])) {
switch(strtolower($_GET['p'])) {
case 'pagina_naam':
include("pagina_naam.php");
break;
case 'pagina_naam2':
echo "Hallo";
break;
}
} else {
echo 'Er wordt geen gebruik gemaakt van ?p=';
}
?>
    <p>&nbsp;</p>
  </div>
    <p>&nbsp;</p>
</div>
</body>
</html>
 
ik weet niet of het klopt maar je kunt dit:
PHP:
<?php
if(isset($_GET['p'])) {
switch(strtolower($_GET['p'])) {
case 'pagina_naam':
include("pagina_naam.php");
break;
case 'pagina_naam2':
echo "Hallo";
break;
}
} else {
echo 'Er wordt geen gebruik gemaakt van ?p=';
}
?>
veranderen in dit:
PHP:
<?php
if(isset($_GET['p'])) {
switch(strtolower($_GET['p'])) {
case 'pagina_naam':
include("pagina_naam.php");
break;
case 'pagina_naam2':
echo "Hallo";
break;
default:
echo 'Er wordt geen gebruik gemaakt van ?p=';
break;
}
?>
waarbij het gaat om de default
 
Laatst bewerkt:
Ik doe het meestal zo:
PHP:
<?php

$page = $_GET['page'];

if ( $page == 'home' ) {
echo "Welkom op de homepage";
//De link hier is dus:www.iets.nl/index.php?page=home
}

if ( $page == 'contact' ) {
echo "Welkom op de contact-pagina.";
//De link hier is dus:www.iets.nl/index.php?page=contact
}
 
overgens moet ik van dit
PHP:
<?php
 
$page = $_GET['page'];
 
if ( $page == 'home' ) {
echo "Welkom op de homepage";
//De link hier is dus:www.iets.nl/index.php?page=home
}
 
if ( $page == 'contact' ) {
echo "Welkom op de contact-pagina.";
//De link hier is dus:www.iets.nl/index.php?page=contact
}

dit maken
PHP:
					<?php
 
$page = $_GET['page'];
 
if ( $page == 'home' ) {
echo "";
//De link hier is dus:www.iets.nl/index.php?page=home
}
 
if ( $page == 'contact' ) {
echo "Welkom op de contact-pagina.";
//De link hier is dus:www.iets.nl/index.php?page=contact
}
?>
 
Dat is een stuk ineffectiever dan een switch, maar als je het persé wilt gebruiken, maak er dan tenminste elseif van alle if's (behalve de eerste).
 
Ik zou dit ook graag willen.
maar dan wel met verschillende layouts.
maar is deze code alles wat ik moet hebben?
PHP:
<?php
 
$page = $_GET['page'];
 
if ( $page == 'home' ) 
{
echo "Welkom op de homepage";
//De link hier is dus:www.iets.nl/index.php?page=home
} 
else if ( $page == 'contact' ) 
{
echo "Welkom op de contact-pagina.";
//De link hier is dus:www.iets.nl/index.php?page=contact
}
else if ( $page == 'game' ) 
{
echo "Welkom op de game-pagina.";
//De link hier is dus:www.iets.nl/index.php?page=game
}
else if ( $page == 'news' ) 
{
echo "Welkom op de news-pagina.";
//De link hier is dus:www.iets.nl/index.php?page=news
}
else
{
echo "Deze pagina bestaat niet.";
}
 
PHP:
					<?php
 
$page = $_GET['page'];
 
if ( $page == 'home' ) {
echo "";
//De link hier is dus:www.iets.nl/index.php?page=home
}
 
if ( $page == 'contact' ) {
echo "Welkom op de contact-pagina.";
//De link hier is dus:www.iets.nl/index.php?page=contact
}
?>

maar als ik bij contact een emebd script wil neerzetten doet hij het niet hoe kan dat
 
nou blijk dat het emded script meer is maar dit zou hem moeten worede??
PHP:
                    <?php
 
$page = $_GET['page'];
 
if ( $page == 'december' ) {
echo "- 8 Maaike Ruiter

- 25 Pieter ooste ";
//De link hier is dus:www.iets.nl/index.php?page=home
}
 
if ( $page == 'oktober' ) {
echo "- 8 Han Schilder

- 21 Kim Pasterkamp

- 26 Siebrand Ruiter";
//De link hier is dus:www.iets.nl/index.php?page=contact
}

if ( $page == 'november' ) {
echo "- 5 Noam Brals";
//De link hier is dus:www.iets.nl/index.php?page=contact
}

if ( $page == 'familie' ) {
echo "<a href=/fam>klik hier voor familie</a><BR><BR></p>";
//De link hier is dus:www.iets.nl/index.php?page=contact
}

if ( $page == 'flash' ) {
echo "<br><object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="780" height="183">
                      <param name="movie" value="flash/hoofd.swf" />
                      <param name="quality" value="high" />
                      <param name="wmode" value="opaque" />
                      <param name="swfversion" value="6.0.65.0" />
                      <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
                      <param name="expressinstall" value="Scripts/expressInstall.swf" />
                      <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
                      <!--[if !IE]>-->
                      <object type="application/x-shockwave-flash" data="flash/hoofd.swf" width="780" height="183">
                        <!--<![endif]-->
                        <param name="quality" value="high" />
                        <param name="wmode" value="opaque" />
                        <param name="swfversion" value="6.0.65.0" />
                        <param name="expressinstall" value="Scripts/expressInstall.swf" />
                        <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
                        <div>
                          <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
                          <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
                        </div>
                        <!--[if !IE]>-->
                      </object>
                      <!--<![endif]-->
                    </object>
";
//De link hier is dus:www.iets.nl/index.php?page=contact
}
?>

in dreamweaver gaat hij hele raare kleuren gefen aan het php scriptje

mijn brouwser geeft dit aan:

Parse error: parse error, expecting `','' or `';'' in www.semschilder.nl/ndex.php on line 217

en daar begint dan ook het scriptje
 
Laatst bewerkt:
zoals je al aan de kleur kan zien gaat het niet helemaal goed
voorbeeld:
PHP:
regel 32: echo "<br><object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="780" height="183">
door dat je dubbele quotjes (") gebruikt bij je echo en ook bij de andere dingen word de echo weer afgesloten.
je moet dus alle dubbele quotjes ( " ) in je echo vervangen door enkele quootjes ( ' )
nog even het voorbeeld:
PHP:
regel 32: echo "<br><object id='FlashID' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='780' height='183'>
 
Laatst bewerkt:
Ik zou eerder adviseren om de echo met single quotes te doen zodat je fatsoenlijke HTML teruggeeft en niet alle dubbele quotes hoeft te 'escapen' :)

Extra voordeel van single quotes is dat je variabelen moet 'escapen' waardoor ze sneller opvallen tussen regels tekst.

PHP:
echo '
<br><object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="780" height="183">
                      <param name="movie" value="flash/hoofd.swf" />
                      <param name="quality" value="high" />
                      <param name="wmode" value="opaque" />
                      <param name="swfversion" value="6.0.65.0" />
                      <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
                      <param name="expressinstall" value="Scripts/expressInstall.swf" />
                      <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
                      <!--[if !IE]>-->
                      <object type="application/x-shockwave-flash" data="flash/hoofd.swf" width="780" height="183">
                        <!--<![endif]-->
                        <param name="quality" value="high" />
                        <param name="wmode" value="opaque" />
                        <param name="swfversion" value="6.0.65.0" />
                        <param name="expressinstall" value="Scripts/expressInstall.swf" />
                        <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
                        <div>
                          <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
                          <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
                        </div>
                        <!--[if !IE]>-->
                      </object>
                      <!--<![endif]-->
                    </object>
';
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan