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?stat e=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 2176
"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?stat e=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?stat e=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?stat e=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?st ate=L2-3>
<include section2.php?st ate=L5-7>
<include section3.php?st ate=L11-13>
<include section4.php?st ate=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?st ate=L2-3> <include section2.php?st ate=L5-7> <include section3.php?st ate=L11-13> <include section4.php?st ate=L2C3-19>
Well for each section,
$state = 'something';
$_GET['state'] = $state;
include('sectio n.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("C ache/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 file loaded and compiled/interpreted every time a php-file is
used that includes this file?
|
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 2000 Server SP 3 english version
- IIS 5
- MS SQL Server 2000 SP 3 english version
- Regional options are both set to English US
|
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 way to do this in 3
steps:
1. Add in main_file.cpp
|
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 for indexing source code, and for a given function or
global variable it can show you all the places where it is referenced.
It would be really nice to have a tool that would simply list all of the
referenced functions, so that you could go...
|
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 means that if I misspell a variable name, my program will
mysteriously fail to work with no error message.
If you don't declare variables, you can inadvertently re-use an
variable used in an enclosing context when you don't intend to, or
| |
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
settle the matter. However this doesn't seem to be at all easy in vba.
I have tried using the code (it is a V add-in) in "Microsoft's P-Code Implementation"
by John Chamberlain
http://www.programmersheaven.com/articles/userarticles/john/vbvm.htm...
|
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" setting to be
"E_ALL", notices are still not getting reported. The perms on my file
are 664, with owner root and group root. The php.ini file is located
at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem
to be having an effect? ...
|
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? or is it a call taken by
compiler?
Second, i see that it is same as what Macro's used to do for c, if so
what is the advantage for going in for inline functions than to Macros?
|
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
understand this error. Why would python try to pass 3 arguments (what
are they) ?
Googling for this error gave random results talking about try to
inherit a "Package" but socket is definitely a class,
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |