Results 1 to 14 of 14

Thread: Taking PHP info from a file! Like a Template.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    England
    Posts
    312

    Taking PHP info from a file! Like a Template.

    Does anyone know how I would go about doing this ?? could I just something like <link... > statement? or does PHP code need something more sophisticated?

    how also would i split up a vaible, so everytime it gets to a ; it writes what its written to an array, then carrys on readin until it gets to another value, e.g.

    value of string: a;b;c;d;e

    becomes

    $pie[0] = a
    $pie[1] = b
    $pie[2] = c
    $pie[3] = d
    $pie[4] = e

    thanks
    Last edited by JafferAB; Dec 12th, 2002 at 04:59 AM.
    Power to 2000 Electronic Donkeys!
    www.edonkey2000.com
    I hate case sensitivity... all you get down the M1 is "are we there yet" and "ouch, watch the bumps".

  2. #2
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    England
    Posts
    312
    cool thanks took me a little bit fo a while to work out what it meant, but i got it in the end!
    Power to 2000 Electronic Donkeys!
    www.edonkey2000.com
    I hate case sensitivity... all you get down the M1 is "are we there yet" and "ouch, watch the bumps".

  4. #4
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    could have also used explode()

    $pie = explode(";", $string);

    if you didn't want to use preg_split

    Does anyone know how I would go about doing this ?? could I just something like <link... > statement? or does PHP code need something more sophisticated?
    not sure what you mean by this, elaborate ?

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    England
    Posts
    312
    elaboration : e.g. to gain the information from a CSS file, you may use this...

    Code:
    <link rel="stylesheet" type="text/css" href="default.css">
    this will use the code from default.css and use it in the webpage..

    What I want to do, for example, is add this code, which is in pie.php for example...

    Code:
    <?PHP
     print "pie is good, pie is life";
    ?>
    so that where the link to pie.php (other extensions, or whatever) prints in that space, "pie is good, pie is life".

    Does this help ?

    P.S. Tanks fo rthe previous help, i managed to get it all working sweet as a chestnut (a bit rough round the edges, but it ltimatele works )
    Power to 2000 Electronic Donkeys!
    www.edonkey2000.com
    I hate case sensitivity... all you get down the M1 is "are we there yet" and "ouch, watch the bumps".

  6. #6
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    yes you can use the <link... tag just like regular html. but you have to do it in the same spot as well, in the header tag.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    England
    Posts
    312
    ah right, so its gotta be set in a variable :-/ hmm, that could be a bit usefull i suppose!

    cheers
    Power to 2000 Electronic Donkeys!
    www.edonkey2000.com
    I hate case sensitivity... all you get down the M1 is "are we there yet" and "ouch, watch the bumps".

  8. #8
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    no it can't be set in a variable. I meant like regular html in between the head tags.

    <html>
    <head>
    <link ..... >
    </head>
    <body>
    <?php

    php here

    ?>
    </body>
    </html>

    that is the same as the header in php.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    England
    Posts
    312
    hmmmmmm, ok, thanks
    Power to 2000 Electronic Donkeys!
    www.edonkey2000.com
    I hate case sensitivity... all you get down the M1 is "are we there yet" and "ouch, watch the bumps".

  10. #10
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    Scotland, UK
    Posts
    321
    Originally posted by phpman
    no it can't be set in a variable. I meant like regular html in between the head tags.

    <html>
    <head>
    <link ..... >
    </head>
    <body>
    <?php

    php here

    ?>
    </body>
    </html>

    that is the same as the header in php.
    Use include('filename.dat');
    or require('filename.dat');

    It outputs the contents straight to the web browser it does not parse it.

  11. #11
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    umm yes it does.

  12. #12
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    Scotland, UK
    Posts
    321
    Originally posted by phpman
    umm yes it does.
    I meant, unless the filename is .php (or whatever the quivilent is) it isn't.

    But suppose depends on server setup.

  13. #13
    New Member
    Join Date
    Jan 2003
    Posts
    11
    Try using virtual($filename);


    ...

    I dunno I'm clutchin at straws here.

  14. #14
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    I meant, unless the filename is .php (or whatever the quivilent is) it isn't.

    But suppose depends on server setup.
    It still does.

Posting Permissions

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



Click Here to Expand Forum to Full Width