473,511 Members | 16,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Preparse/preprocess PHP file ?

Hi,

My question is probably entirely described in the subject... I need to
preprocess a PHP file before it enters the PHP parser. My goal is to
change some non-PHP parts of text into PHP orders. I see in PHP doc an
output_handler to postprocess the output. And I see that there is no
input_handler.

Does anybody have a clue, a solution ? I am also looking for a solution
outside PHP, in some Apache modules (for instance mod_transform, but I
am not sure...).

TIA

Sylvain
Jul 17 '05 #1
4 5072
Sylvain Donnet <sd*****@ddo-org.com> wrote:
My question is probably entirely described in the subject... I need to
preprocess a PHP file before it enters the PHP parser. My goal is to
change some non-PHP parts of text into PHP orders. I see in PHP doc an
output_handler to postprocess the output. And I see that there is no
input_handler.


What are you trying to do that can't be handled from within PHP? Is this
per request or only once? Maybe at intervals (sou you can schedule it).

BTW a quick and dirty way to do this within PHP is to rad the file into
a string, modify it and than eval() it...

--

Daniel Tryba

Jul 17 '05 #2
Hello,

On 08/30/2004 07:10 PM, Sylvain Donnet wrote:
My question is probably entirely described in the subject... I need to
preprocess a PHP file before it enters the PHP parser. My goal is to
change some non-PHP parts of text into PHP orders. I see in PHP doc an
output_handler to postprocess the output. And I see that there is no
input_handler.
Use the tokenizer extension:

http://www.php.net/tokenizer
Does anybody have a clue, a solution ? I am also looking for a solution
outside PHP, in some Apache modules (for instance mod_transform, but I
am not sure...).


If you are looking for a templating solution, try Smarty:

http://smarty.php.net/
--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #3
Manuel Lemos wrote:
Hello,
I already have found smarty and its template logics. I didn't know about
tokenizer. Both are interesting, but I think I need batch processes to
parse my PHP files. I am going to explain my goals by an example :

I want to allow some HTML writers to write HTML files (in fact, PHP
files, but not mandatory) and to include into them some markers, for
instance : <phpoutput>...</phpoutput>, and when theses pages are
rendered, theses markers are changed by PHP code : <?php echo .... ?>,
BEFORE or EXACTLY WHEN theses pages entered the parser.

Sylvain
On 08/30/2004 07:10 PM, Sylvain Donnet wrote:
My question is probably entirely described in the subject... I need to
preprocess a PHP file before it enters the PHP parser. My goal is to
change some non-PHP parts of text into PHP orders. I see in PHP doc an
output_handler to postprocess the output. And I see that there is no
input_handler.

Use the tokenizer extension:

http://www.php.net/tokenizer
Does anybody have a clue, a solution ? I am also looking for a
solution outside PHP, in some Apache modules (for instance
mod_transform, but I am not sure...).

If you are looking for a templating solution, try Smarty:

http://smarty.php.net/

Jul 17 '05 #4

"Sylvain Donnet" <sd*****@ddo-org.com> wrote in message
news:41**********************@news.free.fr...
Hi,

My question is probably entirely described in the subject... I need to
preprocess a PHP file before it enters the PHP parser. My goal is to
change some non-PHP parts of text into PHP orders. I see in PHP doc an
output_handler to postprocess the output. And I see that there is no
input_handler.

Does anybody have a clue, a solution ? I am also looking for a solution
outside PHP, in some Apache modules (for instance mod_transform, but I
am not sure...).


Might be overkill for your problem, but the DMS Software Reengineering
toolkit can parse full PHP4 and PHP5, and carry out arbitrary
transformations.
See http://www.semanticdesigns.com/Produ...MSToolkit.html.
--
Ira D. Baxter, Ph.D., CTO 512-250-1018
Semantic Designs, Inc. www.semdesigns.com
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6082
by: Brandon Walters | last post by:
I wrote a file download module for my website. The reason for the file download module is that my website downloads work on a credit based system. So I need to keep track of and limit daily...
11
3317
by: Chris Croughton | last post by:
I have a requirement to partially preprocess C code. By 'partially' I mean that I need to define some macros (to the utility) and have it preprocess only those macros, leaving everything else...
2
7813
by: Benny Raymond | last post by:
I need to be able to process the message WM_MOVING and WM_MOVE, however I noticed that the following breakpoint in PreProcessMessage isn't hit on move (it does get hit when I press alt for instance...
0
3910
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
0
2015
by: thjwong | last post by:
I'm using WinXP with Microsoft Visual C++ .NET 69462-006-3405781-18776, Microsoft Development Environment 2003 Version 7.1.3088, Microsoft .NET Framework 1.1 Version 1.1.4322 SP1 Most developers...
1
2192
by: efinzel | last post by:
Good morning- I am brand new to any kind of programming language. I am only attempting it because I want to use the Generic Mapping Tools program (http://gmt.soest.hawaii.edu/) to create maps. I...
1
2291
by: =?iso-8859-1?Q?David_S=E1nchez_Mart=EDn?= | last post by:
Hi! I've seen the message below in this python list, that seems to be unanswered. I'm trying to do the pretty same thing. There's a way to preprocess the request with a mod_python handler...
0
984
by: ramgopalkota | last post by:
Hi , I have a corba code generated by tool.In one of the header file created by the tool has a peice of code as below #include <someincludes> #ifdef _LC_attr #error "LC ATTR is DEFINED"...
1
5503
jkmyoung
by: jkmyoung | last post by:
I am attempting to automatically open .xml files with a .bat script when I open them. Microsoft XP 2002 SP 2 Ultimate goals: 1. Figure out how Open With list is stored. 2. Edit Open With...
0
7242
marktang
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,...
0
7138
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...
0
7355
Oralloy
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,...
0
7423
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7510
tracyyun
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...
0
5668
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5066
isladogs
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...
0
3225
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...
0
447
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.