Jump to content

need extended class working by calling itself instead of extender class(es)


ozone

Recommended Posts

Hey again. I faced a problem again. Here we go.. :

 

I have main class "core" in file site.php

 

above in this file, is includes, of other future modules (articles, forums etc...)

 

There are classes in included files. So I need somehow to extend main class "core" with other 5 or 10 classes in included files, so I can work properly...

 

It is kind a CMS mini version for me. I tried  :rtfm: - no good :-\

 

//including all classes in include folder
foreach(glob("*.class.php") as $class_filename) {
require_once($class_filename);
}

//main web site control and output class
class website {
function __construct(){
	//get variables from link
	$pre_link = explode('//', $_SERVER['REDIRECT_URL']);
	$link = explode('/', $pre_link[1]);

	//remove .html from the end
	foreach ($link as $sub_link => $address){
		$pat = "/html/i";
		if(preg_match($pat, $address)){
			$link[$sub_link] =  str_replace('.html', '', $address);
		}
		//$link[0] = website.com
		//$link[1] = first_variable between "/"..

		//last variable most often index or link for SEO
		$link['last'] = $link[count($link)];
	}
	//deside module of throw error

}

This is part of core.php file, where is constructor, at this time class contains no more functions...

 

I need advice how to extend main class without calling extenders, becouse there will be 10 classes who extends main "core" class. Thanks in advance...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.