hiya guys its been long since i posted here ..
well i am using pattemplate which is a template tool for website development. But in my website's structure i have placed all my classes into a folder called classes that lies in the root. Now to ensure that they are handily available i am using the __autload function from php, like :
[PHP]
function __autoload($cla ssName)
{
if (!class_exists( $className, false))
require_once (dirname(__FILE __).'/../classes/'.$className.'. php');
}[/PHP]
the issue which i faced here is that, now when i include the files from pattemplate folder, it is able to get the single include file to start with but the helping files which are present in the pattemplate folder are not included. It again searches it in the classes folder cause of __autoload thing..
Is there a way out guys ? so that i am able to use the above function which automatically loads files and also let me include the other files ..
3 1578 dlite922 1,584
Recognized Expert Top Contributor
hiya guys its been long since i posted here ..
well i am using pattemplate which is a template tool for website development. But in my website's structure i have placed all my classes into a folder called classes that lies in the root. Now to ensure that they are handily available i am using the __autload function from php, like :
[PHP]
function __autoload($cla ssName)
{
if (!class_exists( $className, false))
require_once (dirname(__FILE __).'/../classes/'.$className.'. php');
}[/PHP]
the issue which i faced here is that, now when i include the files from pattemplate folder, it is able to get the single include file to start with but the helping files which are present in the pattemplate folder are not included. It again searches it in the classes folder cause of __autoload thing..
Is there a way out guys ? so that i am able to use the above function which automatically loads files and also let me include the other files ..
i'm not sure i'm getting what you're saying.
The autoload function gets the files that you are including (such as the pattemplate ones) but not the ones that pattemplate is including?
thanks mate,
that is why i dropped the plan using patTemplate, will stick to smarty now ;)
dlite922 1,584
Recognized Expert Top Contributor
thanks mate,
that is why i dropped the plan using patTemplate, will stick to smarty now ;)
SMARTY is the way to go! Since i've used it, I feel sick when I echo something in a XHTML page. Just feels so weird and wrong!
DM
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: steve |
last post by:
I am quite frustrated with php’s include, as I have spent a ton of
time on it already... anyone can tell me why it was designed like this
(or something I don’t get)?
The path in include is relative NOT to the immediate script that is
including it, but is relative to the top-level calling script.
In practice, this means that you have to constantly worry and adjust
paths in includes, based on the startup scripts that call these...
|
by: Berislav Lopac |
last post by:
With the advent of PHP5, with its OO support and the new __autoload
function, I was thinking of implementing some king of scheme to organize
classes in such a way that they can be easily found by the __autoload
function, yet at the same time would have clear organization of classes.
Currently (in PHP4) I'm using a Java-like scheme, borrowed from ActiveLink
IORCA (www.active-link.com), which uses a special import() function and
classes...
|
by: Tom Cat |
last post by:
Is there anything wrong with using a lot of include files?
On one part of my website, I have a form. The page it posts data to,
includes a different file based on some of the values. The include
files also include other pages based on different values. All of
these work together to select the right information from the database
and display it in the correct format.
I'm just wondering if it is better to put all the code in one file...
|
by: Antimon |
last post by:
Hi,
I'm working on a new web application (php5.1 + postgresql) and i wanted
to have seperated files for each class and use __autoload and i have
everything split to classes now. This makes my pages need to include a
lot of files each request. Do this a huge overhead? I mean shall i go
for gigantic function definition scripts and include all of them at
once?
BTW, my classes are not too big, 4-5 methods and properties each, i
thought...
|
by: Kevin Newman |
last post by:
The primary problem I've had with php is the lack of namespaces, which
makes OOP very difficult to organize, since you end up with large number
of classes cluttering up the same namespace - which leads to a secondary
problem involving php's __autoload feature. Since you cannot specify a
namespace when calling a class that may not have been included, you are
forced to store all of your classes in the same folder in your file
system. This...
| |
by: Tio |
last post by:
I have project in MFC(vc++) . There are files and classes:
classes:dialog1,dialog2,aaa,bbb
----------------------
main.cpp
---------------------
#include "mainfrm.h"
#include "dialog1.h"
#include "dialog2.h"
|
by: ooba gooba |
last post by:
After doing some work in both Java and ASP.NET, I came back to add some
major enhancements to a PHP 4 application I built several years ago. A
lot of the database access is currently sprinkled throughout the
application.
In the Java and .NET worlds, I would do data access code by creating
classes that would handle all of the data access for each of the
application data entities. This worked great and kept all the data
access in one...
|
by: David T. Ashley |
last post by:
Hi,
In my PHP code, I typically break my functions into groups (usually based on
the data type they operate on), and then include the files, i.e.:
require_once("string_functions.inc");
require_once("large_integer.inc");
etc.
The included files never contain any code that gets executed directly (it is
|
by: Ixiaus |
last post by:
I was curious (and have spent an enormous amount of time on Google
trying to answer it for myself) if Python has anything remotely
similar to PHP's SPL __autoload() for loading classes on the fly??
After digging through docs I feel doubtful there is such a language
feature, but, it is possible I missed something or maybe someone has
written an extension?!?
Thanks in advance!
|
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: 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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
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: 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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |