Integrating variables into another page

Discussion in 'Web Programming' started by root, Jun 21, 2008.

Integrating variables into another page
  1. Unread #1 - Jun 21, 2008 at 2:32 AM
  2. root
    Joined:
    Sep 29, 2007
    Posts:
    92
    Referrals:
    0
    Sythe Gold:
    0

    root Member
    Banned

    Integrating variables into another page

    Note, in the variables (things starting with $) you'd want to remove the slash (/) after the $. Sythe appears to block out the variables.

    Here I'm going to show you how to use PHP variables to edit things on another page.

    First, the original HTML code:

    HTML:
    <html>
     <head>
      <title>root's Integration Tutorial</title>
     </head>
        <body>
          <p>How are you today?</p>
        </body>
    </html>
     

    Now for a little integration.


    First, we'd create a file. Name it, oh, "randomfile.php".
    Inside, you'd put this:

    PHP:
    <?php
    $/title "root's Integration Tutorial";
    $/
    simpleQ "How are you today?";
    ?>

    Now all thrown together:


    PHP:
    <?php
    include("randomfile.php");
    ?> 

    <html>
     <head>
      <title><? echo $/title; ?></title>
     </head>
        <body>
          <p><? echo $/simpleQ; ?></p>
        </body>
    </html>


    Explanation


    Basically, the variable's are editable from another page, so that you don't have to edit your main index page. This can be done for security issues, and is alot quicker to edit a variable, rather than scroll through your file and change random things.
    Note, you can start a php doc. with either
    PHP:
    <?
    or
    PHP:
    <?php
    .


    Enjoy! :)
     
  3. Unread #2 - Jun 21, 2008 at 8:31 AM
  4. SuF
    Joined:
    Jan 21, 2007
    Posts:
    14,212
    Referrals:
    28
    Sythe Gold:
    1,234
    Discord Unique ID:
    203283096668340224
    <3 n4n0 Two Factor Authentication User Community Participant Spam Forum Participant Sythe's 10th Anniversary

    SuF Legend
    Pirate Retired Global Moderator

    Integrating variables into another page

    Very basic and unless you know what php is its worthless
     
  5. Unread #3 - Jun 21, 2008 at 11:31 PM
  6. Deacon Frost
    Joined:
    Jan 30, 2007
    Posts:
    2,905
    Referrals:
    3
    Sythe Gold:
    57

    Deacon Frost Grand Master
    Banned

    Integrating variables into another page

    How about you cover includes, instead of just including variables ;).
     
  7. Unread #4 - Jun 24, 2008 at 2:07 AM
  8. cp
    Joined:
    Jan 30, 2007
    Posts:
    3,278
    Referrals:
    6
    Sythe Gold:
    0

    cp an cat
    Banned

    Integrating variables into another page

    SuF, lolwut? PHP is worthless? Nearly all server-side software on the web is written in PHP. Vbulletin, along with the majority of the other forum software is written in PHP. Not worthless.

    include(randomfile.php); will return an error... (You need quotes.)
     
  9. Unread #5 - Jun 24, 2008 at 2:29 AM
  10. Deacon Frost
    Joined:
    Jan 30, 2007
    Posts:
    2,905
    Referrals:
    3
    Sythe Gold:
    57

    Deacon Frost Grand Master
    Banned

    Integrating variables into another page

    CP, I think you misread...


    read it now:

    Very basic, and unless you know what php is, its worthless.
     
< Anyone successfully parsed the GE with PHP? | Python >

Users viewing this thread
1 guest


 
 
Adblock breaks this site