...

View Full Version : how to determine $page



mjs
12-04-2010, 06:17 PM
Hi,
I want to be corrected and need your pointers regarding the code below.


<?php //data.php
$page = strtoupper($_POST['page']);
if(isset($page)){
$html = "<h3>".$page."</h3>";
$html .= "<p>Hi... this is ".$page."</p>";
print($html);
}
?>
how to determine $page into several pages?.

because it will be paired to

<script type="text/javascript">
// page.html
$(document).ready(function() {
$('a').click(function(){
$.post('data.php', {'page':$(this).text()}, function(data){
$('#content').html(data);
});
});
});
</script>
<div id="content"></div>

then how can I call each of those links like the following?

<a href="#">Product Page</a> | <a href="#">Profile Page</a> | <a href="#">Another Page</a>

I appreciate every suggestions and thanks

mlseim
12-04-2010, 10:12 PM
Describe what a page is ...
Is it a static page with unique names, like "about.php", "contact.php", "signup.php".
Or will you be coding them like "p1.php", "p2,php", "p3.php".

Or ... is it one PHP script ("index.php") and the content changes depending on
the URL code you provide? There are many different ways to reference pages
and files ... and content management is all part of that.

mjs
12-05-2010, 04:23 AM
Describe what a page is ...
Is it a static page with unique names, like "about.php", "contact.php", "signup.php".
Or will you be coding them like "p1.php", "p2,php", "p3.php".

Or ... is it one PHP script ("index.php") and the content changes depending on
the URL code you provide? There are many different ways to reference pages
and files ... and content management is all part of that.

Hi mlseim,
Many thanks for Your input.
the page depending on URLS e.g.

index.php?p=start/product-page (for product-page.php)
index.php?p=start/profile-page (for profile-page.php)
index.php?p=else/another (for another.php)

mlseim
12-05-2010, 05:35 PM
You have to be a little bit careful about doing this ...

index.php?p=start/product-page (for product-page.php)

You're allowing a user to select which PHP script to include or display.
That means, they can pick a PHP script on your server that is not a webpage,
but a script that does other things, like "config.php"

So ... to make it clear, your preference will be to "include" content from other
files to be placed within your "index.php" script? I'm still not sure of your intended method.

Are you making your own CMS system?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum