OXID Community Forum

> International Forums > Developers > Involve own "library" of util classes
Login
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Thread: Involve own "library" of util classes


Reply
 
Thread Tools Display Modes
#Top   #1  
Old 01-21-2010, 09:20 AM
j.geissler j.geissler is offline
Junior Member
Join Date: Feb 2009
Posts: 26
j.geissler is on a distinguished road
Default Involve own "library" of util classes

Hi all,

I want to add a library of own different util classes (e.g. Transport & Client-Classes for Webservices calls and so on...),
which are in "<shop>/core/ext/dsb-bi-commons-php-1.0.0/util/...".

Actually I add all of them in the function "__autoload" of "oxfunctions.php" so they are automatically added to "require_once" if I need them.
But I don't want do this anymore, because here I have to change root classes/functions of the OXID shop.
Is there any other solution?

Many thanks in advance!

Regards
Jens
Reply With Quote
#Top   #2  
Old 01-21-2010, 10:07 AM
avenger's Avatar
avenger avenger is offline
Senior Member
Join Date: May 2009
Posts: 2,083
avenger is on a distinguished road
Default AW: Involve own "library" of util classes

Wouldn't "modules/functions.php" be a good place for that?
__________________


Individuelle und hochwertige OXID 4 Templates und Shop-Erweiterungen gibt es bei http://www.powertemplate.de
  1. Dem Ingeniör ist nichts zu schwör (Daniel Düsentrieb, 1952)
  2. Geht nicht, gibt's nicht.
  3. Was nicht passt, wird passend gemacht
Weitere Informationen zum powertemplate.de Angebotsspektrum unter http://www.shopplaner.de
Reply With Quote
#Top   #3  
Old 01-21-2010, 01:54 PM
j.geissler j.geissler is offline
Junior Member
Join Date: Feb 2009
Posts: 26
j.geissler is on a distinguished road
Default AW: Involve own "library" of util classes

Hi avenger,

first of all, thanks for your reply.
That's correct, but I don't know how I could use this class for my special requirement.

How can I involve this part from oxfunctions in the "modules/functions.php":
PHP Code:
function __autoload$sClass )
{
    
$sClass basename$sClass );

    static 
$sBasePath  null;
    static 
$aClassDirs null;

    
// preventing infinite loop
    
static $aTriedClasses = array();

    
// initializing paths
    
if ( $aClassDirs == null ) {
        
$sBasePath getShopBasePath();
        
$aClassDirs = array( $sBasePath 'core/',
                             
$sBasePath 'views/',
                             
$sBasePath 'core/exception/',
//                             $sBasePath . 'core/ext/dsb-bi-commons-php-1.0.0/util/guid/',
                             
$sBasePath 'core/interface/',
                             
$sBasePath 'admin/reports/',
                             
$sBasePath 'admin/',
                             
$sBasePath 'modules/',
                             
$sBasePath
                            
);
    }

    foreach ( 
$aClassDirs as $sDir ) {
        
$sFilename $sDir strtolower$sClass ) . '.php';
        if ( 
file_exists$sFilename ) ) {
            require_once 
$sFilename;
            return;
        }
    }
... 
Thanks
Jens
Reply With Quote
#Top   #4  
Old 01-21-2010, 01:59 PM
avenger's Avatar
avenger avenger is offline
Senior Member
Join Date: May 2009
Posts: 2,083
avenger is on a distinguished road
Default AW: Involve own "library" of util classes

Basiscally you can execute any code there.

Couldn't you instantiate your classes there?
__________________


Individuelle und hochwertige OXID 4 Templates und Shop-Erweiterungen gibt es bei http://www.powertemplate.de
  1. Dem Ingeniör ist nichts zu schwör (Daniel Düsentrieb, 1952)
  2. Geht nicht, gibt's nicht.
  3. Was nicht passt, wird passend gemacht
Weitere Informationen zum powertemplate.de Angebotsspektrum unter http://www.shopplaner.de
Reply With Quote
Reply

Bookmarks

Tags
classes, involve, library, util

« Previous Thread | Next Thread »
Thread Tools
Display Modes

Nicht Sichtbar
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Werte von "oxarticles" nach "oxorderarticles" bei Bestellung stoa Newbies 1 07-07-2010 02:01 PM
"Hilfe" und "Mein Konto" konfigurieren gutll Newbies 0 04-14-2010 10:14 PM
Wrong handling of "no picture" situation in "getPictureUrl()" avenger Developers 1 12-02-2009 11:41 AM
Update und "copyThis" bzw. "changed_full" level42 Administration 7 11-21-2009 11:24 PM
Bug or Feature ? Installed 3rd Language "2" is activated the SEO URLs fail and display the first language "0" maxmix Installation and configuration 2 01-29-2009 12:32 PM

All times are GMT +2. The time now is 06:58 AM.