Jump to content

Auto page creation?


batstanggt

Recommended Posts

I guess you have an html template somewhere (or 5 in this case).

If they're exactly the same for each user, there's really no point in duplicating them, if they're different, you probably need to change some code in each, so you would use file_get_contents() to read in the template, something like str_replace() to alter it, and then save it to another file.

 

Link to comment
Share on other sites

Hey guys sorry for the delayed response jsut finished up 14 hour work day. Anyhow Webstyles your on the right track 5 templates for each user sounds like what im trying to accomplish more so than creating individual .html pages for each user. So how does one make that happen ? Im gunna take a shot in the dark and say URL variables? lol just a guess. Thanks guys for the help and hope you dont mind helpin me a lil more.

-SB

Link to comment
Share on other sites

Not really sure what you are trying to accomplish.

Im gunna take a shot in the dark and say URL variables?

 

Do you have 5 separate 'pages' and want to display one of those pages inside an existing template?

 

If so you can do something like this...

<?php
require_once('header.php'); // include your Header template

// URL would look like... file.php?page=something
if(isset($_GET['page'])) {
   $page = trim($_GET['page']);
} else {
   $page = 'home'; // set default page to load if none is specified
}

$page = 'pages/'.$page.'.php'; // path to pages, in this case the 'pages' directory/folder

if(file_exists($page)) {
  require_once($page); // include the specified page if it does exist
} else {
  require_once('pages/home.php'); // if the page doesn't exist load the default page
}

require_once('footer.php'); // include your Footer template

?>

 

Regards,

Ace

Link to comment
Share on other sites

Not really sure what you are trying to accomplish.

Im gunna take a shot in the dark and say URL variables?

 

Do you have 5 separate 'pages' and want to display one of those pages inside an existing template?

 

If so you can do something like this...

<?php
require_once('header.php'); // include your Header template

// URL would look like... file.php?page=something
if(isset($_GET['page'])) {
   $page = trim($_GET['page']);
} else {
   $page = 'home'; // set default page to load if none is specified
}

$page = 'pages/'.$page.'.php'; // path to pages, in this case the 'pages' directory/folder

if(file_exists($page)) {
  require_once($page); // include the specified page if it does exist
} else {
  require_once('pages/home.php'); // if the page doesn't exist load the default page
}

require_once('footer.php'); // include your Footer template

?>

 

Regards,

Ace

 

Don't forget to fill in the nice big juicey local file inclusion hole in that example.

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.