Posted in core
6795
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
257
This Month
792
This Year
2033

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
Most people can do absolutely awe-inspiring things,” he said. “Sometimes they just need a little nudge.
Unknown
Random CSS Property

@viewport

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
user-zoom (@viewport) css reference