473,807 Members | 2,851 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Does PHP have anything like Java/JSP "filters" or Zope's acquisition?

What I'd like to have a request to, say, http://www.mydomain.com/Aaaa/Bbbb/Cccc

be handled by http://www.mydomain.com/Aaaa/index.php

but with the "Bbbb" and "Cccc" stored in a request variable or attribute.
This becomes very very useful when building multi-lingual websites.

This can be done in JSP/servlets using 'filters' and it is
provided in Zope through 'acquisition'.

Is there any way of making this happen with PHP ?

Thank you very much,

Soefara
Jul 17 '05 #1
3 2771
Soefara wrote:
What I'd like to have a request to, say, http://www.mydomain.com/Aaaa/Bbbb/Cccc

be handled by http://www.mydomain.com/Aaaa/index.php

but with the "Bbbb" and "Cccc" stored in a request variable or attribute.
This becomes very very useful when building multi-lingual websites. Is there any way of making this happen with PHP ?


I do that with Apache's ErrorDocument

0. Be sure Apache AllowOverride is set to include FileInfo
1. Create Directory "Aaaa"
2. Create an .htaccess there with
ErrorDocument 404 /Aaaa/index.php
3. Create /Aaaa/index.php as (for example):
<?php
echo $_SERVER['REQUEST_URI'];
?>
4. Go to http://www.mydomain.com/Aaaa/Bbbb/Cccc

5. and see the resulting page:
/Aaaa/Bbbb/Cccc

HTH
--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2
Wow, that's a really interesting hack, Pedro :)

I've never seen people actually use .htaccess and ErrorDocument
to filter requests like that. Thanks for sharing this - it looks
like it will do what I want :)

Soefara

I do that with Apache's ErrorDocument

0. Be sure Apache AllowOverride is set to include FileInfo
1. Create Directory "Aaaa"
2. Create an .htaccess there with
ErrorDocument 404 /Aaaa/index.php
3. Create /Aaaa/index.php as (for example):
<?php
echo $_SERVER['REQUEST_URI'];
?>
4. Go to http://www.mydomain.com/Aaaa/Bbbb/Cccc

5. and see the resulting page:
/Aaaa/Bbbb/Cccc

HTH

Jul 17 '05 #3
Hi Soefara,

We also use a .htaccess trick to get the requests to our index.php script:

RewriteEngine on
RewriteRule ^index_php/(.*) index.php?$1

(this requires your internet provider to make a setting to allow url
rewriting).

But down from index php we use request handlers, which are objects, much
like servlets, only we create a new request handler for each request (In
Java, servlets may be reused, of even handle multiple requests at the
same time). In combination with request forwarding request handlers can
act like filters: For example, this is how our website's
LicenseAgreemen tAction reacts to accepting the the license agreement
before downloading:

function doAgreed()
{
$this->useClass('Menu ', 'beheer');
$forwardData = array(
'pntType' => 'Menu',
'id' => Menu::getDownlo adMenuId(),
'download' => $this->requestData['download'],
'pntHandler' => 'WebStartDownlo adPage'
);
$this->forwardRequest ($forwardData, 'agreed');
}

This creates an instance of the class WebStartDownloa dPage and forwards
the requestData. The page then produces the output that starts the
download. As you can see it creates new requestData for forwarding
(makes the page show the download menu), only 'download' is copied from
the original requestData.

Greetings,

Henk Verhoeven,
www.phpPeanuts.org.
Soefara wrote:
Wow, that's a really interesting hack, Pedro :)

I've never seen people actually use .htaccess and ErrorDocument
to filter requests like that. Thanks for sharing this - it looks
like it will do what I want :)

Soefara
I do that with Apache's ErrorDocument

0. Be sure Apache AllowOverride is set to include FileInfo
1. Create Directory "Aaaa"
2. Create an .htaccess there with
ErrorDocument 404 /Aaaa/index.php
3. Create /Aaaa/index.php as (for example):
<?php
echo $_SERVER['REQUEST_URI'];
?>
4. Go to http://www.mydomain.com/Aaaa/Bbbb/Cccc

5. and see the resulting page:
/Aaaa/Bbbb/Cccc

HTH


Jul 17 '05 #4

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

Similar topics

1
1764
by: Christian Otteneuer | last post by:
Hallo NG, Hope, that I'm not totally wrong in this newsgroup. I have a question about PropertyObjects in Zope: I want to get some PropertyObjects out of a ZCatalog. This Code: result = (map( lambda brain: brain.getObject(), container.Catalog.searchResults()))
0
1096
by: Frithiof Andreas Jensen | last post by:
I am writing an application that does a lot of filtering of much data through a sequence of filters. After some thinking and wasting a lot of time with an object oriented design with GUI and all, I decided that the Real Way to do this is to create the filters as independent programs that take input and produce output in the good, olde UNIX way, using good olde MAKE to track what needs to be done next. Now, I need to simplify even...
11
5284
by: Shane Suebsahakarn | last post by:
Hi all, This might be one of those things for which there is no workaround. I'm using A2K2, and using it to perform a very large batch ouput. Both the front and back ends are MDB files, so no SQL Server involved here. Both SP3 and Jet SP8 have been updated, and the platform is running on a dual-processor 3Ghz Xeon Win2K3 Server box with 2GB RAM. The batch run outputs 6 or 7 reports to approximately 16-17,000 snapshot files None of the...
1
2092
by: Eric Hirst | last post by:
I have a Visual Studio Solution .sln which contains multiple projects, including an ODBC driver .dll and a client .exe. The client .exe is a simple MFC query tool. Nothing I can find in the client references the driver directly. It uses a connection string to access the driver, and does not provide this string until the user has filled in a login dialog. But when I debug the .exe, I see that the ODBC driver .dll is being loaded very...
0
2137
by: Ravi Ambros Wallau | last post by:
Hi: I've created a custom control - a grid that uses Infragistics to display some filters, the grid itself, and some buttons. Well, when using this control directly on WebForm, everything works really fine. No problems at all. But, when this control is placed inside a template of an Infragistics UltraWebTab control, somethings stranges happens: 1. When the WebForm is opened, an "Error Creating Control" message is displayed (for container...
32
14715
by: Licheng Fang | last post by:
Basically, the problem is this: 'do' Python's NFA regexp engine trys only the first option, and happily rests on that. There's another example: 'oneself' The Python regular expression engine doesn't exaust all the
113
5327
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside the Python world, you're fine. But once you do, things go downhill. MySQLdb has version and platform compatibility problems. So does M2Crypto. The built-in SSL support is weak. Even basic sockets don't quite work right; the socket module...
350
11951
by: Lloyd Bonafide | last post by:
I followed a link to James Kanze's web site in another thread and was surprised to read this comment by a link to a GC: "I can't imagine writing C++ without it" How many of you c.l.c++'ers use one, and in what percentage of your projects is one used? I have never used one in personal or professional C++ programming. Am I a holdover to days gone by?
3
17259
by: Simon van Beek | last post by:
Dear reader, What can be wrong in my ComboBox, the property "Auto Expand" is set to Yes, but by typing in the ComboBox it doesn't expand. Is this because the source of the ComboBox is a query.
0
9720
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, 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...
0
9599
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,...
0
10372
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
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,...
0
9193
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
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 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...
0
5546
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...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4330
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 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.