Announcement

Collapse
No announcement yet.

Inputting PHP into Templates

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Inputting PHP into Templates

    Okay I want to input a php code into my home page template to create a random quote. Heres the code:
    PHP Code:
    <?php 
    $quote 
    = array(
    "<span class=siteTextNormal><i>'We are the music makers, and we are the dreamers of dreams'</i> - W.W.</span>"
    "<span class=siteTextNormal><i>'There was a band playing in my head, so I felt like getting high'</i> - Neil Young</span>"
    "<span class=siteTextNormal><i>'A good composer does not imitate; he steals'</i> - Igor Stravinsky</span>"
    "<span class=siteTextNormal><i>'All the good music has already been written by people with wigs and stuff'</i> - Frank Zappa</span>"
    "<span class=siteTextNormal><i>'Music should strike fire from the heart of man, and bring tears from the eyes of woman'</i> - Ludwig Van Beethoven</span>"
    "<span class=siteTextNormal><i>'If music be the food of love, play on'</i> - Shakespeare, Twelfth Night</span>"
    "<span class=siteTextNormal><i>'Opera is when a guy gets stabbed in the back and instead of bleeding he sings'</i> - Edward Gardner </span>"
    "<span class=siteTextNormal><i>'The English may not like music, but they absolutely love the noise it makes'</i> - Oliver Herford</span>" 
    ); 
    $arrayCount count($quote) -1;  
    srand((double)microtime()*1000000);  
    $randomNo rand(0,$arrayCount);  
    $randQuote $quote[$randomNo]; 
    echo 
    $randQuote
    ?>
    However it does not show up How do I get round this problem? Maybe editing the functions.php file?

  • #2
    You need to use the phpinclude templates
    Running vB since 4-14-2002

    Comment


    • #3
      Errrr... Im not sure what you mean! Could you explain to me how to do this please?

      Comment


      • #4
        Try putting this code in your phpinclude template:

        PHP Code:
        $quote = array( 
        "<span class=siteTextNormal><i>'We are the music makers, and we are the dreamers of dreams'</i> - W.W.</span>"
        "<span class=siteTextNormal><i>'There was a band playing in my head, so I felt like getting high'</i> - Neil Young</span>"
        "<span class=siteTextNormal><i>'A good composer does not imitate; he steals'</i> - Igor Stravinsky</span>"
        "<span class=siteTextNormal><i>'All the good music has already been written by people with wigs and stuff'</i> - Frank Zappa</span>"
        "<span class=siteTextNormal><i>'Music should strike fire from the heart of man, and bring tears from the eyes of woman'</i> - Ludwig Van Beethoven</span>"
        "<span class=siteTextNormal><i>'If music be the food of love, play on'</i> - Shakespeare, Twelfth Night</span>"
        "<span class=siteTextNormal><i>'Opera is when a guy gets stabbed in the back and instead of bleeding he sings'</i> - Edward Gardner </span>"
        "<span class=siteTextNormal><i>'The English may not like music, but they absolutely love the noise it makes'</i> - Oliver Herford</span>" 
        ); 
        $arrayCount count($quote) -1;   
        srand((double)microtime()*1000000);   
        $randomNo rand(0,$arrayCount);   
        $randQuote $quote[$randomNo]; 
        Then use the $randQuote variable in any vBulletin template.

        Comment

        Loading...
        Working...
        X