PHP Help needed..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 4Pics
    Confirmed User
    • Dec 2001
    • 7952

    #1

    PHP Help needed..

    I'm trying to generate static html pages from a php page which I have down no problem except, I dont know how to get it to also then on the html page I generate insert php code so that when a user loads the page it then does that php.

    Does that make sense?
  • arial
    Confirmed User
    • Jul 2002
    • 4012

    #2
    Originally posted by 4Pics
    Does that make sense?
    That's a big negative.

    Comment

    • Evil1
      Confirmed User
      • Mar 2002
      • 3893

      #3

      Comment

      • joseph4829
        Confirmed User
        • Jul 2003
        • 1706

        #4
        I'm confused. Can you describe it better?
        Joe, Master Web Developer, ICQ: 280 889 133
        CollegeSucks.com: Trade Links (PR 6) / $2 Advertising

        On average, my site sends back 3 times as much traffic. Trade links?

        Comment

        • michaelw
          Confirmed User
          • May 2002
          • 1342

          #5
          Originally posted by joseph4829
          I'm confused. Can you describe it better?
          yea - and this time in english please
          <b><a href="http://www.hotlinkprotector.com"><font color="yellow">Hotlink Protector</font></a> - Protect all your file types from hotlinking the professional way. <br>
          See a demo <a href="http://www.hotlinkprotector.com/demo.html"><font color="yellow">here</font></a>, and testimonials <a href="http://www.hotlinkprotector.com/testimonials.html"><font color="yellow">here</font></a><br>ICQ: 146423631

          Comment

          • fiveyes
            Confirmed User
            • Aug 2001
            • 1680

            #6
            I'm a bit unclear about what you're trying to do. Are you generating a page using php that has php code within it that you want parsed? If so, just do the code in the first place and output the results.
            <CENTER><A HREF="http://www.hot-off-bourbon.com/" target="_blank"><IMG SRC="http://www.hot-off-bourbon.com/images/hob-logosmall.jpg" border="0"></A>

            <FONT face="Comic Sans MS" SIZE="-1"><I>Mardi Gras, Spring Break, Wet-T, Night Club Action, UpSkirt, Oil Wrestling, Voyeur</I></FONT></CENTER>

            Comment

            • teenjump
              So Fucking Banned
              • Jul 2003
              • 1595

              #7
              Example.

              Comment

              • Zorgman
                Confirmed User
                • Aug 2002
                • 6103

                #8
                Come on ppl, he wants to generate a .php file with html generated + php code so the end user gets the generated code and php code.

                I understand you mate. However I have never done that before so I can't help you.
                ---

                Comment

                • fiveyes
                  Confirmed User
                  • Aug 2001
                  • 1680

                  #9
                  What throws me off is the part "when a user loads the page it then does that php" because php is server side. Once the user loads the page, it's done and simply text.
                  <CENTER><A HREF="http://www.hot-off-bourbon.com/" target="_blank"><IMG SRC="http://www.hot-off-bourbon.com/images/hob-logosmall.jpg" border="0"></A>

                  <FONT face="Comic Sans MS" SIZE="-1"><I>Mardi Gras, Spring Break, Wet-T, Night Club Action, UpSkirt, Oil Wrestling, Voyeur</I></FONT></CENTER>

                  Comment

                  • 4Pics
                    Confirmed User
                    • Dec 2001
                    • 7952

                    #10
                    Example

                    Page is amateurs.php which does a
                    select * from database where category = amateurs

                    it then prints out the galleries with links etc.

                    I turn that into a static html page so my mysql server is not hit every time someone loads the page.

                    But I want my toplist on the page so how do I get that?
                    So to get my toplist updated i'd need to do a include(toplist) with the php dealies but that causes when I generate the page for it to do the toplist right then and there. I want it to print on my html page the < ? include ( " toplist.php " ) ? >

                    Using autogallery which is a cgi script it works fine, but how is it done in php?

                    Somehow its done or Itgp, BoxxTgp or any other php tgp script could not let you include php in a php script?

                    Comment

                    • 4Pics
                      Confirmed User
                      • Dec 2001
                      • 7952

                      #11
                      Originally posted by Zorgman
                      Come on ppl, he wants to generate a .php file with html generated + php code so the end user gets the generated code and php code.

                      I understand you mate. However I have never done that before so I can't help you.
                      Thanks

                      Maybe a php board might be better to ask, was hoping someone out there had done something like this.

                      Comment

                      • Arty
                        Confirmed User
                        • Nov 2002
                        • 880

                        #12
                        Originally posted by 4Pics
                        I'm trying to generate static html pages from a php page which I have down no problem except, I dont know how to get it to also then on the html page I generate insert php code so that when a user loads the page it then does that php.

                        Does that make sense?
                        I'm not sure if that is what you are asking but,

                        If the generated file extnsion is .html you cannot execute it as a php script nor include another php in it.

                        Alternatively if the file extension is not a problem then save the generated file as .php then you can "include" another php code to it.

                        I hope that helps.

                        Comment

                        • 4Pics
                          Confirmed User
                          • Dec 2001
                          • 7952

                          #13
                          Originally posted by Arty


                          I'm not sure if that is what you are asking but,

                          If the generated file extnsion is .html you cannot execute it as a php script nor include another php in it.

                          Alternatively if the file extension is not a problem then save the generated file as .php then you can "include" another php code to it.

                          I hope that helps.
                          Maybe you didn't know but you can configure apache to parse php/cgi/perl/whatever as any extension you want.

                          You can't parse both php and cgi on the same extension though.

                          I dont understand what you mean though to save the file as php then include another php file in it. I dont want to manually add to the file since I want to do it hourly and to edit 50 pages would not be fun that often.

                          Comment

                          • Arty
                            Confirmed User
                            • Nov 2002
                            • 880

                            #14
                            Originally posted by 4Pics


                            Maybe you didn't know but you can configure apache to parse php/cgi/perl/whatever as any extension you want.

                            You can't parse both php and cgi on the same extension though.

                            I dont understand what you mean though to save the file as php then include another php file in it. I dont want to manually add to the file since I want to do it hourly and to edit 50 pages would not be fun that often.
                            Of course you can configure apache to parse any extension, but I was talking about defaults here.

                            As for the rest..If I'm correct you are using a script that creates & writes static pages periodically. And have another .php script which needs to run whenever that static pages called.

                            As you have access to apache & configure php to parse .html, put that in your generated .html pages as text while creating them.
                            < ? php include("myscript.html"); ? >

                            or am I missing something here?
                            Last edited by Arty; 08-04-2003, 01:29 AM.

                            Comment

                            • 4Pics
                              Confirmed User
                              • Dec 2001
                              • 7952

                              #15
                              You can't do

                              print <? include ( toplist.php )

                              in a php file or it will print it

                              you also can't use the <? parts or it wants to parse what it is inside.

                              Comment

                              • fiveyes
                                Confirmed User
                                • Aug 2001
                                • 1680

                                #16
                                Originally posted by 4Pics
                                You can't do

                                print < ? include ( toplist.php )

                                in a php file or it will print it

                                you also can't use the < ? parts or it wants to parse what it is inside.
                                OK, I see what the problem is! You DO want to print the php code to the static page you generate. Just have the page end with an extension that your php parser will handle (usually *.php). That way, everytime the page is called, it will get parsed, your php code will be executed and - VIOLA!
                                <CENTER><A HREF="http://www.hot-off-bourbon.com/" target="_blank"><IMG SRC="http://www.hot-off-bourbon.com/images/hob-logosmall.jpg" border="0"></A>

                                <FONT face="Comic Sans MS" SIZE="-1"><I>Mardi Gras, Spring Break, Wet-T, Night Club Action, UpSkirt, Oil Wrestling, Voyeur</I></FONT></CENTER>

                                Comment

                                • Benja
                                  Confirmed User
                                  • May 2002
                                  • 258

                                  #17
                                  Originally posted by 4Pics
                                  You can't do

                                  print <? include ( toplist.php )

                                  in a php file or it will print it

                                  you also can't use the <? parts or it wants to parse what it is inside.
                                  When u generate ur HTML :

                                  PHP Code:
                                  <?php echo("<?php include(\"blabla.php\"); ?>"); ?>
                                  "Bite my shiny metal ass!"

                                  Comment

                                  • ckm
                                    Registered User
                                    • Jul 2003
                                    • 15

                                    #18
                                    Originally posted by 4Pics
                                    Page is amateurs.php which does a
                                    select * from database where category = amateurs

                                    it then prints out the galleries with links etc.

                                    I turn that into a static html page so my mysql server is not hit every time someone loads the page.

                                    But I want my toplist on the page so how do I get that?
                                    So to get my toplist updated i'd need to do a include(toplist) with the php dealies but that causes when I generate the page for it to do the toplist right then and there. I want it to print on my html page the < ? include ( " toplist.php " ) ? >
                                    Here is what you do:

                                    Make a shell script to execute php at the command line to parse the php file and then output the result to an html file by running: /usr/bin/php -q script.php > index.html . You may need to play around with the path to the php binary if it isn't in /usr/bin.

                                    Include the toplist by using server side includes

                                    Use a cronjob to execute the shell script every night to create a new html file.

                                    Comment

                                    • Arty
                                      Confirmed User
                                      • Nov 2002
                                      • 880

                                      #19
                                      Originally posted by 4Pics
                                      You can't do

                                      print <? include ( toplist.php )

                                      in a php file or it will print it

                                      you also can't use the <? parts or it wants to parse what it is inside.
                                      Just follow the Benja

                                      Also, if you don't need .html extension for any special reason and just wanted to make less hits to mysql here is an alternative,

                                      Just put them in a text file then update only that file periodically and make your pages to read data from it.
                                      Last edited by Arty; 08-04-2003, 03:59 AM.

                                      Comment

                                      • 4Pics
                                        Confirmed User
                                        • Dec 2001
                                        • 7952

                                        #20
                                        Originally posted by Benja


                                        When u generate ur HTML :

                                        PHP Code:
                                        <?php echo("<?php include(\"blabla.php\"); ?>"); ?>
                                        Thank you, this works perfectly.

                                        Comment

                                        • dnsmonster
                                          Confirmed User
                                          • Jul 2002
                                          • 634

                                          #21
                                          I think you should use jpcache instead. does the same gig without clottering your system with files that you'd need to maintain later.
                                          I couldn't possibly know what I'm talking about, I'm completely, absolutely and definitively out of my fucking mind.

                                          Comment

                                          Working...