Posted in core
5552
11:33 pm, December 13, 2018
 

Core Class - Basic Core Structure

A Core class that can be used as a base for all content types and uses the extend classes to define the database variables. So basically you can set up core class and then create sub extend classes to define everything easily. I wanted something where i could just add items into an array and they would auto be created in a database taking away some of the pain of creating table structures and all that kind of thing.

For each core extend it creates a new database file in sqlite, so each extend is contained in its own file. Im not sure how this degrades the site performance, but it seems to work ok so far.

When the rows of each database exceed 100,000 it seems to slow a bit in text searching but i would guess that this would happen most data bases that have text searching so it wouldnt make too much of a difference. 

This is just the core class structure i will add each core function seperately and explain each bit or just add the code. 

PHP

class core {

    public $status = "";
    public $nice_name = "Core";
    public $nice_description = "The Main Core";
    public $title_url_length = 100;
    public $images_enabled = true; // enable or disable the use of image links in this class

    public $db; // was private static
    public $db_directory = "/../db/";
    public $db_table_name = "core";
    public $db_file_location = ""; // can set manually if do not want to use default name. 

    public $add_to_menu = false; // add this class to the main menu

    protected $core_version = "core 1.0.1";
    
    // default database variables + array
    public $id;
    public $uid;
    public $insdate;
    public $title;
    public $additional;
    public $category;
    
    public $load_array = [
    "id",
    "uid",
    "insdate",
    "title",
    "additional",
    "category",
    ]; 

}

View Statistics
This Week
111
This Month
394
This Year
790

No Items Found.

Add Comment
Type in a Nick Name here
 
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
“If you just sit and observe, you will see how restless your mind is. If you try to calm it, it only makes it worse, but over time it does calm, and when it does, there’s room to hear more subtle things. You see so much more than you could see before. It’s a discipline; you have to practice it.”
Steve Jobs
Random CSS Property

:enabled

The :enabled CSS pseudo-class represents any enabled element. An element is enabled if it can be activated (selected, clicked on, typed into, etc.) or accept focus. The element also has a disabled state, in which it can't be activated or accept focus.
:enabled css reference