Summary: Talk page for B3 blog.
Maintainer: Petko
Users: +2 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.


27 janvier 2018 Magnifique, grand merci

 B3 est compatible avec Cookbook:PerGroupSubDirectories ? Merci, FidelioEspoir

C'est censé fonctionner avec les différentes configurations, quel est le problème? --Petko January 27, 2018, at 08:25 AM Plus de problème. Merci

Il n'y a rien entre B3 et PerGroupSubDirectories qui serait en conflit - mais en le désactivant, si B3 fonctionne on saura que si. Quelle est la configuration de B3? Quelle est la configuration du wiki? Quelle est la version de PmWiki et de PHP? Quels sont les versions des autres modules/recettes installés? Puis-je voir et tester l'installation? -- (e-mail) -> mailto:5ko [snail] 5ko [period] fr Petko January 28, 2018, at 09:09 AM

Fewer HTTP requests

To optimize performance of my sites, I like to make sure that external files such as JS files, stylesheets, etc., only get linked if they are needed on a particular page. (This is especially important for visitors with poor internet connections, who suffer when their browser must make many HTTP requests to load a page.) The B3 recipe loads b3.css and b3.js for all pages, but in fact these files are only needed on B3 blog listing and blog post pages!

Here is what I did to correct this. I replaced lines 164 and 165 of b3.php with this function:

function B3AttachAuxiliaryFiles() {
	static $ran_once = false;
	if (!$ran_once) {
		global $HTMLHeaderFmt, $HTMLFooterFmt, $B3;
		SDVA($HTMLHeaderFmt, array('b3css' => "<link rel='stylesheet' href='{$B3['DirUrl']}/b3.css' type='text/css' />"));
		SDVA($HTMLFooterFmt, array('b3js' => "<script type='text/javascript' src='{$B3['DirUrl']}/b3.js' async></script>"));
	$ran_once = true;

Then, I inserted a call to B3AttachAuxiliaryFiles() into the FmtB3(), FmtB3List(), and FmtB3Comment() functions (near the top, to ensure it would happen no matter which return statement was followed).

This ensures that the JS and CSS files are linked to the page, only if the page has some need for them. I have tested this solution and it seems to work just fine. (I have also done something similar for some other recipes I use/maintain/etc.; this has quite reduced the number of HTTP requests required to load any particular page of one of my wikis.)

Said Achmiz January 05, 2018, at 12:53 AM

Excellent suggestion. I implemented it in 20180105 a little differently, adding the html snippets in the $B3 array (also to allow customization) and directly calling SDVA() from FmtB3() and from FmtB3List(). There should only be calls to FmtB3Comment() from inside a [[#b3]]...[[#b3end]] block, ie FmtB3() will be called anyway, and SDVA() sets the value only when unset, ie once. Thanks. --Petko January 05, 2018, at 07:07 AM

It works, thanks! —Said Achmiz January 05, 2018, at 12:46 PM

PmWeekly question

Great job so far!! Have you automated some of the postings, or are you writing them all up by hand? For example: subversion commit messages, recent updates from the website, etc. — I'm wondering whether you have something on the back end compiling your newsletter drafts before they're published, or if you're putting the information together yourself manually. The one feature I wish were still working is xmlrpc. There was a time that I could edit my entire wiki via Ecto. Easy to use sidebar of groups & pages, tweak the markup, publish, and it would update the website. I could maintain all my customer websites this way quite easily. It never made it past PHP 5 compatibility, and I'm not up on my PHP enough to debug that one. Works great with blogs, but even better with huge wiki sites with many groups. XES September 05, 2017, at 11:56 AM

I use a [[#template]]...[[#templateend]] which you can see here, and I just fill in the blanks (manually, from the different sources and RecentChanges pages). It takes me about 1 hour to compile the post. I've never used xmlrpc. --Petko September 05, 2017, at 12:55 PM

Talk page for the B3 blog recipe (users).