php-windows Digest 12 Apr 2007 22:36:46 -0000 Issue 3191
Topics (messages 27673 through 27682):
Re: change ? into 'slash'
27673 by: Mikael Grön
Re: Calling PHP from PHP
27674 by: Mikael Grön
27676 by: Alf Stockton
27678 by: Mikael Grön
27681 by: Jarrett Meyer
Re: change ? into 'slash' (solved but need more light)
27675 by: bedul
cache control at client
27677 by: Alf Stockton
27679 by: Mikael Grön
27680 by: Alf Stockton
27682 by: Rich Buggy
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Is this what you mean?
www.server.com/index.php?pageid=123
becomes
www.server.com/index.php/123
It's actually the other way around. When the user browses to
/index.php/123, the webserver translates that into /index.php?pageid=123 ...
If it's an Apache server, it's done in a .htaccess file located in a
folder above the stuff you want to change.
Read here for guides and examples:
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
On my own site, I have an index.php file which handles incoming page
request by a search string. For example:
Someone goes to:
www.emgee.se/hem/kontakt.html
my rewrite script, located in the file .htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
translates anything written in the URL, except files that actually exist
on the server to:
www.emgee.se/index.php?q=hem/kontakt.html
The index.php file gets the $_GET['q']-variable and starts splitting the
path and finding the pages in the database. In this case it looks for a
page named "kontakt" which is a child-page of a page named "hem".
Hope this gets you on your way.
Mike
bedul skrev:
----- Original Message -----
From: gunawan
To: [EMAIL PROTECTED]
Sent: Thursday, April 12, 2007 8:17 AM
Subject: change ? into 'slash'
if the title is not right.. plz reply to me with the right title.
i see on mambo site where the site manage to change ? into /
how to make that? are from the skrip or from the configuration?
thx 4 reading.
fyi.. i'm indonesian
--- End Message ---
--- Begin Message ---
Sidenote:
You can also do:
$dir = "folder/of/include/files";
$files = opendir($dir);
while ($file = readdir($file)):
if (substr($file,-4) == '.php'):
include_once($dir.'/'.$file);
endif;
endwhile;
but I wouldn't recommend it. :P
Mike
John Comerford skrev:
Yes, what you have described should work fine......
sam rumaizan wrote:
1- I have 50 php pages.
2- I want to include all 50 php pages in my main page.
include("1.php"); ...... include("50.php");
My question is: can I put all of the include php pages in one
php page and save it as includepages.php then include this php page
to my main page include("includepages.php"); instead of listing all
of the 50 pages include("1.php"); ...... include("50.php"); in my
main page.
Hartleigh Burton <[EMAIL PROTECTED]> wrote:
Not sure if i understand properly... you don't want to use the
include () function or you don't want to have the code of script B in
script A?
If it is the later you can use include("path/to/scriptB.php"); or
require("path/to/scriptB.php");
you can also use include_once() and require_once() if you want to
make sure that script B is not used more than once.
If you don't want to use the include() or require() functions then I
am not really sure.
I guess (providing you havn't already output headers) you could use
header() to direct the browser... or if headers have already been
sent you could use javascript to do a redirect?!
On 12/04/2007, at 3:18 PM, Alf Stockton wrote:
Please tell me how I call one PHP script from another?
On successful completion of script A I need to call script B without
including it as part of script A.
--
Regards,
Alf Stockton www.stockton.co.za
Be cheerful while you are alive.
-- Phathotep, 24th Century B.C.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Regards,
Hartleigh.
---------------------------------
Don't get soaked. Take a quick peak at the forecast with theYahoo!
Search weather shortcut.
--- End Message ---
--- Begin Message ---
Mikael Grön wrote:
Sidenote:
You can also do:
$dir = "folder/of/include/files";
$files = opendir($dir);
while ($file = readdir($file)):
if (substr($file,-4) == '.php'):
include_once($dir.'/'.$file);
endif;
endwhile;
but I wouldn't recommend it. :P
No neither would I recommend that solution and anyway I don't in any way
want to do an include.
If I was going to include then I may as well have coded that script into
the "calling" script and duplicate the stuff all over my system.
Maybe too much of my C programming background is showing but I just want
to call another script, the same as one would in C by calling another
program.
--
Regards,
Alf Stockton www.stockton.co.za
Beware of a dark-haired man with a loud tie.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--- End Message ---
--- Begin Message ---
If you're not using an external program or script to run all your php
scripts, but want one script to execute another, then include or require
are the only methods that'll do the job.
Putting the include / require -part in the end of the first script is
exactly the same as running them both after each other.
Perhaps doing a header("Location: next-script.php"); will do what you
ask, but I don't know if that works without a browser!
Mike
Alf Stockton skrev:
Mikael Grön wrote:
Sidenote:
You can also do:
$dir = "folder/of/include/files";
$files = opendir($dir);
while ($file = readdir($file)):
if (substr($file,-4) == '.php'):
include_once($dir.'/'.$file);
endif;
endwhile;
but I wouldn't recommend it. :P
No neither would I recommend that solution and anyway I don't in any
way want to do an include.
If I was going to include then I may as well have coded that script
into the "calling" script and duplicate the stuff all over my system.
Maybe too much of my C programming background is showing but I just
want to call another script, the same as one would in C by calling
another program.
--- End Message ---
--- Begin Message ---
header("Location:next-script.php"); would work as long as nothing has been
written to the screen. You can write to a DB, a cookie, a session, a file, etc,
though to keep data flowing.
Thank you,
Jarrett Meyer
http://jarrettmeyer.blogspot.com
No trees were harmed during this transmission; however, several electrons were
terribly inconvenienced.
----- Original Message ----
From: Mikael Grön <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Thursday, April 12, 2007 10:41:28 AM
Subject: Re: [PHP-WIN] Calling PHP from PHP
If you're not using an external program or script to run all your php
scripts, but want one script to execute another, then include or require
are the only methods that'll do the job.
Putting the include / require -part in the end of the first script is
exactly the same as running them both after each other.
Perhaps doing a header("Location: next-script.php"); will do what you
ask, but I don't know if that works without a browser!
Mike
Alf Stockton skrev:
> Mikael Grön wrote:
>> Sidenote:
>>
>> You can also do:
>> $dir = "folder/of/include/files";
>> $files = opendir($dir);
>> while ($file = readdir($file)):
>> if (substr($file,-4) == '.php'):
>> include_once($dir.'/'.$file);
>> endif;
>> endwhile;
>>
>> but I wouldn't recommend it. :P
>>
> No neither would I recommend that solution and anyway I don't in any
> way want to do an include.
> If I was going to include then I may as well have coded that script
> into the "calling" script and duplicate the stuff all over my system.
> Maybe too much of my C programming background is showing but I just
> want to call another script, the same as one would in C by calling
> another program.
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
nothing less.. that a correct.
----- Original Message -----
From: "Mikael Grön" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 12, 2007 1:26 PM
Subject: Re: [PHP-WIN] Fw: change ? into 'slash'
> Is this what you mean?
>
> www.server.com/index.php?pageid=123
> becomes
> www.server.com/index.php/123
waw.. that's posible???
>
> It's actually the other way around. When the user browses to
> /index.php/123, the webserver translates that into /index.php?pageid=123
...
> If it's an Apache server, it's done in a .htaccess file located in a
> folder above the stuff you want to change.
> Read here for guides and examples:
> http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
>
> On my own site, I have an index.php file which handles incoming page
> request by a search string. For example:
> Someone goes to:
> www.emgee.se/hem/kontakt.html
>
> my rewrite script, located in the file .htaccess:
> RewriteEngine On
> RewriteBase /
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
>
> translates anything written in the URL, except files that actually exist
> on the server to:
> www.emgee.se/index.php?q=hem/kontakt.html
>
> The index.php file gets the $_GET['q']-variable and starts splitting the
> path and finding the pages in the database. In this case it looks for a
> page named "kontakt" which is a child-page of a page named "hem".
??? i don't get what u mention here.. no heart felling, i was talking about
how to do that based what you said above.
but i will read your url first.
thx for your reply.
>
> Hope this gets you on your way.
>
> Mike
--- End Message ---
--- Begin Message ---
I have set:-
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="Mon, 22 Jul 2000 11:12:01 GMT"
in the header are of all my pages but still until the user does a reload
in both IE & Firefox they do not see the new screen.
Please tell me what else I can do to force the browser to not cache
anything ever.
I am not in a position of altering the client browser settings despite
this being an intranet system.
--
Regards,
Alf Stockton www.stockton.co.za
Q: What's yellow, and equivalent to the Axiom of Choice?
A: Zorn's Lemon.
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--- End Message ---
--- Begin Message ---
What I generally use for no-cache is this:
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
Also, to force it to work correctly, I've seen people do stuff like this:
<HTML>
<HEAD>
<TITLE> Pragma No-cache </TITLE>
</HEAD>
<BODY>
This is an example of where to place the second header section<br>
so that the "Pragama, No-Cache" metatag will work as it is supposed to.<br>
</BODY>
<HEAD> <!-- Note the second header tag -->
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</HEAD>
</HTML>
Supposedly there are problems with the pragma no-cache method, which can
be solved by adding an extra head-tag with the pragma meta setting,
after the </body>
I've never tried that though.
Mike
Alf Stockton skrev:
I have set:-
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="Mon, 22 Jul 2000 11:12:01 GMT"
in the header are of all my pages but still until the user does a
reload in both IE & Firefox they do not see the new screen.
Please tell me what else I can do to force the browser to not cache
anything ever.
I am not in a position of altering the client browser settings despite
this being an intranet system.
--- End Message ---
--- Begin Message ---
Mikael Grön wrote:
What I generally use for no-cache is this:
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
Also, to force it to work correctly, I've seen people do stuff like this:
<HTML>
<HEAD>
<TITLE> Pragma No-cache </TITLE>
</HEAD>
<BODY>
This is an example of where to place the second header section<br>
so that the "Pragama, No-Cache" metatag will work as it is supposed to.<br>
</BODY>
<HEAD> <!-- Note the second header tag -->
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</HEAD>
</HTML>
Supposedly there are problems with the pragma no-cache method, which can
be solved by adding an extra head-tag with the pragma meta setting,
after the </body>
I've never tried that though.
Interesting that this is exactly what is said at
http://www.htmlgoodies.com/beyond/reference/article.php/3472881
but with a bit more detail.
Thank you Mikael
--
Regards,
Alf Stockton www.stockton.co.za
Suspicion always haunts the guilty mind.
-- Wm. Shakespeare
My email disclaimer is available at www.stockton.co.za/disclaimer.html
--- End Message ---
--- Begin Message ---
Alf
I had a similar problem trying to expire pages so that the user received
a "Page Expired" message when they clicked on the back button. I
discovered that if you set Cache-control to no-cache then Firefox/IE
ignore the expires date. The solution that I got working on IE7 was to
set Cache-control to must-revalidate and Expires to 1 second into the
future.
Firefox still didn't do what I wanted and I didn't test IE6.
Rich
PS: I was doing this through HTTP headers.
On Thu, 2007-04-12 at 13:57 +0200, Alf Stockton wrote:
> I have set:-
> <meta http-equiv="cache-control" content="no-cache">
> <meta http-equiv="expires" content="Mon, 22 Jul 2000 11:12:01 GMT"
> in the header are of all my pages but still until the user does a reload
> in both IE & Firefox they do not see the new screen.
> Please tell me what else I can do to force the browser to not cache
> anything ever.
> I am not in a position of altering the client browser settings despite
> this being an intranet system.
>
> --
> Regards,
> Alf Stockton www.stockton.co.za
>
> Q: What's yellow, and equivalent to the Axiom of Choice?
> A: Zorn's Lemon.
> My email disclaimer is available at www.stockton.co.za/disclaimer.html
>
--
Rich Buggy
[EMAIL PROTECTED]
http://www.buggy.id.au/
--- End Message ---