php-general Digest 12 Sep 2009 08:23:23 -0000 Issue 6335

Topics (messages 297925 through 297945):

Re: APC - Upload progress problem. apc
        297925 by: tedd
        297926 by: Nathan Nobbe

User Account Management
        297927 by: Waynn Lue
        297931 by: Paul M Foster
        297935 by: Ben Dunlap
        297941 by: Lester Caine

Re: Reading files in PHP 5.3.0
        297928 by: Paul M Foster

Re: [Formaldehyde] The Most Basic Ajax - PHP Error Debugger
        297929 by: Andrea Giammarchi
        297930 by: Andrea Giammarchi
        297938 by: Paul M Foster
        297943 by: kranthi
        297944 by: kranthi
        297945 by: Andrea Giammarchi

Re: Creating alphanumeric id for a table
        297932 by: Lupus Michaelis
        297936 by: aveev

get an object property
        297933 by: Tom Worster
        297934 by: John Corry
        297939 by: Paul M Foster
        297942 by: Lars Torben Wilson

Fixing the path
        297937 by: Rico Secada
        297940 by: Paul M Foster

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
At 2:17 PM -0400 9/11/09, Eddie Drapkin wrote:
On Fri, Sep 11, 2009 at 1:02 PM, Phred White <phpl...@planetphred.com> wrote:
 Hey folks..

 > Anybody ever use APC to show upload progress?

Nope, I choose not to complicate my life.  :-)

Instead, I give the user one of these:

http://webbytedd.com/bb/wait/

Besides, what does the user have to know anyway that makes it so important that they see a progress bar?

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Fri, Sep 11, 2009 at 3:01 PM, tedd <tedd.sperl...@gmail.com> wrote:

> At 2:17 PM -0400 9/11/09, Eddie Drapkin wrote:
>
>> On Fri, Sep 11, 2009 at 1:02 PM, Phred White <phpl...@planetphred.com>
>> wrote:
>>
>>>  Hey folks..
>>>
>>>   > Anybody ever use APC to show upload progress?
>>
>
> Nope, I choose not to complicate my life.  :-)
>
> Instead, I give the user one of these:
>
> http://webbytedd.com/bb/wait/
>
> Besides, what does the user have to know anyway that makes it so important
> that they see a progress bar?
>

on things that take longer than a few seconds, the generic spinners are
pretty annoying, b/c youve no idea how much longer youve got to wait.

plus progress bars look more professional, imo.  anyways, tho, yeah,
spinners are better for most cases i would say.

-nathan

--- End Message ---
--- Begin Message ---
Hello all,

We're building out a system that allows for user account creation/password
management, and we're hoping to use existing open source software so we
don't have to reinvent the wheel.  I know of Drupal, and Zend Framework (and
maybe CodeIgniter?), but do people have specific preferences for either, and
recommendations for other products that I haven't heard of?  It should just
support basic account creation, being able to login/authenticate, change
your password, storing user information like names and email addresses, etc.

I tried searching for "account management php" but ended up getting a lot of
CMS suites.

Thanks,
Waynn

--- End Message ---
--- Begin Message ---
On Fri, Sep 11, 2009 at 02:43:15PM -0700, Waynn Lue wrote:

> Hello all,
> 
> We're building out a system that allows for user account creation/password
> management, and we're hoping to use existing open source software so we
> don't have to reinvent the wheel.  I know of Drupal, and Zend Framework (and
> maybe CodeIgniter?), but do people have specific preferences for either, and
> recommendations for other products that I haven't heard of?  It should just
> support basic account creation, being able to login/authenticate, change
> your password, storing user information like names and email addresses, etc.
> 
> I tried searching for "account management php" but ended up getting a lot of
> CMS suites.

It depends on how you want your security to be built. At phpclasses.org,
there are a bunch of classes which handle user verification and such.
(Of course, you have to build your own screens; these are just classes,
after all.) My problem with these classes is that they typically assign
users a number to indicate the user "level", and then you decide what
"level" is necessary to access a given page. Now, most of what I do is
programming for internal use. And my philosophy is that a user has no
business accessing *any* page they haven't been trained on. So my access
scheme is based on a system where there is a record in a table which has
the user ID and the page they're allowed to access. With a couple of
hundred pages, that's potentially a couple of hundred records per user.
It could be a pain to maintain, but provides the finest grained
authorization I can come up with.

If you don't need something that complex or solid, then some of the
classes at phpclasses.org may suffice.

CodeIgniter (as mentioned earlier this week) has no provision for user
login or security. The others probably do, but they're a bit like using
a steamroller to pound in a nail. Moreover, any framework like these
(even the very simple CodeIgniter) requires significant investment in
learning how to do things under that framework.

Honestly, whipping up a security scheme the way I have done it is a
couple of days' work (including login and management screens). I'm not
sure why people seem to be averse to it. You just work up your screens,
create your tables, populate the tables, and you're away. The user's ID
and whatever other pertinent information rides along with them in the
session variables. Each page checks to see if the user ID in the session
variable is allowed to access this page, etc.

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
> Honestly, whipping up a security scheme the way I have done it is a
> couple of days' work (including login and management screens). I'm not
> sure why people seem to be averse to it. You just work up your screens,

I suppose it does depend on the use case. If you're building a system
for internal use, and you know your users, and the data is potentially
exposed by other avenues (as is the case with all the internal-use
systems I've built), that's one thing.

But if the site is public, indexed by Google, and gets even a small
amount of traffic -- or even if it's an unpublicized site but it's on
a dedicated IP that belongs to a prominent hosting company -- it's
going to be hammered daily by script-kiddies and PC-based malware. If
it gets a lot of traffic it's probably going to be targeted by
sophisticated attackers.

At that point I'd personally be much more at ease knowing that
session-management, authentication, password-storage, etc. were
handled by a system that several more-experienced programmers have
worked on, which has gotten a good deal of production use in diverse
contexts, not to mention possible analysis by professional security
experts.

Security is complicated and it's very easy to get wrong. What hashing
algorithm do you use (in the general sense of "you") to store your
passwords?  Do you salt your passwords; if so, do you salt them
correctly? How do you handle password-resets? What's your PRNG, and is
it random enough, and how do you know?

I just reviewed the code for a scratch-built system that seemed to
have reasonably-intelligent authentication and password management --
but /completely left out/ access-control! All I had to do was enter a
different uid in the URL of the "my account" page and I could get to
anyone's account, even the admin's, as long as I was authenticated.

Dumb mistake? Sure. Easy to make? Probably more so than one would like to think.

Ben

--- End Message ---
--- Begin Message ---
Waynn Lue wrote:
Hello all,

We're building out a system that allows for user account creation/password
management, and we're hoping to use existing open source software so we
don't have to reinvent the wheel.  I know of Drupal, and Zend Framework (and
maybe CodeIgniter?), but do people have specific preferences for either, and
recommendations for other products that I haven't heard of?  It should just
support basic account creation, being able to login/authenticate, change
your password, storing user information like names and email addresses, etc.

I tried searching for "account management php" but ended up getting a lot of
CMS suites.

That is because this is a - how long is a piece of string type question ;)

PEAR has the AUTH package which is supposed to provide authentication, but still needs a certain amount of 'wrapping' to make it usable.

The question has to be 'What are you wanting to secure?'

Personally I'm using bitweaver - which is a CMS system, but I have my own modules added to it to provide the functions I want, while bitweaver itself provides user management, content editing with full history in various wiki or html formats, mime handling and all the other generic bits. You just add the bits you want, or pinch a module and adjust it to your own purposes - without needing to worry about the core functions :)

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
On Fri, Sep 11, 2009 at 08:38:13AM -0700, Tommy Pham wrote:

> --- On Fri, 9/11/09, Paul M Foster <pa...@quillandmouse.com> wrote:
> 
> > From: Paul M Foster <pa...@quillandmouse.com>
> > Subject: Re: [PHP] Reading files in PHP 5.3.0
> > To: php-gene...@lists.php.net
> > Date: Friday, September 11, 2009, 8:57 AM
> > On Fri, Sep 11, 2009 at 05:48:42AM
> > -0700, Tommy Pham wrote:
> > 
> > > 
> > > I just checked my 'Mail Options' again.  It's
> > always been 'compose as text'.  But I can't guaranteed
> > that Yahoo actually does it.  Been having problems with
> > Yahoo lately (both mail and Yahoo hosting of
> > www.php.net).  Maybe I should switch to gmail... 
> > 
> > I think I'm reading this wrong. Are you saying that php.net
> > is hosted
> > with *Yahoo*? WTF?
> > 
> > Paul
> 
> go to www.php.net.  scroll all way down to the bottom.
> 
> "This mirror generously provided by: Yahoo! Inc.
> Last updated: Fri Sep 11 14:51:27 2009 UTC"
> 

I typically use us2.php.net, which is hosted by Hurricane Electric.

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---


> Date: Fri, 11 Sep 2009 12:37:30 -0400
> To: an_...@hotmail.com; php-gene...@lists.php.net
> From: tedd.sperl...@gmail.com
> Subject: RE: [PHP] RE: [Formaldehyde] The Most Basic Ajax - PHP Error   
> Debugger
> The only 
> things that may go wrong are in the data I am sending to the ajax 
> routine AND/OR the way my php scripts deal with the data when they 
> receive it.

Formaldehyde tells you in the client debugger what was wrong in the php code 
indeed.
Did you actually read the page before you replied?



> Examine this:
> 
> http://webbytedd.com/a/ajax-site/js/a.js
> 
> Now, where can something go wrong?

In the PHP Page, that is what Formaldehyde is about!!!

_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

--- End Message ---
--- Begin Message ---
Exactly Ben, except when PHP fails, even with a Fatal Error, the page has 
status 200, we need to understand which call failed between hundreds of 
potential calls in the debugger, and errors could pass silently.

With Formaldehyde, accordingly with your predefined error_reporting level, 
above situation will never happen, and the entire process, without changing 
anything, will be much simpler, as Ben already described.

So yes Tedd, you did not even read what is Formaldehyde about ... please try to 
understand it before other comments, maybe you'll discover it's extremely 
simple, and hopefully useful.

Regards

> Date: Fri, 11 Sep 2009 10:43:23 -0700
> Subject: Re: [PHP] RE: [Formaldehyde] The Most Basic Ajax - PHP Error Debugger
> From: bdun...@agentintellect.com
> To: tedd.sperl...@gmail.com
> CC: an_...@hotmail.com; php-gene...@lists.php.net
> 
> > Examine this:
> >
> > http://webbytedd.com/a/ajax-site/js/a.js
> >
> > Now, where can something go wrong?
> 
> I suppose slave.php could fail with a 4xx or 5xx response. Then, most
> likely, the user would be left clicking on a link that does nothing.
> In an edge case the body of the error-response might include a '|'
> character, which would really mix things up.
> 
> Certainly, you wouldn't /need/ Formaldehyde to debug this, but it
> might make the process a bit simpler -- if I read the docs correctly,
> Formaldehyde would let you see and grasp the whole problem instantly
> from a browser, without having to resort to web-server logs, etc.
> 
> Ben

_________________________________________________________________
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx

--- End Message ---
--- Begin Message ---
On Sat, Sep 12, 2009 at 12:23:44AM +0200, Andrea Giammarchi wrote:

> 
> Exactly Ben, except when PHP fails, even with a Fatal Error, the page has 
> status 200, we need to understand which call failed between hundreds of 
> potential calls in the debugger, and errors could pass silently.
> 
> With Formaldehyde, accordingly with your predefined error_reporting level, 
> above situation will never happen, and the entire process, without changing 
> anything, will be much simpler, as Ben already described.
> 
> So yes Tedd, you did not even read what is Formaldehyde about ... please try 
> to understand it before other comments, maybe you'll discover it's extremely 
> simple, and hopefully useful.
> 

