Mybb: Write theme to files

I like developing in files more then in the mysql database. Since the theme is cached in the database with mybb and there are not external files. I decided to a small hook for it. Though i’m not familiar with mybb and its plugin system.

Edit the class_templates.php file in the folder inc :

 

		if(is_dir("dev")){
			if(!is_dir("dev/".$theme['templateset'])){
				mkdir("dev/".$theme['templateset'], 0700);
			}

			if(!file_exists("dev/".$theme['templateset']."/".$title.".htm")){
				$fh = fopen("dev/".$theme['templateset']."/".$title.".htm", 'w');
				fwrite($fh, $this->cache[$title]);
				fclose($fh);
			}

			$fh = fopen("dev/".$theme['templateset']."/".$title.".htm", 'r');
			$this->cache[$title] = fread($fh, filesize("dev/".$theme['templateset']."/".$title.".htm"));
			fclose($fh);
		}

Add this around line 105 and crate a folder dev in the mybbroot. The rest will be autogenerated. Its purely for dev’s who wanne create a theme. I hope you have fun.

My old trainy :P

Though its a bit dusty, the train is here for repairment. It dropped of the table when i was younger and the back connection broke off. I’m thinking of putting this train with some passenger wagons in a backwards connection, for pulling them up the mountain to a little station. So i dont really need the connection at the back. Next step will be making it digital and giving it some smoke 🙂

More stuff about my trains coming soon. And hopefully some train configurations for my new railroads i’m gonna make. But first step is getting all my trains digital 1 by 1 and setup a small testing track.