Support forums : Branches

awesome blog creator

Discussion about existing branches and the directions they need to go in, or, for branches that are going to happen. "Quickies" is wide open. "Branches" is more focused.

Moderator: Dracones

awesome blog creator

Postby EdB » Mon Sep 19, 2011 6:50 am

https://code.launchpad.net/~edb/quam-pl ... og_creator

First, it automagically installs all templates found instead of a canned list. Then it gets crazy.

The canned blogs are now canned in a new file in the /qp_config/ folder, which means someone doing an installation can edit that one file to get the blogs the way they want them. ALL aspects of a blog can be set up this way, including custom stub files. I deleted the 3 canned stubs and this branch will recreate them. Or it will create whatever stubs you tell it to create. So the title, shortname, tagline, longdesc, kind, number of posts, access_type, and stubfile are now customizable prior to installation. yay eh?

Remaining problems: you need all 4 blogs else categories and sample posts will probably cause headaches. You can go above 4, but probably not below without problems. You also are stuck with the sample posts. And I haven't tried setting any of the more advanced stuff like enabling workflow or turning off custom css files.

Pretty good start though :)
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: awesome blog creator

Postby leeturner » Mon Sep 19, 2011 11:07 am

Sounds cool.

I take it this is triggered by the installer and not the existence of this file ?

L
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: awesome blog creator

Postby EdB » Mon Sep 19, 2011 4:23 pm

Correct. As I watched a movie last night it dawned on me putting the file in /qp_config/ is probably silly and that it should move to the installer. Once an installation is done this file has no value, and for a power user who will tweak before installing it hardly matters where it is eh?

Yeah so all before install, and the regular users will notice no difference.

Almost any blog setting can be handled but listing them is a total bitch so I'm thinking I'll do a test where I set 20 or 30 blog settings and see if it works or not. Basically an element "settings" which contains arrays of setting_name => setting_value. Pretty simple eh? The same can be done with categories except the cat_create function doesn't allow one to put your own cat_urlname in. So it needs to.

Anyway the guts of each blog look like this, knowing that settings and categories are totally fake right now. Oh and obviously there is no locale like that ... and the template name was done to prove it would go find a real template if the file provides a name that does not exist.
Code: Select all
$shortname T_('Blog A');
$blogs_array[] = array(
    
'name' => sprintfT_('%s Title'), $shortname ),
    
'shortname' => $shortname,
    
'urlname' => 'a',
    
'template' => 'fgsdfgsdfgsdfg',
    
'tagline' => sprintfT_('Tagline for %s'), $shortname ),
    
'longdesc' => sprintf$default_longdesc$shortname ),
    
'locale' => 'ab_CD',
    
'kind' => 'group',
    
'posts' => 11,
    
'siteurl' => 'cool_stub_name.php',
    
'settings' => array( // this part is fake
        
'a_setting' => 'a_value',
        
'another_setting' => 'another_value',
    ),
    
'categories' => array( // this part is fake
        
'cat one' => 'NULL',
        
'cat two' => 'cat one',
    ),
); 
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: awesome blog creator

Postby leeturner » Mon Sep 19, 2011 6:55 pm

The reason I asked was because in this case after the installer is done the file has no value but I was wondering whether a similar thing could be used for a different bit of functionality. The thing I had in mind was the default settings for creating new blogs in the admin. We provide a default file which match the defaults that we currently have but for the advanced users they can edit the file and get a totally different set of defaults when they create a new blog.

L
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: awesome blog creator

Postby Kimberly » Mon Sep 19, 2011 11:27 pm

I seem to recall once, maybe over at that other app, someone who wanted to set up a site for a classroom setting where each student would have their own blog and would be writing in the blog throughout the school year, some journalism class or the other. The idea was how to set up the twenty some blogs and set parameters for each blog and so forth. I think the person was wanting an easy way to do that than creating each blog and then one by one going into the settings for each blog. If I understand where Lee is from, having an easy way to set the same parameters for each new blog that are just like the blog before it would have been ideal for that person's task.
Kimberly
Dracone
User avatar
 
Posts: 842
Joined: Mon Jul 19, 2010 4:44 pm

Re: awesome blog creator

Postby EdB » Tue Sep 20, 2011 1:03 am

One could do it with a file, but then one loses their changes on upgrade. Unless it was something like a hacks.php for new blogs (users too by the way). Something like "if file_exists( canned_blog.php ) use those else use core" for default values. Alternatively one could add a fourth option to the blog creation process. Standard, Group, Photo, File. The mechanism discussed in days gone by was a "zero blog" as a master set of blog settings for all new blogs.

I just now thought of making the values for standard and group and photo be tweakable. But really those have very little differences in them.

Anyway I'd go away from a file for storing customizations because of the loss on upgrade, but, it most certainly could be done. This little installer thing could easily be a template for that type of work. And yeah I need to move it back to the installer folder.
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: awesome blog creator

Postby EdB » Tue Sep 20, 2011 7:59 am

Another reason to go with a back-end solution to how new_blog stuff is defined is we can be more descriptive in a page than a file, but that ain't where I'm at at this particular moment.

function cat_create() is in _category_funcs.php and doesn't get used anywhere outside the installer, so why isn't that func in the _functions_install.php? Tblue do you recall a time when we were fixing something to do with cat_urlname and you came up with a solution that was different/better than where I had been going with it? If so do you recall if we maybe stopped using cat_create() in core back then?

I'm thinking either way I should just move that func to the install folder, or maybe even do away with it when cats are built from an array. Like, inside the foreach do the urlname creation and database insert instead of calling a function that does those things. Same amount of code, one less function laying around out there.
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: awesome blog creator

Postby leeturner » Tue Sep 20, 2011 10:29 am

EdB wrote:One could do it with a file, but then one loses their changes on upgrade. Unless it was something like a hacks.php for new blogs (users too by the way). Something like "if file_exists( canned_blog.php ) use those else use core" for default values. Alternatively one could add a fourth option to the blog creation process. Standard, Group, Photo, File. The mechanism discussed in days gone by was a "zero blog" as a master set of blog settings for all new blogs.

I just now thought of making the values for standard and group and photo be tweakable. But really those have very little differences in them.

Anyway I'd go away from a file for storing customizations because of the loss on upgrade, but, it most certainly could be done. This little installer thing could easily be a template for that type of work. And yeah I need to move it back to the installer folder.


Good point. Zero blog is a good way to go

L
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK


Return to Branches

Who is online

Users browsing this forum: No registered users and 2 guests

cron