Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    mjs
    mjs is offline
    New Coder
    Join Date
    Jan 2010
    Posts
    97
    Thanks
    17
    Thanked 0 Times in 0 Posts

    how to determine $page

    Hi,
    I want to be corrected and need your pointers regarding the code below.

    PHP Code:
    <?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
    Code:
    <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?
    Code:
    <a href="#">Product Page</a> | <a href="#">Profile Page</a> | <a href="#">Another Page</a>
    I appreciate every suggestions and thanks
    Last edited by mjs; 12-04-2010 at 06:24 PM.

  • #2
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,389
    Thanks
    8
    Thanked 1,077 Times in 1,068 Posts
    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.

  • #3
    mjs
    mjs is offline
    New Coder
    Join Date
    Jan 2010
    Posts
    97
    Thanks
    17
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    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.
    Code:
    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)

  • #4
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,389
    Thanks
    8
    Thanked 1,077 Times in 1,068 Posts
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •