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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.