I suspect your English is getting in the way. You're calling this an
AJAX debugger. Debugging in PHP is relatively straightforward, if you
set the error level properly and build your own error handler, etc. So
people on this list would probably think of a PHP debugger as an
unimportant piece of software. Debugging in Javascript is more complex
and difficult, and the responses you're getting on the list sound like
people think Formaldehyde is for debugging Javascript (which PHP
programmers often aren't very interested in). On the Google code page
for Formaldehyde, you only emphasize PHP debugging, as that's the only
type of error example you give.

If the point of Formaldehyde is to debug PHP code, then you should call
it a "PHP code debugger", not an "AJAX code debugger". Tedd's right--
basic AJAX transactions are incredibly simple, and once the code is
written (it can be copied from any number of books), it needs no further
work. General Javascript is a different matter-- it can be quite complex
and quite hard to debug. But AJAX is a very narrow application of
Javascript.

If Formaldehyde is really a debugger for AJAX code, then you should
change the examples and text of your Google code page.

If Formaldehyde is really a debugger for Javascript code, then you
should change the examples on your Google code page to show Javascript
errors, and call it a "Javascript debugger".

If Formaldehyde is really a debugger for PHP code, then call it a "PHP
code debugger". The examples on your Google code page fit this.

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
I dont think I understood you completely..

Javascript debugger: Something you use to debug javascript. but
Formaldehyde dosent make any seance if xhr object is not used.
PHP Debugger: We cant use Formaldehyde to debug errors in every single
PHP script. I am talking about pages called directly via the browsers
URL bar. FirePHP on the other hand can be used with all PHP scripts.
AJAX Debugger: I think the example given in Formaldehyde Google code
page fits this category. If not may be you can give an example ?

@Andera May be you should consider using application/json as the
content type instead of text/plain.
The Response text given by  Formaldehyde cannot be understood manually
(for example if I use jQuery.load()).
Had the content type been application/json firebug parses it by default

--- End Message ---
--- Begin Message ---
> @Andera May be you should consider using application/json as the
> content type instead of text/plain.
> The Response text given by  Formaldehyde cannot be understood manually
> (for example if I use jQuery.load()).
> Had the content type been application/json firebug parses it by default

my mistake.

--- End Message ---
--- Begin Message ---
my english is not perfect, right ... but let me unsderline something.

The subject:

 [Formaldehyde] The Most Basic Ajax ------> - <--------  *PHP* *Error* 
*Debugger*

It's a PHP Error Debugger specially suited for Ajax interactions.

Secondly,
The set_error_handler is not enough, write it even upside down and most crucial 
error like these will not be managed:

E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, 
E_COMPILE_WARNING, E_STRICT
Finally, this is the first code example in Formaldehyde page:

<?php // generates a Fatal Error

echo 'Hello', *iDoNotExist*(), ' ', 'World';

?>
And the first result image:

http://www.3site.eu/formaldehyde/no-formaldehyde.gif

Which clearly *is* about an unmanaged Fatal Error

Ajax responses are usually different, even if the called page is the same, and 
the reason could be an X-Request-With: XMLHttpHeader header, usually set by 
default with every library and for each Ajax interation.

I like to reply about a subject, after I understand what is the subject is 
about ... but you are right, my English is not perfect, but PHP developers 
should be more careful about what PHP debug is, what is possible to do with 
set_error_handler, and how Formaldehyde manage *any* *kind* of *php* *error*, 
something I cannot find in any other library or framework.

Regards


> Date: Sat, 12 Sep 2009 00:20:58 -0400
> From: pa...@quillandmouse.com
> To: php-gene...@lists.php.net
> Subject: Re: [PHP] RE: [Formaldehyde] The Most Basic Ajax - PHP Error Debugger
> 
> On Sat, Sep 12, 2009 at 12:23:44AM +0200, Andrea Giammarchi wrote:
> 
> > 
> > Exactly Ben, except when PHP fails, even with a Fatal Error, the page has 
> > status 200, we need to understand which call failed between hundreds of 
> > potential calls in the debugger, and errors could pass silently.
> > 
> > With Formaldehyde, accordingly with your predefined error_reporting level, 
> > above situation will never happen, and the entire process, without changing 
> > anything, will be much simpler, as Ben already described.
> > 
> > So yes Tedd, you did not even read what is Formaldehyde about ... please 
> > try to understand it before other comments, maybe you'll discover it's 
> > extremely simple, and hopefully useful.
> > 
> 
> I suspect your English is getting in the way. You're calling this an
> AJAX debugger. Debugging in PHP is relatively straightforward, if you
> set the error level properly and build your own error handler, etc. So
> people on this list would probably think of a PHP debugger as an
> unimportant piece of software. Debugging in Javascript is more complex
> and difficult, and the responses you're getting on the list sound like
> people think Formaldehyde is for debugging Javascript (which PHP
> programmers often aren't very interested in). On the Google code page
> for Formaldehyde, you only emphasize PHP debugging, as that's the only
> type of error example you give.
> 
> If the point of Formaldehyde is to debug PHP code, then you should call
> it a "PHP code debugger", not an "AJAX code debugger". Tedd's right--
> basic AJAX transactions are incredibly simple, and once the code is
> written (it can be copied from any number of books), it needs no further
> work. General Javascript is a different matter-- it can be quite complex
> and quite hard to debug. But AJAX is a very narrow application of
> Javascript.
> 
> If Formaldehyde is really a debugger for AJAX code, then you should
> change the examples and text of your Google code page.
> 
> If Formaldehyde is really a debugger for Javascript code, then you
> should change the examples on your Google code page to show Javascript
> errors, and call it a "Javascript debugger".
> 
> If Formaldehyde is really a debugger for PHP code, then call it a "PHP
> code debugger". The examples on your Google code page fit this.
> 
> Paul
> 
> -- 
> Paul M. Foster
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

--- End Message ---
--- Begin Message ---
aveev wrote:
where the id consists of 3 alphanumeric characters and 4 numerical digits in
the beginning (for numerical digit, it can grow like this AAA10001). I try
to use php script to generate id like this, where I use the following
script.

<?
    function generate_id($num) {
        $start_dig = 4;
        $num_dig = strlen($num);
$id = $num;
        if($num_dig <= $start_dig) {
            $num_zero = $start_dig - $num_dig;
for($i=0;$i< $num_zero; $i++) {
                $id = '0' . $id;
            }
        }
        $id = 'AAA' . $id;
        return $id;
    }

You can create a stored procedure or a trigger on inserting that implement your id logic.

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

Seeking for a position <http://lupusmic.org/pro/>

--- End Message ---
--- Begin Message ---
The reason why I used incremental value from the db is that I need a sequence
number generator that can be used as an argument to my function. If I can
generate sequence number myself, I don't need this incremental value from
db.
What I want is that the sequential alphanumeric id that increments it's
numeric value by one everytime a new record is inserted while the alphabet
part remains the same..(like I've shown before):
AAA0001
AAA0002
...
AAA0009
AAA0010 
This id will be used as the application number that will be printed as a
barcode on the user's application form. The requirement says that the app
number is prefixed with the letters (actually it's not 'AAA' but 'FIN' which
stands for File Identification Number)....



tedd-2 wrote:
> 
> 
> aveev:
> 
> Why get an incremental value from the database? What information does 
> that give you? Why do you want it? And what are you going to do with 
> it?
> 
> When those questions are answered, then we can help with more informed
> advice.
> 
> Cheers,
> 
> tedd
> 
> -- 
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Creating-alphanumeric-id-for-a-table-tp25391939p25411503.html
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---
--- Begin Message ---
if i have an expression that evaluates to an object, the return value from a
function, say, and i only want the value of one of the objects properties,
is there a tidy way to get it without setting another variable?

to illustrate, here's something that doesn't work, but it would be
convenient if it did:

$o = array( (object) array('a'=>1), (object) array('a'=>2) );

if ( end($o)->a > 1 ) {  // can't use -> like this!
...
}




--- End Message ---
--- Begin Message ---
Wouldn't it be $o[1]->a?

J Corry
Sent from my iPhone

On Sep 11, 2009, at 7:31 PM, Tom Worster <f...@thefsb.org> wrote:

if i have an expression that evaluates to an object, the return value from a function, say, and i only want the value of one of the objects properties,
is there a tidy way to get it without setting another variable?

to illustrate, here's something that doesn't work, but it would be
convenient if it did:

$o = array( (object) array('a'=>1), (object) array('a'=>2) );

if ( end($o)->a > 1 ) {  // can't use -> like this!
...
}




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
On Fri, Sep 11, 2009 at 07:31:01PM -0400, Tom Worster wrote:

> if i have an expression that evaluates to an object, the return value from a
> function, say, and i only want the value of one of the objects properties,
> is there a tidy way to get it without setting another variable?
> 
> to illustrate, here's something that doesn't work, but it would be
> convenient if it did:
> 
> $o = array( (object) array('a'=>1), (object) array('a'=>2) );
> 
> if ( end($o)->a > 1 ) {  // can't use -> like this!
> ...
> }
> 

You should use print_r() or var_dump() to investigate what happens when
you try to cast an array into an object. I myself don't know what would
happen. Also, what's allowed and what effects are produced could depend
heavily on the version of PHP you're running. Version 4 != 5 != 5.3 in
this respect.

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
Tom Worster wrote:
if i have an expression that evaluates to an object, the return value from a
function, say, and i only want the value of one of the objects properties,
is there a tidy way to get it without setting another variable?

to illustrate, here's something that doesn't work, but it would be
convenient if it did:

$o = array( (object) array('a'=>1), (object) array('a'=>2) );

if ( end($o)->a > 1 ) {  // can't use -> like this!
...
}

What version of PHP are you using? Your example should work.


Torben

--- End Message ---
--- Begin Message ---
Hi.

Some time ago I developed a small web application that a bunch of users
has installed.

I have always used the DOCUMENT_ROOT for my includes, but the other day
I installed the application in a subdirectory, and as you've guessed a
lot of the includes didn't work.

I have been reading up on the subject of absolute vs. relative paths
etc. And on the subject of defining your own document root.

I need the application to be as user friendly as possible, and I would
like to avoid having users enter path details in the configuration.

What is the best way to solve this problem?

Best regards.

Rico.

--- End Message ---
--- Begin Message ---
On Sat, Sep 12, 2009 at 06:18:50AM +0200, Rico Secada wrote:

> Hi.
> 
> Some time ago I developed a small web application that a bunch of users
> has installed.
> 
> I have always used the DOCUMENT_ROOT for my includes, but the other day
> I installed the application in a subdirectory, and as you've guessed a
> lot of the includes didn't work.
> 
> I have been reading up on the subject of absolute vs. relative paths
> etc. And on the subject of defining your own document root.
> 
> I need the application to be as user friendly as possible, and I would
> like to avoid having users enter path details in the configuration.
> 
> What is the best way to solve this problem?

Don't move your files to a subdirectory if they're written to be in the
document root (and vice versa). ;-} Seriously.

There really isn't a way around this. All your files need to be in the
same places at all times relative to each other. You can use absolute
paths or relative paths; it doesn't matter. But the files themselves
can't be moved. The only alternative to this is to write a search
function which searches in fixed locations for files until it finds
them. And that's kind of silly.

Look at it this way: Major frameworks all specify their subsidiary files
to be in certain fixed locations. They'll have directories for
javascript files, directories for internal classes, directories for
configuration files, etc. They may or may not use relative pathing to
refer to those files, but the files themselves must be in a certain
location with respect to each other, always.

My convention is to set up fixed directories for each type of file (as
mentioned above) and then always put files of that type in those
directories. Then use relative or fixed pathing as desired from other
files that include() those files.

If you're using a front controller, then you can use PHP server
variables to get the path to that file, and use that as the reference
for the location of the other files.

(Or maybe I've completely misread what you're trying to do.)

Paul

-- 
Paul M. Foster

--- End Message ---

Reply via email to