473,503 Members | 3,045 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

basename()

TheServant
1,168 Recognized Expert Top Contributor
Hey guys,
I am trying to figure out a more efficienct structure for my website and how it handles files and contents. I am trying very hard to separate all my html and php and although it is going well, I have so many files it's getting hard to keep track of them.

One idea I had was to no longer have a page for each page, but rather one page which calls the components requested, giving the illusion of many individual pages while making the number of pages to alter (if I have to) reduced to one.

So I have the basename function which can tell me the page requested. Is there any way to have a file catch all page requests to that folder?

Like if a file was named "*" in the directory "/folders/pages/" and someone requested "/folders/pages/home.php" then it would run the "*" file? That is the only way I can think of having one file without using $_GET's and some mod rewrites? Any other suggestions welcomed!
Feb 12 '09 #1
6 2175
Markus
6,050 Recognized Expert Expert
I don't really understand your question, but I haven't had my coffee yet.

Anyway, I see you're trying to implement the beautiful 'business seperated from presentation' idea. There are a lot of things out there that will help you with this, one of those is a framework. Most frameworks implement the MVC structure - Model-View-Controller. Basically, it seperates your Model (data requests, etc), your Controllers (makes requests to your models and hands data to your views) and your Views (presentation).

I suggest you check out CodeIgniter (very low learning curve) and if you get any problems I'd be glad to help.

As to your original problem, could you try and explain it more (I know you've explained enough, but I'm feeling watered-down today).

Brb; coffee!
Feb 12 '09 #2
TheServant
1,168 Recognized Expert Top Contributor
Hey Markus,
I have never used a framework, but it keeps coming up so I will have to look into it. I know that I can achieve what I want with rewrites in my htaccess file, and after some extensive googling I think this is the only way. I wanted a "catch all" page which would process which page was requested and call the appropriate content, provided it existed. I was thinking about using the 404 error page in someway?
Feb 12 '09 #3
Markus
6,050 Recognized Expert Expert
Could you not pass a value via the URL and on a, say, index page use that parameter to call the content into your index page?
Feb 12 '09 #4
TheServant
1,168 Recognized Expert Top Contributor
I don't really want to use GET variables, but as I said before, it is either that or doing some tricky things with code ignitor. Thanks for the link btw, it looks like a door into a whole new PHP world, but I am not sure I want to do it now even though it will make this project easier. It looks very OOP-like?
I have never looked at OOP and everytime I do it seems illogical, but I have been learning web-programming for a year now so I should probably start the OOP path! Do you have any good starting points for learning OOP (from no prior experience)?
Feb 12 '09 #5
Markus
6,050 Recognized Expert Expert
@TheServant
OOP is definitely something you have to learn, because most programming languages use it. And, yes, CI uses OOP, but it makes it less of a learning curve when used with the framework.

Sure, the logic of OOP is easy(ish) to comprehend. My problem was taking that logic and applying it to a problem. I just couldn't get my head around it..

I'll find you some resources tomorrow, because I need to go to bed now! :P
Feb 12 '09 #6
TheServant
1,168 Recognized Expert Top Contributor
Thanks mate. I still have a lot to learn, and with only weekends to do anything significant, it could be a long haul, but it's gotta be done!
Feb 12 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

14
2547
by: Xah Lee | last post by:
Just bumped into another irresponsibility in perl. the crime in question this time is the module File::Basename. Reproduction: 1. create a directory containing a file of this name:...
1
3737
by: Sean Berry | last post by:
I have an online ftp type website for a customer that I wrote in a cgi perl script. If the person is trying to upload a file that already exists on the server I am printing a message telling...
1
11006
by: Wild Pete | last post by:
Is there an equivalent to a "basename" in javascript that returns the last part of a file name? For example, given "C:\My Documents\test.txt" and "/usr/local/test.txt", both should return...
0
1448
by: rithish | last post by:
Hello. We are on PHP 5.0.2 LINUX system. Since an hour ago, the function basename() started resulting inconsistent values. print ( "dirname - " . dirname ( __FILE__ ) . "<br>\n" ); print (...
1
2050
by: Peter Saffrey | last post by:
I'd like to resurrect this subject: http://groups.google.com/group/comp.lang.python/browse_frm/thread/11146344b03e72b6/6b2a3b0c0e902114?lnk=gst&q=basename&rnum=2#6b2a3b0c0e902114 If I have a...
4
30911
by: PengYu.UT | last post by:
libgen.h has the basename command. But it is not a C++ head file. Is there any C++ head file have a function or a class doing the same thing? Thanks, Peng
2
4872
by: Thomas Ploch | last post by:
Hello, I have a cgi script that handles fileuploads from windows and *nix machines. i need os.path.basename(filename) to get the pure filename. For *nix, thats not a problem, but for windows,...
0
1184
by: Salve =?iso-8859-1?Q?H=E5kedal?= | last post by:
$var = "/home/user/dir/file" // To extract dir from $var, is echo basename(dirname($var)); // a silly thing to do? Salve
5
4621
by: David d'Angers | last post by:
hi group the following lines are taken from basename.c of the linux coreutil group of programs i don't understand the meaning of several of the functions: initialize_main (&argc, &argv); why...
0
7193
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
7067
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
7264
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
7316
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...
1
6975
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...
0
7449
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...
1
4992
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
3160
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
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.