How to generate pages on the fly?
Moderator: Tata
How to generate pages on the fly?
Working on miniblog
and the alpha version of the next version comes with the possibility that external persons can write blogs (via Christoph's extedit_XH, after log in via register/memberpages).
However, the URLs now look like this:
http://www.mycmsimple.yx/?Blog&mblog=author---title
Seems to me not very elegant. What do you think? I'd rather have
http://www.mycmsimple.yx/?Blog/author/title
Would that be possible? And if, how to do it?
and the alpha version of the next version comes with the possibility that external persons can write blogs (via Christoph's extedit_XH, after log in via register/memberpages).
However, the URLs now look like this:
http://www.mycmsimple.yx/?Blog&mblog=author---title
Seems to me not very elegant. What do you think? I'd rather have
http://www.mycmsimple.yx/?Blog/author/title
Would that be possible? And if, how to do it?
Re: How to generate pages on the fly?
Off the top of my head: when CMSimple(_XH) starts up, the "URL" of the page (i.e. Blog/author/title) is stored in $su, and if there's no such page, $s is set to -1. When the plugins are loaded, one can catch certain $su values and append any HTML to $o; if the latter is actually done, $s won't be fixed by CMSimple(_XH), but the system doesn't complain.svasti wrote:I'd rather have
http://www.mycmsimple.yx/?Blog/author/title
Would that be possible? And if, how to do it?
Christoph M. Becker – Plugins for CMSimple_XH
Re: How to generate pages on the fly?
Yep, that's it. Works!
Re: How to generate pages on the fly?
Too bad, doesn't quite work
A very strange finding:
Some, not all, plugins will not evaluate in the blog pages addressed as ?miniblog/author/title
CMSimple complains that these plugin calls are not defined. However if the page is addressed in the old style ?Blog&mblog=author---title there is no problem, all plugin calls work.
So I had CMSimple print out all its functions (there were 205 in this case): the functions that didn't work came in the alphabet after miniblog. After I renamed the miniblog plugin folder to zzminiblog everything worked.
So how do I get CMSimple to process miniblog as last plugin? Or how do I make CMSimple evaluated the remaining (alphabet wise) plugin calls after miniblog has beem processed?
Edit: And is there a way these new URLs could be added to the internal Link list of the online editors? And to the sitemap? And to sitemapper_XH? And what about the search function...
A very strange finding:
Some, not all, plugins will not evaluate in the blog pages addressed as ?miniblog/author/title
CMSimple complains that these plugin calls are not defined. However if the page is addressed in the old style ?Blog&mblog=author---title there is no problem, all plugin calls work.
So I had CMSimple print out all its functions (there were 205 in this case): the functions that didn't work came in the alphabet after miniblog. After I renamed the miniblog plugin folder to zzminiblog everything worked.
So how do I get CMSimple to process miniblog as last plugin? Or how do I make CMSimple evaluated the remaining (alphabet wise) plugin calls after miniblog has beem processed?
Edit: And is there a way these new URLs could be added to the internal Link list of the online editors? And to the sitemap? And to sitemapper_XH? And what about the search function...
Re: How to generate pages on the fly?
Just use XH_afterPluginLoading.svasti wrote:So how do I get CMSimple to process miniblog as last plugin? Or how do I make CMSimple evaluated the remaining (alphabet wise) plugin calls after miniblog has beem processed?
Hm, that's more of a problem. The editor's link list and the sitemap are built using the $u array. Probably it's not a problem to append to $u, but I wouldn't insert elements into it – all the other related arrays would have to be modified also. And doing that in the middle of the plugin loading or after all plugins would have been loaded, surely creates a mess (if only in some rare circumstances). Sitemapper_XH also relies on $u & Co., so bad luck.svasti wrote:And is there a way these new URLs could be added to the internal Link list of the online editors? And to the sitemap? And to sitemapper_XH? And what about the search function...
Regarding the search function: in my opinion there should be a hook for plugins to register interest in participating in the search. If a search is requested, the core would dispatch to all registered plugins, each of which would return their own search results. The core would merge these results with its own, and present the list to user.
Christoph M. Becker – Plugins for CMSimple_XH
Re: How to generate pages on the fly?
Not quite sure how to use it.cmb wrote:Just use XH_afterPluginLoading.
The function producing the page is
Code: Select all
if ($s == -1 && strpos($su,'miniblog')===0 && strlen($su) > 11) {
$o = Miniblog_extPage($su);
}
function Miniblog_extPage($url) {...
I thought of adding all links at the end, so may be a possibility.cmb wrote:Probably it's not a problem to append to $u
Ok, a point for 1.7cmb wrote:Regarding the search function: in my opinion there should be a hook for plugins
Re: How to generate pages on the fly?
XH_afterPluginLoading() expects a callback function to be passed as parameter. This callback function is called by the core immediately after all plugins have been loaded (i.e. after index.php and admin.php have been included). So, for instance, somewhere in index.php write:svasti wrote:Not quite sure how to use it.cmb wrote:Just use XH_afterPluginLoading.
The function producing the page isNow where and how to insert XH_afterPluginLoading()?Code: Select all
if ($s == -1 && strpos($su,'miniblog')===0 && strlen($su) > 11) { $o = Miniblog_extPage($su); } function Miniblog_extPage($url) {...
Code: Select all
XH_afterPluginLoading(
function () {
global $s, $su, $o;
if ($s == -1 && strpos($su, 'miniblog')===0 && strlen($su) > 11) {
$o = Miniblog_extPage($su);
}
}
);
Christoph M. Becker – Plugins for CMSimple_XH
Re: How to generate pages on the fly?
Very nice, this does the job. Sorry that I had to ask
My experiences with adding the new URLs are mixed. Blog postings are entered via extedit (by members), however extedit is a bit restricted: it seems not to show the link list.
So I thought adding the new URLs doesn't make much sense.
The new URLs will only be added in admin mode, so that the admin can take advantage of them.
My experiences with adding the new URLs are mixed. Blog postings are entered via extedit (by members), however extedit is a bit restricted: it seems not to show the link list.
So I thought adding the new URLs doesn't make much sense.
The new URLs will only be added in admin mode, so that the admin can take advantage of them.