Adblock breaks this site

Integrating variables into another page

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

  1. root

    root Member
    Banned

    Joined:
    Sep 29, 2007
    Posts:
    92
    Referrals:
    0
    Sythe Gold:
    0
    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! :)
     
  2. SuF

    SuF Legend
    Pirate Retired Global Moderator

    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
    Integrating variables into another page

    Very basic and unless you know what php is its worthless
     
  3. Deacon Frost

    Deacon Frost Grand Master
    Banned

    Joined:
    Jan 30, 2007
    Posts:
    2,905
    Referrals:
    3
    Sythe Gold:
    57
    Integrating variables into another page

    How about you cover includes, instead of just including variables ;).
     
  4. cp

    cp an cat
    Banned

    Joined:
    Jan 30, 2007
    Posts:
    3,278
    Referrals:
    6
    Sythe Gold:
    0
    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.)
     
  5. Deacon Frost

    Deacon Frost Grand Master
    Banned

    Joined:
    Jan 30, 2007
    Posts:
    2,905
    Referrals:
    3
    Sythe Gold:
    57
    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 >


 
 
Adblock breaks this site