Jump to content

how to create dynamic page w/o database


pixeltrace

Recommended Posts

Hi,

 

we are doing a site w/o using database for our dynamic pages.

what i wanted to happen is i have

about us page

about.php

and inside i will have the following php codes

<? include (aboutuscontent.php);?>

and this page will contains some variables for the content like

<? $content1 ='html content here';
$content2 ='html content here';
$content3 ='html content here';
$content4 ='html content here';
?>

 

now on my aboutus.php i will have

this code

<?  if $_GET[id] == 1 {echo '$content1'; } ?>

 

my question is for my codes inside aboutuscontent.php

how will i be able to instead the html contents into so that i wont

need to change the HTML codes (e.g " to ' ' must place \  ... and so on)

 

hope you could help me with this.

 

thanks!

Link to comment
Share on other sites

I do not fully understand your description of what you want, are you saying you do not want to go through the HTML and convert it into a string for php , like

$html1="<a href=\"this is some html\">";

 

anyway you are going about this the wrong way. Save all your unique content html as a seperate file

content1.htm,  content2.htm, content3.htm etc then use an include

 


<?php
$html_page=$_GET[id]; // I like to always put GET and POST into my own vars 

//check if the var is valid, using GET someone can pass it through browser  such as ?id=234329; use POST instead , good to still have a check though.

//IS id numeric or string? you may have to put the numers in " " to work.  "1" "4"

if (  ($html_page < 1 ) || ($html_page > 4 )  ){ //orwhatever the highest page id  number you have
echo"ERROR: Requested page not valid";
}else{
include  $path."content".$html_page.".htm";
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.