GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP Help needed.. (https://gfy.com/showthread.php?t=160111)

4Pics 08-04-2003 12:38 AM

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 08-04-2003 12:42 AM

Quote:

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

Evil1 08-04-2003 12:46 AM

:eek7

joseph4829 08-04-2003 12:56 AM

I'm confused. Can you describe it better?

michaelw 08-04-2003 12:58 AM

Quote:

Originally posted by joseph4829
I'm confused. Can you describe it better?
yea - and this time in english please

fiveyes 08-04-2003 01:02 AM

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.

teenjump 08-04-2003 01:09 AM

Example.

Zorgman 08-04-2003 01:11 AM

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

fiveyes 08-04-2003 01:20 AM

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.

4Pics 08-04-2003 01:45 AM

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?

4Pics 08-04-2003 01:46 AM

Quote:

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. :1orglaugh

Thanks :)

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

Arty 08-04-2003 01:54 AM

Quote:

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. :glugglug

4Pics 08-04-2003 02:04 AM

Quote:

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. :glugglug

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.

Arty 08-04-2003 02:21 AM

Quote:

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?

4Pics 08-04-2003 03:20 AM

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.

fiveyes 08-04-2003 03:27 AM

Quote:

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!

Benja 08-04-2003 03:32 AM

Quote:

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\"); ?>"); ?>


ckm 08-04-2003 03:46 AM

Quote:

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.

Arty 08-04-2003 04:56 AM

Quote:

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.

4Pics 08-04-2003 11:47 AM

Quote:

Originally posted by Benja


When u generate ur HTML :

PHP Code:

<?php echo("<?php include(\"blabla.php\"); ?>"); ?>


Thank you, this works perfectly.

dnsmonster 08-04-2003 11:57 AM

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