FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Name of page itself?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Name of page itself? [message #177213] Tue, 28 February 2012 09:58 Go to next message
Sonnich Jensen is currently offline  Sonnich Jensen
Messages: 4
Registered: February 2012
Karma: 0
Junior Member
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
Re: Name of page itself? [message #177215 is a reply to message #177213] Tue, 28 February 2012 10:14 Go to previous messageGo to next message
tdk2fe is currently offline  tdk2fe
Messages: 1
Registered: February 2012
Karma: 0
Junior Member
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
Re: Name of page itself? [message #177216 is a reply to message #177213] Tue, 28 February 2012 10:23 Go to previous messageGo to next message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma: 0
Senior Member
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.
Re: Name of page itself? [message #177218 is a reply to message #177213] Tue, 28 February 2012 13:50 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
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__)
Re: Name of page itself? [message #177229 is a reply to message #177213] Thu, 01 March 2012 11:16 Go to previous messageGo to next message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
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.
Re: Name of page itself? [message #177231 is a reply to message #177213] Thu, 01 March 2012 12:01 Go to previous messageGo to next message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma: 0
Senior Member
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
--
Re: Name of page itself? [message #177233 is a reply to message #177229] Thu, 01 March 2012 12:15 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article
<f244fbdd-78f1-48b4-a578-635b97e4dbde(at)gr6g2000vbb(dot)googlegroups(dot)com>,
Captain Paralytic <paul_lautman(at)yahoo(dot)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
Re: Name of page itself? [message #177235 is a reply to message #177233] Thu, 01 March 2012 12:57 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Tim Streater wrote:
> In article
> <f244fbdd-78f1-48b4-a578-635b97e4dbde(at)gr6g2000vbb(dot)googlegroups(dot)com>,
> Captain Paralytic <paul_lautman(at)yahoo(dot)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.
Re: Name of page itself? [message #177238 is a reply to message #177235] Thu, 01 March 2012 13:54 Go to previous messageGo to next message
Paul Herber is currently offline  Paul Herber
Messages: 26
Registered: February 2011
Karma: 0
Junior Member
On Thu, 01 Mar 2012 12:57:30 +0000, The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:

> Tim Streater wrote:
>> In article
>> <f244fbdd-78f1-48b4-a578-635b97e4dbde(at)gr6g2000vbb(dot)googlegroups(dot)com>,
>> Captain Paralytic <paul_lautman(at)yahoo(dot)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/
Re: Name of page itself? [message #177239 is a reply to message #177238] Thu, 01 March 2012 13:59 Go to previous messageGo to next message
Paul Herber is currently offline  Paul Herber
Messages: 26
Registered: February 2011
Karma: 0
Junior Member
On Thu, 01 Mar 2012 13:54:12 +0000, Paul Herber <paul(at)pherber(dot)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,/
Re: Name of page itself? [message #177240 is a reply to message #177218] Thu, 01 March 2012 14:02 Go to previous messageGo to next message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
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.
Re: Name of page itself? [message #177241 is a reply to message #177235] Thu, 01 March 2012 14:04 Go to previous messageGo to next message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
On 3/1/2012 4:57 AM, The Natural Philosopher wrote:
> Tim Streater wrote:
>> In article
>> <f244fbdd-78f1-48b4-a578-635b97e4dbde(at)gr6g2000vbb(dot)googlegroups(dot)com>,
>> Captain Paralytic <paul_lautman(at)yahoo(dot)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.
Re: Name of page itself? [message #177244 is a reply to message #177238] Thu, 01 March 2012 14:06 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Paul Herber wrote:
> On Thu, 01 Mar 2012 12:57:30 +0000, The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>
>> Tim Streater wrote:
>>> In article
>>> <f244fbdd-78f1-48b4-a578-635b97e4dbde(at)gr6g2000vbb(dot)googlegroups(dot)com>,
>>> Captain Paralytic <paul_lautman(at)yahoo(dot)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.
Re: Name of page itself? [message #177245 is a reply to message #177241] Thu, 01 March 2012 14:10 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Scott Johnson wrote:
> On 3/1/2012 4:57 AM, The Natural Philosopher wrote:
>> Tim Streater wrote:
>>> In article
>>> <f244fbdd-78f1-48b4-a578-635b97e4dbde(at)gr6g2000vbb(dot)googlegroups(dot)com>,
>>> Captain Paralytic <paul_lautman(at)yahoo(dot)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.
Re: Name of page itself? [message #177247 is a reply to message #177238] Thu, 01 March 2012 15:05 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 3/1/2012 8:54 AM, Paul Herber wrote:
> On Thu, 01 Mar 2012 12:57:30 +0000, The Natural Philosopher<tnp(at)invalid(dot)invalid> wrote:
>
>> Tim Streater wrote:
>>> In article
>>> <f244fbdd-78f1-48b4-a578-635b97e4dbde(at)gr6g2000vbb(dot)googlegroups(dot)com>,
>>> Captain Paralytic<paul_lautman(at)yahoo(dot)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(at)attglobal(dot)net
==================
Re: Name of page itself? [message #177248 is a reply to message #177213] Thu, 01 March 2012 15:23 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
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
Re: Name of page itself? [message #177252 is a reply to message #177235] Thu, 01 March 2012 17:01 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <jinrnq$ga5$2(at)news(dot)albasani(dot)net>,
The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:

> Tim Streater wrote:
>> In article
>> <f244fbdd-78f1-48b4-a578-635b97e4dbde(at)gr6g2000vbb(dot)googlegroups(dot)com>,
>> Captain Paralytic <paul_lautman(at)yahoo(dot)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
Re: Name of page itself? [message #177253 is a reply to message #177245] Thu, 01 March 2012 17:05 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <jio011$oor$1(at)news(dot)albasani(dot)net>,
The Natural Philosopher <tnp(at)invalid(dot)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
Re: Name of page itself? [message #177257 is a reply to message #177245] Thu, 01 March 2012 23:28 Go to previous messageGo to next message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
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(at)gr6g2000vbb(dot)googlegroups(dot)com>,
>>>> Captain Paralytic <paul_lautman(at)yahoo(dot)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.
Re: Name of page itself? [message #177263 is a reply to message #177235] Fri, 02 March 2012 17:31 Go to previous message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma: 0
Senior Member
The Natural Philosopher, 2012-03-01 13:57:

> Tim Streater wrote:
>> In article
>> <f244fbdd-78f1-48b4-a578-635b97e4dbde(at)gr6g2000vbb(dot)googlegroups(dot)com>,
>> Captain Paralytic <paul_lautman(at)yahoo(dot)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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: MAX(id)
Next Topic: string to array
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 18:10:14 GMT 2024

Total time taken to generate the page: 0.02708 seconds