Hello all.
I have an index.php file that has a lot of functions that I wrote.
Let's say for the sake of argument that there are 1000 functions of
100 lines each. The index.php file is invoked with a "state" a la
"index.php?state=L1-2L3C4-47". Different functions are called
according to what the state is, and then user actions can cause
index.php to be invoked again with a different state. For instance,
you can click an "erase this part" button, and the page will display
again with that part missing.
I don't mind if it takes even a second or two to "compile" (parse?
condense?) the functions the first time through, but a change of state
should take only 1/10 of a second or less. Apart from the compiling,
that goal is achievable, the processing isn't that complicated, but if
the php engine starts from scratch each time I pass through the file,
I will have a problem.
Or maybe, since it is a server-side process, rather than compiling the
functions once for each contact with the page, the functions are
compiled once when the first person contacts the page.
I just have no idea how it works, and I need to know so I can plan my
code accordingly.
Does somebody out there have a detailed knowledge of how this is done?
Regards,
Rick 6 2155
"Rick70" wrote: Hello all.
I have an index.php file that has a lot of functions that I wrote. Let’s say for the sake of argument that there are 1000 functions of 100 lines each. The index.php file is invoked with a "state" a
la "index.php?state=L1-2L3C4-47". Different functions are called according to what the state is, and then user actions can cause index.php to be invoked again with a different state. For
instance, you can click an "erase this part" button, and the page will
display again with that part missing.
I don’t mind if it takes even a second or two to "compile" (parse? condense?) the functions the first time through, but a change of
state should take only 1/10 of a second or less. Apart from the
compiling, that goal is achievable, the processing isn’t that complicated, but if the php engine starts from scratch each time I pass through the
file, I will have a problem.
Or maybe, since it is a server-side process, rather than compiling
the functions once for each contact with the page, the functions are compiled once when the first person contacts the page.
I just have no idea how it works, and I need to know so I can plan
my code accordingly.
Does somebody out there have a detailed knowledge of how this is
done? Regards,
Rick
It does start from scratch every time, and for most applications, it
seems to be just fine. If not acceptable, then look at code caching
s/w like mmcache and others.
-- http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-Function...ict151290.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=506566
In article <f4**************************@posting.google.com >, Rick wrote: Hello all.
I have an index.php file that has a lot of functions that I wrote. Let's say for the sake of argument that there are 1000 functions of 100 lines each. The index.php file is invoked with a "state" a la "index.php?state=L1-2L3C4-47". Different functions are called according to what the state is, and then user actions can cause index.php to be invoked again with a different state. i
I can't really see why you would like 1 big program.
To me it seems, that writing a program for each state results in
smaller, more maintanable programs. And if you give each program the
name of the state, it shouldn't be that hard to convert the
index.php?state=xxx to xxx.php either.
--
Tim Van Wassenhove <http://www.timvw.info>
"Tim Van Wassenhove" <eu**@pi.be> wrote in message
news:2r*************@uni-berlin.de... In article <f4**************************@posting.google.com >, Rick wrote: Hello all.
I have an index.php file that has a lot of functions that I wrote. Let's say for the sake of argument that there are 1000 functions of 100 lines each. The index.php file is invoked with a "state" a la "index.php?state=L1-2L3C4-47". Different functions are called according to what the state is, and then user actions can cause index.php to be invoked again with a different state. i
I can't really see why you would like 1 big program.
To me it seems, that writing a program for each state results in smaller, more maintanable programs. And if you give each program the name of the state, it shouldn't be that hard to convert the index.php?state=xxx to xxx.php either.
-- Tim Van Wassenhove <http://www.timvw.info>
Agreed. One big program is BAD. Multiple smaller units are GOOD. If you look
at my sample application at http://www.tonymarston.co.uk/php-mys...plication.html you will see
that I have totally separate scripts for each of the following:
- list multiple records
- insert a record
- update a record
- view a record
- delete a record
- enter search criteria
This means that each script only includes the code that IT wants, so doesn't
bother accessing code that it is not going to use. I nay have hundreds of
small units, but these are far easier to maintain that one huge unit.
This idea is not new. I learnt it 30 years ago when I was a COBOL
programmer. It is called "modular programming".
--
Tony Marston http://www.tonymarston.net
Hello Tim.
It would be good to break it into several web pages.
The web page naturally breaks into sequential sections, so if there
were some sort of "include" that would include the html output of a
php program, I could do this:
<include section1.php?state=L2-3>
<include section2.php?state=L5-7>
<include section3.php?state=L11-13>
<include section4.php?state=L2C3-19>
I'm not sure I would come out ahead in execution time, since these
would have to be separate web requests in order to have separate php
contexts (like an img=... tag).
--
I come from a Tcl background. In the world of Tcl, there's a tclindex
file. Routines are searched for and loaded as they are required. Is
there something similar in Php?
Regards,
Rick
Tim Van Wassenhove <eu**@pi.be> wrote in message news:<2r*************@uni-berlin.de>... I can't really see why you would like 1 big program.
To me it seems, that writing a program for each state results in smaller, more maintanable programs. And if you give each program the name of the state, it shouldn't be that hard to convert the index.php?state=xxx to xxx.php either.
In article <f4**************************@posting.google.com >, Rick wrote: Hello Tim.
It would be good to break it into several web pages.
The web page naturally breaks into sequential sections, so if there were some sort of "include" that would include the html output of a php program, I could do this:
<include section1.php?state=L2-3> <include section2.php?state=L5-7> <include section3.php?state=L11-13> <include section4.php?state=L2C3-19>
Well for each section,
$state = 'something';
$_GET['state'] = $state;
include('section.php');
Don't see your problem?
--
Tim Van Wassenhove <http://www.timvw.info>
Steve, thanks for the information. Useful and to the point.
I ran across the answer to my problem in the writeup for the Pear
module Cache Lite.
<?php
require_once("Cache/Lite.php");
// (...)
$cache = new Cache_Lite();
if ($data = $Cache_Lite->get($id)) { // cache hit !
echo($data);
} else { // page has to be (re)constructed in $data
require_once("...")
require_once("...")
// (...)
$Cache_Lite->save($data);
}
?>
I was thinking in terms of C/C++ and a pre-processor. But in Php
includes are dynamic. I don't have to include everything I might
possibly need, once at the top of the file.
Regards,
Rick This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Erwin Moller |
last post by:
Hi group,
I have an includefile that I (ahum) include in many scripts.
It contains only functions I need now and then.
Now I was wondering how things work behind the scenes.
Is the whole...
|
by: Gernot Saborowski |
last post by:
To all IIS/ASP-professionals,
we just upgraded from one machine to another and are experiencing some
strange date time number problems.
Both systems have been set up like this:
- MS Windows...
|
by: mescaline |
last post by:
Hi,
Suppose a_file.cpp contains a function a_function()
Now to include it in main_file.cpp I just do #include "a_file.cpp" and
I'm all set.
i recently came across this seemingly roundabout...
|
by: Geronimo W. Christ Esq |
last post by:
Are there any scripts or tools out there that could look recursively
through a group of C/C++ source files, and allow unreferenced function
calls or values to be easily identified ?
LXR is handy...
|
by: James A. Donald |
last post by:
I am contemplating getting into Python, which is used by engineers I
admire - google and Bram Cohen, but was horrified to read
"no variable or argument declarations are necessary."
Surely that...
|
by: polite person |
last post by:
This post comes from seeing the protracted thread(s) on use of integer v long in loop code. My first
reaction was "why not print out the "compiled" code and see what it is in each case? That should...
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting"...
|
by: sam_cit |
last post by:
Hi Everyone,
I have few questions on inline functions, when i declare a function as
inline, is it for sure that the compiler would replace the function
call with the actual body of the function?...
|
by: Maxim Veksler |
last post by:
Hello list,
I'm trying to subclass socket and select, for both I get:
""" TypeError: Error when calling the metaclass bases
module.__init__() takes at most 2 arguments (3 given) """, I don't...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |