Results 1 to 7 of 7

Thread: Displaying different pages while staying on index..

  1. #1
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Post Displaying different pages while staying on index..

    Hi Peeps,

    I am very new to php and need some help please!!

    I would like to know if there is anyway of using php to display different content (text pictures etc) while keeping the header??

    I have a page that uses flash for the header and need to load new pages underneath this while not refreshing the flash file!

    Thanks!

  2. #2
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    I don't know of a way to do it with php, but you can do it with ajax. Here is a demo I made a while ago. This was made in order to have some music playing while changing content, but the musicplayer is actually flash ( swf file).

  3. The Following User Says Thank You to azoomer For This Useful Post:

    jcord04 (08-14-2010)

  4. #3
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Smile

    Thank you!!!

  5. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Yes, this can be done using PHP.

    The most basic method is using the function called include().

    Of course it can become more complex depending on your situation, but it is a very useful tool.

    Once it becomes very complex, this is called templating and may require a database, etc.

    In your situation, you should be able to create a page called "header.php" with ONLY the html code for the flash-- no extra tags, no <html> or <head> tags, just the content for flash. Then on any page you want that header, use:
    <?php include('path/to/header.php'); ?>

    Note that your pages must use the .php extension to execute this PHP code-- your header page, unless it has other PHP, does not need to be .php-- it could be .htm or another extension if you want.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. The Following User Says Thank You to djr33 For This Useful Post:

    jcord04 (08-16-2010)

  7. #5
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Thanks djr33

    This works great!!! :-D although i need it to include (index.php?x=browse&category=3) which doesnt seem to work!! :-S !!

    Please help!!

    Thankyou!! :-P

  8. #6
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    hey just for newbies like myself!! :-P

    i found a solution to passing queries using include!

    <?php
    $_GET['x'] = 'browse';
    $_GET['category'] = '6';
    include 'index.php';
    ?>


    example: index.php?x=browse&category=6

    :-D :-P

  9. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Yes, that can work. But why do you need to use "GET" variables like that? Once you're using PHP, there are more direct ways to handle it. Unless you're trying to include pages with that format from another piece of software such as a forum, I suppose...

    include() will use a file, not a URL. It can be a full URL (I don't know about GET variables) but only if your server is setup to allow external files. Because of this, the data after the ? is irrelevant.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

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