2012-09-10, 10:07 AM
Hi,
I'm really new to MyBB and I was quite satisfied with the features and how it's close to vB 3.8. Until I came across theme development.
The arrow in the knee here is storing themes in a database and a lack of support to get it out of it, i.e. creating themes through administration. There are just too many cons using browser and textareas over IDEs.
I tried to export a template, it exports only differences between child theme and parent theme, however. Single XML file is another obstacle.
I don't think there's a need for a big change. Actually, an option to export all templates would do the job. One file each is essential here.
That's what I've tried myself before creating a new theme.
This works well for themes inherited from MyBB Master Style. It doesn't take prefixes into account, so it doesn't make subfolders for template groups. Doesn't work for themes with another parent theme, ofc. So far, I haven't need it.
Such an export could help theme developers and make their work with MyBB way friendlier.
Thoughts?
I'm really new to MyBB and I was quite satisfied with the features and how it's close to vB 3.8. Until I came across theme development.
The arrow in the knee here is storing themes in a database and a lack of support to get it out of it, i.e. creating themes through administration. There are just too many cons using browser and textareas over IDEs.
I tried to export a template, it exports only differences between child theme and parent theme, however. Single XML file is another obstacle.
I don't think there's a need for a big change. Actually, an option to export all templates would do the job. One file each is essential here.
That's what I've tried myself before creating a new theme.
<?php
$username = "root";
$password = "";
$hostname = "localhost";
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
$selected = mysql_select_db("mybb",$dbhandle)
or die("Could not select database");
$result = mysql_query("SELECT * FROM `templates` WHERE `sid` = '-2'");
while ($row = mysql_fetch_array($result)) {
$file = "templates/" . $row['title'];
$filehandle = fopen($file, 'w')
or die('Cannot open file: ' . $file);
fwrite($filehandle, $row['template']);
fclose($filehandle);
}
mysql_close($dbhandle);
This works well for themes inherited from MyBB Master Style. It doesn't take prefixes into account, so it doesn't make subfolders for template groups. Doesn't work for themes with another parent theme, ofc. So far, I haven't need it.
Such an export could help theme developers and make their work with MyBB way friendlier.
Thoughts?