Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #5032 > unrolled thread

Name of page itself?

Started bySonnich Jensen <sonnichjensen@gmail.com>
First post2012-02-28 01:58 -0800
Last post2012-03-01 15:23 +0000
Articles 20 — 13 participants

Back to article view | Back to comp.lang.php


Contents

  Name of page itself? Sonnich Jensen <sonnichjensen@gmail.com> - 2012-02-28 01:58 -0800
    Re: Name of page itself? tdk2fe <tdkrupinski@gmail.com> - 2012-02-28 02:14 -0800
    Re: Name of page itself? crankypuss <no@email.thanks> - 2012-02-28 03:23 -0700
    Re: Name of page itself? bill <nobody@spamcop.net> - 2012-02-28 08:50 -0500
      Re: Name of page itself? Scott Johnson <noonehome@chalupasworld.com> - 2012-03-01 06:02 -0800
    Re: Name of page itself? Captain Paralytic <paul_lautman@yahoo.com> - 2012-03-01 03:16 -0800
      Re: Name of page itself? Tim Streater <timstreater@greenbee.net> - 2012-03-01 12:15 +0000
        Re: Name of page itself? The Natural Philosopher <tnp@invalid.invalid> - 2012-03-01 12:57 +0000
          Re: Name of page itself? Paul Herber <paul@pherber.com> - 2012-03-01 13:54 +0000
            Re: Name of page itself? Paul Herber <paul@pherber.com> - 2012-03-01 13:59 +0000
            Re: Name of page itself? The Natural Philosopher <tnp@invalid.invalid> - 2012-03-01 14:06 +0000
            Re: Name of page itself? Jerry Stuckle <jstucklex@attglobal.net> - 2012-03-01 10:05 -0500
          Re: Name of page itself? Scott Johnson <noonehome@chalupasworld.com> - 2012-03-01 06:04 -0800
            Re: Name of page itself? The Natural Philosopher <tnp@invalid.invalid> - 2012-03-01 14:10 +0000
              Re: Name of page itself? Tim Streater <timstreater@greenbee.net> - 2012-03-01 17:05 +0000
              Re: Name of page itself? Scott Johnson <noonehome@chalupasworld.com> - 2012-03-01 15:28 -0800
          Re: Name of page itself? Tim Streater <timstreater@greenbee.net> - 2012-03-01 17:01 +0000
          Re: Name of page itself? Arno Welzel <usenet@arnowelzel.de> - 2012-03-02 18:31 +0100
    Re: Name of page itself? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-03-01 13:01 +0100
    Re: Name of page itself? Denis McMahon <denismfmcmahon@gmail.com> - 2012-03-01 15:23 +0000

#5032 — Name of page itself?

FromSonnich Jensen <sonnichjensen@gmail.com>
Date2012-02-28 01:58 -0800
SubjectName of page itself?
Message-ID<29234465-827c-4372-9dc7-d9322fb4703e@m2g2000vbc.googlegroups.com>
Hi

I have not worked with PHP for 2+ years, now again and need to refill
my brain...

How can I get the name of the main page?

Say, index.php includes menu.php, how do I get the name of the main
page, in this case index.php?
Next say page1.php, page2.php etc?

Sonnich

[toc] | [next] | [standalone]


#5034

Fromtdk2fe <tdkrupinski@gmail.com>
Date2012-02-28 02:14 -0800
Message-ID<22893962.4680.1330424093955.JavaMail.geo-discussion-forums@ynbo36>
In reply to#5032
Magic constants - in this case __FILE__.

http://php.net/manual/en/language.constants.predefined.php

On Tuesday, February 28, 2012 3:58:03 AM UTC-6, Sonnich Jensen wrote:
> Hi
> 
> I have not worked with PHP for 2+ years, now again and need to refill
> my brain...
> 
> How can I get the name of the main page?
> 
> Say, index.php includes menu.php, how do I get the name of the main
> page, in this case index.php?
> Next say page1.php, page2.php etc?
> 
> Sonnich

[toc] | [prev] | [next] | [standalone]


#5035

Fromcrankypuss <no@email.thanks>
Date2012-02-28 03:23 -0700
Message-ID<jii9uo01teb@news6.newsguy.com>
In reply to#5032
On 02/28/2012 02:58 AM, Sonnich Jensen wrote:
> Hi
>
> I have not worked with PHP for 2+ years, now again and need to refill
> my brain...
>
> How can I get the name of the main page?
>
> Say, index.php includes menu.php, how do I get the name of the main
> page, in this case index.php?
> Next say page1.php, page2.php etc?
>
> Sonnich

There is really no way to answer that question in an absolute sense, for 
example the "main page" for my web code is "index.php" and *everything* 
goes through that.

If you're working with the usual stuff out of the box, you can use 
phpinfo() to see which variable you'd like to use to figure out what 
you're dealing with... look at things like $_SERVER["DOCUMENT_ROOT"], 
$_SERVER["SCRIPT_FILENAME"], $_SERVER["SCRIPT_NAME"], 
$_SERVER["PHP_SELF"] for starters.

[toc] | [prev] | [next] | [standalone]


#5037

Frombill <nobody@spamcop.net>
Date2012-02-28 08:50 -0500
Message-ID<M6SdnYuS6JcvRtHSnZ2dnUVZ_t-dnZ2d@cablespeedmi.com>
In reply to#5032
On 2/28/2012 4:58 AM, Sonnich Jensen wrote:
> Hi
>
> I have not worked with PHP for 2+ years, now again and need to refill
> my brain...
>
> How can I get the name of the main page?
>
> Say, index.php includes menu.php, how do I get the name of the main
> page, in this case index.php?
> Next say page1.php, page2.php etc?
>
> Sonnich

I use: basename(__FILE__)

[toc] | [prev] | [next] | [standalone]


#5058

FromScott Johnson <noonehome@chalupasworld.com>
Date2012-03-01 06:02 -0800
Message-ID<jinvi3$3ra$1@dont-email.me>
In reply to#5037
On 2/28/2012 5:50 AM, bill wrote:
> On 2/28/2012 4:58 AM, Sonnich Jensen wrote:
>> Hi
>>
>> I have not worked with PHP for 2+ years, now again and need to refill
>> my brain...
>>
>> How can I get the name of the main page?
>>
>> Say, index.php includes menu.php, how do I get the name of the main
>> page, in this case index.php?
>> Next say page1.php, page2.php etc?
>>
>> Sonnich
>
> I use: basename(__FILE__)

Actually __FILE__ may not give you the results you expect all depending 
on where it is processed.

It will hold the value of the actual page where it is located which 
could not be the actual page being displayed but in a script called by 
the display page.

This would be common for display page to have an included file which 
lets say has a link back to the itself.  Using __FILE__ on the 
processing page will then link it to the actual processing page rather 
then the display page.  In this case using $_SERVER vars mentioned 
earlier would give predictable results (again depending on the server, 
for instance my dev box does not return URI but the production box does) 
but I do believe 'PHP_SELF' is more predictable.

Now a very good use for __FILE__ would be error routines/messages along 
with __LINE__ and others to help report errors on an actual script page.

[toc] | [prev] | [next] | [standalone]


#5047

FromCaptain Paralytic <paul_lautman@yahoo.com>
Date2012-03-01 03:16 -0800
Message-ID<f244fbdd-78f1-48b4-a578-635b97e4dbde@gr6g2000vbb.googlegroups.com>
In reply to#5032
On Feb 28, 9:58 am, Sonnich Jensen <sonnichjen...@gmail.com> wrote:
> Hi
>
> I have not worked with PHP for 2+ years, now again and need to refill
> my brain...
>
> How can I get the name of the main page?
>
> Say, index.php includes menu.php, how do I get the name of the main
> page, in this case index.php?
> Next say page1.php, page2.php etc?
>
> Sonnich

A php file is NOT the same as a web page. A single php file may have
the ability to generate more than one page. Alternatively many php
files may be used to generate 1 page.

Can you explain why you need to get this information? Then we might be
able to help you get the information that you need.

[toc] | [prev] | [next] | [standalone]


#5051

FromTim Streater <timstreater@greenbee.net>
Date2012-03-01 12:15 +0000
Message-ID<timstreater-0B8191.12153501032012@news.individual.net>
In reply to#5047
In article 
<f244fbdd-78f1-48b4-a578-635b97e4dbde@gr6g2000vbb.googlegroups.com>,
 Captain Paralytic <paul_lautman@yahoo.com> wrote:

> On Feb 28, 9:58 am, Sonnich Jensen <sonnichjen...@gmail.com> wrote:

> > I have not worked with PHP for 2+ years, now again and need to refill
> > my brain...
> >
> > How can I get the name of the main page?
> >
> > Say, index.php includes menu.php, how do I get the name of the main
> > page, in this case index.php?
> > Next say page1.php, page2.php etc?

> A php file is NOT the same as a web page. A single php file may have
> the ability to generate more than one page. Alternatively many php
> files may be used to generate 1 page.

Or it might generate no pages at all. None of mine do.

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#5053

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2012-03-01 12:57 +0000
Message-ID<jinrnq$ga5$2@news.albasani.net>
In reply to#5051
Tim Streater wrote:
> In article 
> <f244fbdd-78f1-48b4-a578-635b97e4dbde@gr6g2000vbb.googlegroups.com>,
> Captain Paralytic <paul_lautman@yahoo.com> wrote:
> 
>> On Feb 28, 9:58 am, Sonnich Jensen <sonnichjen...@gmail.com> wrote:
> 
>> > I have not worked with PHP for 2+ years, now again and need to refill
>> > my brain...
>> >
>> > How can I get the name of the main page?
>> >
>> > Say, index.php includes menu.php, how do I get the name of the main
>> > page, in this case index.php?
>> > Next say page1.php, page2.php etc?
> 
>> A php file is NOT the same as a web page. A single php file may have
>> the ability to generate more than one page. Alternatively many php
>> files may be used to generate 1 page.
> 
> Or it might generate no pages at all. None of mine do.
> 

Fabulous. Write only memory in the computer as well?
Talking of the wrong tool for the job, I once heard of a man trying to 
build a battleship out of papier mache.




-- 
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.

[toc] | [prev] | [next] | [standalone]


#5056

FromPaul Herber <paul@pherber.com>
Date2012-03-01 13:54 +0000
Message-ID<vfvuk7p2a506tn3j1j23ke0g972ri08frk@news.eternal-september.org>
In reply to#5053
On Thu, 01 Mar 2012 12:57:30 +0000, The Natural Philosopher <tnp@invalid.invalid> wrote:

>Tim Streater wrote:
>> In article 
>> <f244fbdd-78f1-48b4-a578-635b97e4dbde@gr6g2000vbb.googlegroups.com>,
>> Captain Paralytic <paul_lautman@yahoo.com> wrote:
>> 
>>> On Feb 28, 9:58 am, Sonnich Jensen <sonnichjen...@gmail.com> wrote:
>> 
>>> > I have not worked with PHP for 2+ years, now again and need to refill
>>> > my brain...
>>> >
>>> > How can I get the name of the main page?
>>> >
>>> > Say, index.php includes menu.php, how do I get the name of the main
>>> > page, in this case index.php?
>>> > Next say page1.php, page2.php etc?
>> 
>>> A php file is NOT the same as a web page. A single php file may have
>>> the ability to generate more than one page. Alternatively many php
>>> files may be used to generate 1 page.
>> 
>> Or it might generate no pages at all. None of mine do.
>> 
>
>Fabulous. Write only memory in the computer as well?

Nothing unusual about a PHP script that generates no output. How about a script that
receives an IPN email, updates a database and sends out an email. No web browser involved
at all.
Cron can start PHP scripts ...



-- 
Regards, Paul Herber, Sandrila Ltd.
http://www.sandrila.co.uk/          

[toc] | [prev] | [next] | [standalone]


#5057

FromPaul Herber <paul@pherber.com>
Date2012-03-01 13:59 +0000
Message-ID<g40vk7hh6dm53a989rvv2kkpaou5qhnpuu@news.eternal-september.org>
In reply to#5056
On Thu, 01 Mar 2012 13:54:12 +0000, Paul Herber <paul@pherber.com> wrote:

>Nothing unusual about a PHP script that generates no output. How about a script that
>receives an IPN email, updates a database and sends out an email. No web browser involved
>at all.
>Cron can start PHP scripts ...

s/IPN email,/IPN,/

[toc] | [prev] | [next] | [standalone]


#5062

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2012-03-01 14:06 +0000
Message-ID<jinvpo$nm2$2@news.albasani.net>
In reply to#5056
Paul Herber wrote:
> On Thu, 01 Mar 2012 12:57:30 +0000, The Natural Philosopher <tnp@invalid.invalid> wrote:
> 
>> Tim Streater wrote:
>>> In article 
>>> <f244fbdd-78f1-48b4-a578-635b97e4dbde@gr6g2000vbb.googlegroups.com>,
>>> Captain Paralytic <paul_lautman@yahoo.com> wrote:
>>>
>>>> On Feb 28, 9:58 am, Sonnich Jensen <sonnichjen...@gmail.com> wrote:
>>>>> I have not worked with PHP for 2+ years, now again and need to refill
>>>>> my brain...
>>>>>
>>>>> How can I get the name of the main page?
>>>>>
>>>>> Say, index.php includes menu.php, how do I get the name of the main
>>>>> page, in this case index.php?
>>>>> Next say page1.php, page2.php etc?
>>>> A php file is NOT the same as a web page. A single php file may have
>>>> the ability to generate more than one page. Alternatively many php
>>>> files may be used to generate 1 page.
>>> Or it might generate no pages at all. None of mine do.
>>>
>> Fabulous. Write only memory in the computer as well?
> 
> Nothing unusual about a PHP script that generates no output. How about a script that
> receives an IPN email, updates a database and sends out an email. No web browser involved
> at all.
> Cron can start PHP scripts ...
> 
> 
> 
and you CAN build battleships out of papier mache.

which was the point..


-- 
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.

[toc] | [prev] | [next] | [standalone]


#5065

FromJerry Stuckle <jstucklex@attglobal.net>
Date2012-03-01 10:05 -0500
Message-ID<jio38c$o43$1@dont-email.me>
In reply to#5056
On 3/1/2012 8:54 AM, Paul Herber wrote:
> On Thu, 01 Mar 2012 12:57:30 +0000, The Natural Philosopher<tnp@invalid.invalid>  wrote:
>
>> Tim Streater wrote:
>>> In article
>>> <f244fbdd-78f1-48b4-a578-635b97e4dbde@gr6g2000vbb.googlegroups.com>,
>>> Captain Paralytic<paul_lautman@yahoo.com>  wrote:
>>>
>>>> On Feb 28, 9:58 am, Sonnich Jensen<sonnichjen...@gmail.com>  wrote:
>>>
>>>>> I have not worked with PHP for 2+ years, now again and need to refill
>>>>> my brain...
>>>>>
>>>>> How can I get the name of the main page?
>>>>>
>>>>> Say, index.php includes menu.php, how do I get the name of the main
>>>>> page, in this case index.php?
>>>>> Next say page1.php, page2.php etc?
>>>
>>>> A php file is NOT the same as a web page. A single php file may have
>>>> the ability to generate more than one page. Alternatively many php
>>>> files may be used to generate 1 page.
>>>
>>> Or it might generate no pages at all. None of mine do.
>>>
>>
>> Fabulous. Write only memory in the computer as well?
>
> Nothing unusual about a PHP script that generates no output. How about a script that
> receives an IPN email, updates a database and sends out an email. No web browser involved
> at all.
> Cron can start PHP scripts ...
>
>
>

Paul, you're arguing with an idiot.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#5059

FromScott Johnson <noonehome@chalupasworld.com>
Date2012-03-01 06:04 -0800
Message-ID<jinvl5$3ra$2@dont-email.me>
In reply to#5053
On 3/1/2012 4:57 AM, The Natural Philosopher wrote:
> Tim Streater wrote:
>> In article
>> <f244fbdd-78f1-48b4-a578-635b97e4dbde@gr6g2000vbb.googlegroups.com>,
>> Captain Paralytic <paul_lautman@yahoo.com> wrote:
>>
>>> On Feb 28, 9:58 am, Sonnich Jensen <sonnichjen...@gmail.com> wrote:
>>
>>> > I have not worked with PHP for 2+ years, now again and need to refill
>>> > my brain...
>>> >
>>> > How can I get the name of the main page?
>>> >
>>> > Say, index.php includes menu.php, how do I get the name of the main
>>> > page, in this case index.php?
>>> > Next say page1.php, page2.php etc?
>>
>>> A php file is NOT the same as a web page. A single php file may have
>>> the ability to generate more than one page. Alternatively many php
>>> files may be used to generate 1 page.
>>
>> Or it might generate no pages at all. None of mine do.
>>
>
> Fabulous. Write only memory in the computer as well?
> Talking of the wrong tool for the job, I once heard of a man trying to
> build a battleship out of papier mache.
>
>
>
>

Hmmm.

Seems sort of a shortsighted comment.

What would you use for doing something for example as simple as MySQL DB 
maintenance from a cron job?

But also I would have to say if you are using PHP, then the display page 
would indeed have php code on it (even as simple as a single line 
include/require) in which case pulling the page name is going to be the 
same.

And if the battleship is only a display model on a small shelf then 
paper mache seems feasible.

[toc] | [prev] | [next] | [standalone]


#5063

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2012-03-01 14:10 +0000
Message-ID<jio011$oor$1@news.albasani.net>
In reply to#5059
Scott Johnson wrote:
> On 3/1/2012 4:57 AM, The Natural Philosopher wrote:
>> Tim Streater wrote:
>>> In article
>>> <f244fbdd-78f1-48b4-a578-635b97e4dbde@gr6g2000vbb.googlegroups.com>,
>>> Captain Paralytic <paul_lautman@yahoo.com> wrote:
>>>
>>>> On Feb 28, 9:58 am, Sonnich Jensen <sonnichjen...@gmail.com> wrote:
>>>
>>>> > I have not worked with PHP for 2+ years, now again and need to refill
>>>> > my brain...
>>>> >
>>>> > How can I get the name of the main page?
>>>> >
>>>> > Say, index.php includes menu.php, how do I get the name of the main
>>>> > page, in this case index.php?
>>>> > Next say page1.php, page2.php etc?
>>>
>>>> A php file is NOT the same as a web page. A single php file may have
>>>> the ability to generate more than one page. Alternatively many php
>>>> files may be used to generate 1 page.
>>>
>>> Or it might generate no pages at all. None of mine do.
>>>
>>
>> Fabulous. Write only memory in the computer as well?
>> Talking of the wrong tool for the job, I once heard of a man trying to
>> build a battleship out of papier mache.
>>
>>
>>
>>
> 
> Hmmm.
> 
> Seems sort of a shortsighted comment.
> 
> What would you use for doing something for example as simple as MySQL DB 
> maintenance from a cron job?

C, script? anyone of a zillion better tools than PHP..
Currently I use C.


> 
> But also I would have to say if you are using PHP, then the display page 
> would indeed have php code on it (even as simple as a single line 
> include/require) in which case pulling the page name is going to be the 
> same.
> 
> And if the battleship is only a display model on a small shelf then 
> paper mache seems feasible.

You would be surprised actually at how tough a material it is.

Ok its not quite carbon fibre..laminate.. but actually if you had 
nothing else, it WOULD work.

Which is my point. PHP is not a particularly brilliant language. There 
are better, for all other applications that do NOT expect you to 
routinely switch between echoed output and simple-style coding.

Why not use one?



-- 
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.

[toc] | [prev] | [next] | [standalone]


#5069

FromTim Streater <timstreater@greenbee.net>
Date2012-03-01 17:05 +0000
Message-ID<timstreater-EB6B61.17050901032012@news.individual.net>
In reply to#5063
In article <jio011$oor$1@news.albasani.net>,
 The Natural Philosopher <tnp@invalid.invalid> wrote:

> Scott Johnson wrote:
> > On 3/1/2012 4:57 AM, The Natural Philosopher wrote:
> >> Tim Streater wrote:

> >>> Or it might generate no pages at all. None of mine do.

> >> Fabulous. Write only memory in the computer as well?
> >> Talking of the wrong tool for the job, I once heard of a man trying to
> >> build a battleship out of papier mache.

> > Seems sort of a shortsighted comment.
> > 
> > What would you use for doing something for example as simple as MySQL DB 
> > maintenance from a cron job?
> 
> C, script? anyone of a zillion better tools than PHP..
> Currently I use C.

> > And if the battleship is only a display model on a small shelf then 
> > paper mache seems feasible.
> 
> You would be surprised actually at how tough a material it is.
> 
> Ok its not quite carbon fibre..laminate.. but actually if you had 
> nothing else, it WOULD work.
> 
> Which is my point. PHP is not a particularly brilliant language. There 
> are better, for all other applications that do NOT expect you to 
> routinely switch between echoed output and simple-style coding.
> 
> Why not use one?

Because as I mentioned before I can no longer be arsed. PHP is quite 
fast enough. I certainly don't want to fart about doing string handling 
or manipulation in C.

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#5073

