![]() |
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? |
Quote:
|
:eek7
|
I'm confused. Can you describe it better?
|
Quote:
|
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.
|
Example.
|
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. :1orglaugh |
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.
|
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? |
Quote:
Maybe a php board might be better to ask, was hoping someone out there had done something like this. |
Quote:
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. :glugglug |
Quote:
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. |
Quote:
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? |
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. |
Quote:
|
Quote:
PHP Code:
|
Quote:
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. |
Quote:
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. |
Quote:
|
I think you should use jpcache instead. does the same gig without clottering your system with files that you'd need to maintain later.
|
| All times are GMT -7. The time now is 12:43 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123