[pLog-general] Templates get cached? + question about actions

Oscar Renalias oscar at renalias.net
Sun Jan 9 18:23:00 GMT 2005


> Hello everybody :-)
> I am in doubt if this should go here or to the forum, however in the 
> forum I
> see very little conversation about the development version, so I'll try
> here...

Until I open a forum specific for testing 1.0 (which I will do soon), 
this list or bugs.plogworld.net are better places :-)

> Anyway:
> today I checked out the latest svn snapshot, to make some experiments 
> with the
> new plog, and to try and port my plugins to it (mainly the shoutbox 
> and the
> currently addicted to).
> My first problem is that it seems that the templates get somehow 
> cached: if I
> make a change in a .template file, it is not applied until I delete the
> corresponding file in the tmp dir... I have found a setting in the 
> admin area
> about caching templates, unfortunately it was already switched off... 
> any
> other suggestions?

I've noticed the same behaviour since I made some changes yesterday... 
I got a tip that pages generated by pLog were not being cached by 
reverse proxies (from somebody who had had a problem with proxies) and 
a solution. However, I noticed that the browser was really caching a 
lot more content than it should!

I have removed those changes (basically, a call to 
session_cache_limiter('public') before every call to session_start()) 
and updated the repository. Can you please try again and see if solves 
your problem?

> BTW, maybe you can help me with this: I was takng a look at all the 
> other
> plugins in the svn, and it is not clear to me what is the use of 
> deriving the
> plugin action from BlogAction, and how in the end do I call my plugin 
> from
> the blog...
>
> In the hello world plugin, I find this:
>
> // -------------------
> // very simple example of an action that is registered by the plugin
> // -------------------
> class PluginHelloWorldAdminAction extends AdminAction
> {
>
> --- snip ---
>
> // -------------------
> // very simple example of an *admin* action that is registered by the 
> plugin
> // -------------------
> class PluginHelloWorldAction extends BlogAction
> {
>
> which confuses me a little :-)

That's an easy one :-)

The new plugin framework allows plugins to register custom actions for 
either the public side or the admin side.

If you are developing an action that is going to be used in the public 
side of your blog, then you should:

1) extend BlogAction, as it has common methods and code for all actions 
of the public side
2) register the action in your plugin class (the one that extends 
PluginBase) via PluginBase::registerBlogAction($actionKey, 
$actionClass) Somewhere in the constructor of your plugin, add the 
following:

$this->registerBlogAction( "actionKey", "YourBlogActionClassName" );

3) once your code is ready, you will be able to type urls like 
index.php?op=actionKey and plog will automatically load the blog action 
that you created and registered.

On the other hand, if you are developing an action for the admin 
interface you should:

1) extend AdminAction (or BlogOwnerAdminAction if the action can only 
be used by the blog owner, or SiteAdminAction if the action can only be 
used by site admins -- pLog will automatically enforce restrictions so 
you don't need to do anything else)
2) register the action via PluginBase::registerAdminAction($actionKey, 
$actionClassName) (works exactly the same as 
PluginBase::registerBlogAction(...)
3) register any new menu entry that you might need via 
PluginBase::addMenuEntry(...) This step is needed so that the action 
can be accessed via a menu option somewhere in the interface.
4) As soon as this steps are ready, your action will be accessible via 
either the interface or via admin.php?op=actionAdminKey

Hope this helped :-) There's also some more information here:

http://www.plogworld.net/wikinew/index.php/PLog_1.0/Plugins

And also other simple plugins that can help as examples are the smileys 
plugin or the feedreader plugin.

Oscar




More information about the pLog-general mailing list