FromScott Johnson <noonehome@chalupasworld.com>
Date2012-03-01 15:28 -0800
Message-ID<jip0mr$hs8$1@dont-email.me>
In reply to#5063
On 3/1/2012 6:10 AM, The Natural Philosopher wrote:
> Scott Johnson wrote:
>> On 3/1/2012 4:57 AM, The Natural Philosopher wrote:
>>> Tim Streater wrote:
>>>> In article
>>>> <f244fbdd-78f1-48b4-a578-635b97e4dbde@gr6g2000vbb.googlegroups.com>,
>>>> Captain Paralytic <paul_lautman@yahoo.com> wrote:
>>>>
>>>>> On Feb 28, 9:58 am, Sonnich Jensen <sonnichjen...@gmail.com> wrote:
>>>>
>>>>> > I have not worked with PHP for 2+ years, now again and need to
>>>>> refill
>>>>> > my brain...
>>>>> >
>>>>> > How can I get the name of the main page?
>>>>> >
>>>>> > Say, index.php includes menu.php, how do I get the name of the main
>>>>> > page, in this case index.php?
>>>>> > Next say page1.php, page2.php etc?
>>>>
>>>>> A php file is NOT the same as a web page. A single php file may have
>>>>> the ability to generate more than one page. Alternatively many php
>>>>> files may be used to generate 1 page.
>>>>
>>>> Or it might generate no pages at all. None of mine do.
>>>>
>>>
>>> Fabulous. Write only memory in the computer as well?
>>> Talking of the wrong tool for the job, I once heard of a man trying to
>>> build a battleship out of papier mache.
>>>
>>>
>>>
>>>
>>
>> Hmmm.
>>
>> Seems sort of a shortsighted comment.
>>
>> What would you use for doing something for example as simple as MySQL
>> DB maintenance from a cron job?
>
> C, script? anyone of a zillion better tools than PHP..
> Currently I use C.
>
>
>>
>> But also I would have to say if you are using PHP, then the display
>> page would indeed have php code on it (even as simple as a single line
>> include/require) in which case pulling the page name is going to be
>> the same.
>>
>> And if the battleship is only a display model on a small shelf then
>> paper mache seems feasible.
>
> You would be surprised actually at how tough a material it is.
>
> Ok its not quite carbon fibre..laminate.. but actually if you had
> nothing else, it WOULD work.
>
> Which is my point. PHP is not a particularly brilliant language. There
> are better, for all other applications that do NOT expect you to
> routinely switch between echoed output and simple-style coding.
>
> Why not use one?
>
>
>
  Why not use C, script?  Well if all your classes are coded in PHP why 
not use those same classes in your cron job?  That way as the needs of 
the project such as a DB change, you only need to focus on the changes 
in the PHP class and not ensure your C or zillion other scripts are 
changed accordingly.

[toc] | [prev] | [next] | [standalone]


#5068

FromTim Streater <timstreater@greenbee.net>
Date2012-03-01 17:01 +0000
Message-ID<timstreater-C8BBB9.17014501032012@news.individual.net>
In reply to#5053
In article <jinrnq$ga5$2@news.albasani.net>,
 The Natural Philosopher <tnp@invalid.invalid> wrote:

> Tim Streater wrote:
> > In article 
> > <f244fbdd-78f1-48b4-a578-635b97e4dbde@gr6g2000vbb.googlegroups.com>,
> > Captain Paralytic <paul_lautman@yahoo.com> wrote:
> > 
> >> On Feb 28, 9:58 am, Sonnich Jensen <sonnichjen...@gmail.com> wrote:
> > 
> >> > I have not worked with PHP for 2+ years, now again and need to refill
> >> > my brain...
> >> >
> >> > How can I get the name of the main page?
> >> >
> >> > Say, index.php includes menu.php, how do I get the name of the main
> >> > page, in this case index.php?
> >> > Next say page1.php, page2.php etc?
> > 
> >> A php file is NOT the same as a web page. A single php file may have
> >> the ability to generate more than one page. Alternatively many php
> >> files may be used to generate 1 page.
> > 
> > Or it might generate no pages at all. None of mine do.

> Fabulous. Write only memory in the computer as well?

Oy just watch it. Mine generate no web pages because:

1) They are CLI scripts which do things such as check for or create 
certain SQLite databases, and then launch apache and Safari.

or:

2) They are asked, by the browser, via AJAX, to do certain things like 
read/write SQLite databases, communicate with remote hosts, and report 
results back to the browser. Which proceeds to update the already 
existing page based on those results.

In fact I may go through and remove all the <form></form>, since no 
<form> is ever submitted. AIUI, elements such as <button> etc would work 
just as well anyway.

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#5079

FromArno Welzel <usenet@arnowelzel.de>
Date2012-03-02 18:31 +0100
Message-ID<4F5103DA.6060801@arnowelzel.de>
In reply to#5053
The Natural Philosopher, 2012-03-01 13:57:

> Tim Streater wrote:
>> In article
>> <f244fbdd-78f1-48b4-a578-635b97e4dbde@gr6g2000vbb.googlegroups.com>,
>> Captain Paralytic <paul_lautman@yahoo.com> wrote:
>>
>>> On Feb 28, 9:58 am, Sonnich Jensen <sonnichjen...@gmail.com> wrote:
>>
>>> > I have not worked with PHP for 2+ years, now again and need to refill
>>> > my brain...
>>> >
>>> > How can I get the name of the main page?
>>> >
>>> > Say, index.php includes menu.php, how do I get the name of the main
>>> > page, in this case index.php?
>>> > Next say page1.php, page2.php etc?
>>
>>> A php file is NOT the same as a web page. A single php file may have
>>> the ability to generate more than one page. Alternatively many php
>>> files may be used to generate 1 page.
>>
>> Or it might generate no pages at all. None of mine do.
>>
> 
> Fabulous. Write only memory in the computer as well?
> Talking of the wrong tool for the job, I once heard of a man trying to
> build a battleship out of papier mache.

XAseco is a good example. And Nadeo has quite extensive examples how to
use the RPC interface of Trackmania with PHP ;-)


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

[toc] | [prev] | [next] | [standalone]


#5049

From"Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Date2012-03-01 13:01 +0100
Message-ID<jinoe7$rua$1@dont-email.me>
In reply to#5032
El 28/02/2012 10:58, Sonnich Jensen escribió/wrote:
> I have not worked with PHP for 2+ years, now again and need to refill
> my brain...
>
> How can I get the name of the main page?
>
> Say, index.php includes menu.php, how do I get the name of the main
> page, in this case index.php?

If I understood correctly, it'll be one of these:

     $_SERVER['SCRIPT_FILENAME']
     $_SERVER['SCRIPT_NAME']
     $_SERVER['PHP_SELF']

Please note that they all refer to the _file_ name (which can show up 
the URL or not).

If it isn't any of them:

	print_r($_SERVER);

> Next say page1.php, page2.php etc?

No entiendo :-?


-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

[toc] | [prev] | [next] | [standalone]


#5066

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2012-03-01 15:23 +0000
Message-ID<4f4f946e$0$4361$a8266bb1@newsreader.readnews.com>
In reply to#5032
On Tue, 28 Feb 2012 01:58:03 -0800, Sonnich Jensen wrote:

> I have not worked with PHP for 2+ years, now again and need to refill my
> brain...
> 
> How can I get the name of the main page?
> 
> Say, index.php includes menu.php, how do I get the name of the main
> page, in this case index.php?
> Next say page1.php, page2.php etc?

I'm not sure quite what you mean.

Do you (a) just want the trailing filename, or do you want the trailing 
filename relative to some arbitrary point in (b) the local file 
structure, or (c) an http request url?

The reason I ask is twofold:

1) You don't clarify whether you expect filenames in sub directories to 
include path information or not. I could assume you do, I could assume 
you don't, instead I choose to confirm your expectation in such 
circumstances.

2) If you do expect path information, then although for "http://host/
file" where "file" is at "<docroot>/file", "file" will generally be the 
same for a, b and c, and in many webservers this is probably the case, 
there are probably also many webservers where due to directory aliasing 
in the server, or the use of links (is shortcuts what Ms calls them?) in 
the file system and directory structure, or for some other reason, the 
filename, the "path+file" url components and the actual filesystem 
location of the file (whether absolute or relative to some arbitrary 
point) may bear no obvious relationship whatsoever to each other.

Hence, although I see many answers in this thread that address a flat 
single directory situation, I'm not 100% sure, partly because I'm not 
sure what you actually expect in such cases, that they will give the 
answers you expect in every situation in which you might conceivably 
deploy them.

Rgds

Denis McMahon

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web